xref: /openbsd-src/sys/arch/arm/include/param.h (revision 569905a93af9a15cee7b4700af2b6e98927b2179)
1*569905a9Sclaudio /*	$OpenBSD: param.h,v 1.25 2023/12/14 13:26:49 claudio Exp $	*/
2e1e4f5b1Sdrahn 
3e1e4f5b1Sdrahn /*
4e1e4f5b1Sdrahn  * Copyright (c) 1994,1995 Mark Brinicombe.
5e1e4f5b1Sdrahn  * All rights reserved.
6e1e4f5b1Sdrahn  *
7e1e4f5b1Sdrahn  * Redistribution and use in source and binary forms, with or without
8e1e4f5b1Sdrahn  * modification, are permitted provided that the following conditions
9e1e4f5b1Sdrahn  * are met:
10e1e4f5b1Sdrahn  * 1. Redistributions of source code must retain the above copyright
11e1e4f5b1Sdrahn  *    notice, this list of conditions and the following disclaimer.
12e1e4f5b1Sdrahn  * 2. Redistributions in binary form must reproduce the above copyright
13e1e4f5b1Sdrahn  *    notice, this list of conditions and the following disclaimer in the
14e1e4f5b1Sdrahn  *    documentation and/or other materials provided with the distribution.
15e1e4f5b1Sdrahn  * 3. All advertising materials mentioning features or use of this software
16e1e4f5b1Sdrahn  *    must display the following acknowledgement:
17e1e4f5b1Sdrahn  *	This product includes software developed by the RiscBSD team.
18e1e4f5b1Sdrahn  * 4. The name "RiscBSD" nor the name of the author may be used to
19e1e4f5b1Sdrahn  *    endorse or promote products derived from this software without specific
20e1e4f5b1Sdrahn  *    prior written permission.
21e1e4f5b1Sdrahn  *
22e1e4f5b1Sdrahn  * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
23e1e4f5b1Sdrahn  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24e1e4f5b1Sdrahn  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25e1e4f5b1Sdrahn  * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26e1e4f5b1Sdrahn  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27e1e4f5b1Sdrahn  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28e1e4f5b1Sdrahn  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29e1e4f5b1Sdrahn  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30e1e4f5b1Sdrahn  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31e1e4f5b1Sdrahn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32e1e4f5b1Sdrahn  * SUCH DAMAGE.
33e1e4f5b1Sdrahn  */
34e1e4f5b1Sdrahn 
355e1e381eSdrahn #ifndef	_ARM_PARAM_H_
365e1e381eSdrahn #define	_ARM_PARAM_H_
37e1e4f5b1Sdrahn 
385e1e381eSdrahn #define	MACHINE_ARCH	"arm"
395e1e381eSdrahn #define	_MACHINE_ARCH	arm
40184e2458Sderaadt #define	MID_MACHINE	MID_ARM6
41e1e4f5b1Sdrahn 
42184e2458Sderaadt #define	PAGE_SHIFT	12
43184e2458Sderaadt #define	PAGE_SIZE	(1 << PAGE_SHIFT)
44e1e4f5b1Sdrahn #define	PAGE_MASK	(PAGE_SIZE - 1)
45184e2458Sderaadt 
46184e2458Sderaadt #ifdef _KERNEL
47184e2458Sderaadt 
48e1e4f5b1Sdrahn #define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
49e1e4f5b1Sdrahn 
50184e2458Sderaadt #define	NBPG		PAGE_SIZE
5112595cf0Sderaadt #define	PGSHIFT		PAGE_SHIFT
5212595cf0Sderaadt #define	PGOFSET		PAGE_MASK
53184e2458Sderaadt 
54e1e4f5b1Sdrahn #define	UPAGES		2			/* pages of u-area */
55e1e4f5b1Sdrahn #define	USPACE		(UPAGES * PAGE_SIZE)	/* total size of u-area */
56184e2458Sderaadt #define	USPACE_ALIGN	0			/* u-area alignment 0-none */
57184e2458Sderaadt 
58965127f8Sclaudio #define	NMBCLUSTERS	(32 * 1024)		/* max cluster allocation */
59e1e4f5b1Sdrahn 
60e1e4f5b1Sdrahn /* Constants used to divide the USPACE area */
61e1e4f5b1Sdrahn /*
62e1e4f5b1Sdrahn  * The USPACE area contains :
63e1e4f5b1Sdrahn  * 1. the user structure for the process
64e1e4f5b1Sdrahn  * 2. the fp context for FP emulation
65e1e4f5b1Sdrahn  * 3. the kernel (svc) stack
66e1e4f5b1Sdrahn  * 4. the undefined instruction stack
67e1e4f5b1Sdrahn  *
68e1e4f5b1Sdrahn  * The layout of the area looks like this
69e1e4f5b1Sdrahn  *
70e1e4f5b1Sdrahn  * | user area | FP context | undefined stack | kernel stack |
71e1e4f5b1Sdrahn  *
72e1e4f5b1Sdrahn  * The size of the user area is known.
73e1e4f5b1Sdrahn  * The size of the FP context is variable depending of the FP emulator
74e1e4f5b1Sdrahn  * in use and whether there is hardware FP support. However we can put
75e1e4f5b1Sdrahn  * an upper limit on it.
76e1e4f5b1Sdrahn  * The undefined stack needs to be at least 512 bytes. This is a requirement
775ab58429Smiod  * of the FP emulators
785ab58429Smiod  * The kernel stack should be at least 4K in size.
79e1e4f5b1Sdrahn  *
80e1e4f5b1Sdrahn  * The stack top addresses are used to set the stack pointers. The stack bottom
815ab58429Smiod  * addresses are the addresses monitored by the diagnostic code for stack
825ab58429Smiod  * overflows.
83e1e4f5b1Sdrahn  */
84e1e4f5b1Sdrahn 
85e1e4f5b1Sdrahn #define	FPCONTEXTSIZE			(0x100)
86e1e4f5b1Sdrahn #define	USPACE_SVC_STACK_TOP		(USPACE)
87e1e4f5b1Sdrahn #define	USPACE_SVC_STACK_BOTTOM		(USPACE_SVC_STACK_TOP - 0x1000)
88e1e4f5b1Sdrahn #define	USPACE_UNDEF_STACK_TOP		(USPACE_SVC_STACK_BOTTOM - 0x10)
89e1e4f5b1Sdrahn #define	USPACE_UNDEF_STACK_BOTTOM	(sizeof(struct user) + FPCONTEXTSIZE + 10)
90e1e4f5b1Sdrahn 
91e1e4f5b1Sdrahn #ifndef _LOCORE
9238b77b7aSdrahn void	delay (unsigned);
93e1e4f5b1Sdrahn #define	DELAY(x)	delay(x)
94e1e4f5b1Sdrahn #endif
95184e2458Sderaadt 
96184e2458Sderaadt #if !defined(_LOCORE)
97184e2458Sderaadt #include <machine/cpu.h>
98e1e4f5b1Sdrahn #endif
99e1e4f5b1Sdrahn 
100e1e4f5b1Sdrahn /* ARM-specific macro to align a stack pointer (downwards). */
101e1e4f5b1Sdrahn #define	STACKALIGNBYTES		(8 - 1)
102b5fae429Smiod #define	STACKALIGN(p)		((u_long)(p) &~ STACKALIGNBYTES)
103e1e4f5b1Sdrahn 
104184e2458Sderaadt #endif /* _KERNEL */
105e1e4f5b1Sdrahn 
1065e1e381eSdrahn #endif /* _ARM_PARAM_H_ */
107