1 /* $OpenBSD: param.h,v 1.21 2013/06/13 05:13:12 deraadt Exp $ */ 2 3 /* 4 * Copyright (c) 1994,1995 Mark Brinicombe. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by the RiscBSD team. 18 * 4. The name "RiscBSD" nor the name of the author may be used to 19 * endorse or promote products derived from this software without specific 20 * prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35 #ifndef _ARM_PARAM_H_ 36 #define _ARM_PARAM_H_ 37 38 #define MACHINE_ARCH "arm" 39 #define _MACHINE_ARCH arm 40 #define MID_MACHINE MID_ARM6 41 42 #define PAGE_SHIFT 12 43 #define PAGE_SIZE (1 << PAGE_SHIFT) 44 #define PAGE_MASK (PAGE_SIZE - 1) 45 46 #ifdef _KERNEL 47 48 #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 49 50 #define NBPG PAGE_SIZE 51 #define PGSHIFT PAGE_SHIFT 52 #define PGOFSET PAGE_MASK 53 54 #define UPAGES 2 /* pages of u-area */ 55 #define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */ 56 #define USPACE_ALIGN 0 /* u-area alignment 0-none */ 57 58 #define NMBCLUSTERS 4096 /* map size, max cluster allocation */ 59 60 #ifndef MSGBUFSIZE 61 #define MSGBUFSIZE (1 * PAGE_SIZE) /* default message buffer size */ 62 #endif 63 64 /* 65 * Maximum size of the kernel malloc arena in PAGE_SIZE-sized 66 * logical pages. 67 */ 68 #define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) 69 70 /* Constants used to divide the USPACE area */ 71 /* 72 * The USPACE area contains : 73 * 1. the user structure for the process 74 * 2. the fp context for FP emulation 75 * 3. the kernel (svc) stack 76 * 4. the undefined instruction stack 77 * 78 * The layout of the area looks like this 79 * 80 * | user area | FP context | undefined stack | kernel stack | 81 * 82 * The size of the user area is known. 83 * The size of the FP context is variable depending of the FP emulator 84 * in use and whether there is hardware FP support. However we can put 85 * an upper limit on it. 86 * The undefined stack needs to be at least 512 bytes. This is a requirement 87 * of the FP emulators 88 * The kernel stack should be at least 4K in size. 89 * 90 * The stack top addresses are used to set the stack pointers. The stack bottom 91 * addresses are the addresses monitored by the diagnostic code for stack 92 * overflows. 93 */ 94 95 #define FPCONTEXTSIZE (0x100) 96 #define USPACE_SVC_STACK_TOP (USPACE) 97 #define USPACE_SVC_STACK_BOTTOM (USPACE_SVC_STACK_TOP - 0x1000) 98 #define USPACE_UNDEF_STACK_TOP (USPACE_SVC_STACK_BOTTOM - 0x10) 99 #define USPACE_UNDEF_STACK_BOTTOM (sizeof(struct user) + FPCONTEXTSIZE + 10) 100 101 #ifndef _LOCORE 102 void delay (unsigned); 103 #define DELAY(x) delay(x) 104 #endif 105 106 #if !defined(_LOCORE) 107 #include <machine/cpu.h> 108 #endif 109 110 /* ARM-specific macro to align a stack pointer (downwards). */ 111 #define STACKALIGNBYTES (8 - 1) 112 #define STACKALIGN(p) ((u_long)(p) &~ STACKALIGNBYTES) 113 114 #endif /* _KERNEL */ 115 116 #endif /* _ARM_PARAM_H_ */ 117