sysarch.h revision 234337
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 234337 2012-04-16 09:38:20Z andrew $ */
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.
48226443Scognet * In addition, code in arm/include/atomic.h and arm/include/asmacros.h
49226443Scognet * assumes that ARM_RAS_END is at ARM_RAS_START+4, so be sure to update those
50226443Scognet * if ARM_RAS_END moves in relation to ARM_RAS_START (look for occurrances
51226443Scognet * of ldr/str rm,[rn, #4]).
52175982Sraj */
53175982Sraj#define ARM_TP_ADDRESS		(ARM_VECTORS_HIGH + 0x1000)
54175982Sraj#define ARM_RAS_START		(ARM_TP_ADDRESS + 4)
55175982Sraj#define ARM_RAS_END		(ARM_TP_ADDRESS + 8)
56175982Sraj
57175982Sraj#ifndef LOCORE
58234337Sandrew#ifndef __ASSEMBLER__
59175982Sraj
60135642Scognet#include <sys/cdefs.h>
61135642Scognet
62135642Scognet/*
63135642Scognet * Pickup definition of uintptr_t
64135642Scognet */
65135642Scognet#include <sys/stdint.h>
66135642Scognet
67135642Scognet/*
68135642Scognet * Architecture specific syscalls (arm)
69135642Scognet */
70135642Scognet
71135642Scognet#define ARM_SYNC_ICACHE		0
72135642Scognet#define ARM_DRAIN_WRITEBUF	1
73142519Scognet#define ARM_SET_TP		2
74142519Scognet#define ARM_GET_TP		3
75135642Scognet
76135642Scognetstruct arm_sync_icache_args {
77135642Scognet	uintptr_t	addr;		/* Virtual start address */
78135642Scognet	size_t		len;		/* Region size */
79135642Scognet};
80135642Scognet
81135642Scognet#ifndef _KERNEL
82135642Scognet__BEGIN_DECLS
83135642Scognetint	arm_sync_icache (u_int addr, int len);
84135642Scognetint	arm_drain_writebuf (void);
85142519Scognetint	sysarch(int, void *);
86135642Scognet__END_DECLS
87135642Scognet#endif
88135642Scognet
89234337Sandrew#endif /* __ASSEMBLER__ */
90175982Sraj#endif /* LOCORE */
91175982Sraj
92135642Scognet#endif /* !_ARM_SYSARCH_H_ */
93