sysarch.h revision 263057
1135642Scognet/* $NetBSD: sysarch.h,v 1.5 2003/09/11 09:40:12 kleink Exp $ */ 2135642Scognet 3139735Simp/*- 4135642Scognet * Copyright (c) 1996-1997 Mark Brinicombe. 5135642Scognet * All rights reserved. 6135642Scognet * 7135642Scognet * Redistribution and use in source and binary forms, with or without 8135642Scognet * modification, are permitted provided that the following conditions 9135642Scognet * are met: 10135642Scognet * 1. Redistributions of source code must retain the above copyright 11135642Scognet * notice, this list of conditions and the following disclaimer. 12135642Scognet * 2. Redistributions in binary form must reproduce the above copyright 13135642Scognet * notice, this list of conditions and the following disclaimer in the 14135642Scognet * documentation and/or other materials provided with the distribution. 15135642Scognet * 3. All advertising materials mentioning features or use of this software 16135642Scognet * must display the following acknowledgement: 17135642Scognet * This product includes software developed by Mark Brinicombe. 18135642Scognet * 4. The name of the company nor the name of the author may be used to 19135642Scognet * endorse or promote products derived from this software without specific 20135642Scognet * prior written permission. 21135642Scognet * 22135642Scognet * THIS SOFTWARE IS PROVIDED BY AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23135642Scognet * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24135642Scognet * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25135642Scognet * IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26135642Scognet * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27135642Scognet * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28135642Scognet * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29135642Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30135642Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31135642Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32135642Scognet * SUCH DAMAGE. 33135642Scognet */ 34135642Scognet 35135642Scognet/* $FreeBSD: head/sys/arm/include/sysarch.h 263057 2014-03-11 22:47:04Z ian $ */ 36135642Scognet 37135642Scognet#ifndef _ARM_SYSARCH_H_ 38135642Scognet#define _ARM_SYSARCH_H_ 39135642Scognet 40175982Sraj#include <machine/armreg.h> 41175982Sraj/* 42175982Sraj * The ARM_TP_ADDRESS points to a special purpose page, which is used as local 43175982Sraj * store for the ARM per-thread data and Restartable Atomic Sequences support. 44175982Sraj * Put it just above the "high" vectors' page. 45226443Scognet * The cpu_switch() code assumes ARM_RAS_START is ARM_TP_ADDRESS + 4, and 46188540Scognet * ARM_RAS_END is ARM_TP_ADDRESS + 8, so if that ever changes, be sure to 47188540Scognet * update the cpu_switch() (and cpu_throw()) code as well. 48263057Sian * In addition, code in arm/include/atomic.h and arm/arm/exception.S 49226443Scognet * assumes that ARM_RAS_END is at ARM_RAS_START+4, so be sure to update those 50249582Sgabor * if ARM_RAS_END moves in relation to ARM_RAS_START (look for occurrences 51226443Scognet * of ldr/str rm,[rn, #4]). 52175982Sraj */ 53239268Sgonzo 54239268Sgonzo/* ARM_TP_ADDRESS is needed for processors that don't support 55239268Sgonzo * the exclusive-access opcodes introduced with ARMv6K. */ 56239268Sgonzo/* TODO: #if !defined(_HAVE_ARMv6K_INSTRUCTIONS) */ 57239268Sgonzo#if !defined (__ARM_ARCH_7__) && \ 58239268Sgonzo !defined (__ARM_ARCH_7A__) && \ 59239268Sgonzo !defined (__ARM_ARCH_6K__) && \ 60239268Sgonzo !defined (__ARM_ARCH_6ZK__) 61175982Sraj#define ARM_TP_ADDRESS (ARM_VECTORS_HIGH + 0x1000) 62175982Sraj#define ARM_RAS_START (ARM_TP_ADDRESS + 4) 63175982Sraj#define ARM_RAS_END (ARM_TP_ADDRESS + 8) 64239268Sgonzo#endif 65175982Sraj 66175982Sraj#ifndef LOCORE 67234337Sandrew#ifndef __ASSEMBLER__ 68175982Sraj 69135642Scognet#include <sys/cdefs.h> 70135642Scognet 71135642Scognet/* 72135642Scognet * Pickup definition of uintptr_t 73135642Scognet */ 74135642Scognet#include <sys/stdint.h> 75135642Scognet 76135642Scognet/* 77135642Scognet * Architecture specific syscalls (arm) 78135642Scognet */ 79135642Scognet 80135642Scognet#define ARM_SYNC_ICACHE 0 81135642Scognet#define ARM_DRAIN_WRITEBUF 1 82142519Scognet#define ARM_SET_TP 2 83142519Scognet#define ARM_GET_TP 3 84135642Scognet 85135642Scognetstruct arm_sync_icache_args { 86135642Scognet uintptr_t addr; /* Virtual start address */ 87135642Scognet size_t len; /* Region size */ 88135642Scognet}; 89135642Scognet 90135642Scognet#ifndef _KERNEL 91135642Scognet__BEGIN_DECLS 92135642Scognetint arm_sync_icache (u_int addr, int len); 93135642Scognetint arm_drain_writebuf (void); 94142519Scognetint sysarch(int, void *); 95135642Scognet__END_DECLS 96135642Scognet#endif 97135642Scognet 98234337Sandrew#endif /* __ASSEMBLER__ */ 99175982Sraj#endif /* LOCORE */ 100175982Sraj 101135642Scognet#endif /* !_ARM_SYSARCH_H_ */ 102