1 1.34 rin /* $NetBSD: param.h,v 1.34 2021/05/30 07:20:00 rin Exp $ */ 2 1.1 reinoud 3 1.1 reinoud /* 4 1.1 reinoud * Copyright (c) 1994,1995 Mark Brinicombe. 5 1.1 reinoud * All rights reserved. 6 1.1 reinoud * 7 1.1 reinoud * Redistribution and use in source and binary forms, with or without 8 1.1 reinoud * modification, are permitted provided that the following conditions 9 1.1 reinoud * are met: 10 1.1 reinoud * 1. Redistributions of source code must retain the above copyright 11 1.1 reinoud * notice, this list of conditions and the following disclaimer. 12 1.1 reinoud * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 reinoud * notice, this list of conditions and the following disclaimer in the 14 1.1 reinoud * documentation and/or other materials provided with the distribution. 15 1.1 reinoud * 3. All advertising materials mentioning features or use of this software 16 1.1 reinoud * must display the following acknowledgement: 17 1.1 reinoud * This product includes software developed by the RiscBSD team. 18 1.1 reinoud * 4. The name "RiscBSD" nor the name of the author may be used to 19 1.1 reinoud * endorse or promote products derived from this software without specific 20 1.1 reinoud * prior written permission. 21 1.1 reinoud * 22 1.1 reinoud * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 1.1 reinoud * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 1.1 reinoud * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 1.1 reinoud * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 1.1 reinoud * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 1.1 reinoud * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 1.1 reinoud * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 1.1 reinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 1.1 reinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 1.1 reinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 1.1 reinoud * SUCH DAMAGE. 33 1.1 reinoud */ 34 1.1 reinoud 35 1.3 matt #ifndef _ARM_ARM32_PARAM_H_ 36 1.3 matt #define _ARM_ARM32_PARAM_H_ 37 1.1 reinoud 38 1.21 matt #ifdef _KERNEL_OPT 39 1.31 skrll #include "opt_arm32_pmap.h" 40 1.33 skrll #include "opt_kasan.h" 41 1.34 rin #include "opt_param.h" 42 1.1 reinoud #endif 43 1.1 reinoud 44 1.1 reinoud /* 45 1.1 reinoud * Machine dependent constants for ARM6+ processors 46 1.1 reinoud */ 47 1.3 matt /* These are defined in the Port File before it includes 48 1.3 matt * this file. */ 49 1.1 reinoud 50 1.21 matt #ifndef PGSHIFT 51 1.1 reinoud #define PGSHIFT 12 /* LOG2(NBPG) */ 52 1.21 matt #endif 53 1.1 reinoud #define NBPG (1 << PGSHIFT) /* bytes/page */ 54 1.27 skrll #define PGOFSET (NBPG - 1) /* byte offset into page */ 55 1.27 skrll #define NPTEPG (NBPG / sizeof(pt_entry_t)) /* PTEs per Page */ 56 1.1 reinoud 57 1.21 matt #define SSIZE 1 /* initial stack size/NBPG */ 58 1.21 matt #define SINCR 1 /* increment of stack/NBPG */ 59 1.33 skrll #ifdef KASAN 60 1.33 skrll #define UPAGES 4 61 1.33 skrll #else 62 1.32 skrll #define UPAGES 2 63 1.33 skrll #endif 64 1.32 skrll #define USPACE (UPAGES * NBPG) /* total size of u-area */ 65 1.1 reinoud 66 1.1 reinoud #ifndef MSGBUFSIZE 67 1.19 skrll #define MSGBUFSIZE 16384 /* default message buffer size */ 68 1.1 reinoud #endif 69 1.1 reinoud 70 1.1 reinoud /* 71 1.1 reinoud * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 72 1.1 reinoud * logical pages. 73 1.1 reinoud */ 74 1.17 para #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) 75 1.30 skrll 76 1.33 skrll #if defined(_ARM_ARCH_6) && !defined(KASAN) 77 1.30 skrll #define NKMEMPAGES_MAX_DEFAULT ((768 * 1024 * 1024) >> PAGE_SHIFT) 78 1.30 skrll #else 79 1.30 skrll #define NKMEMPAGES_MAX_DEFAULT ((256 * 1024 * 1024) >> PAGE_SHIFT) 80 1.30 skrll #endif 81 1.1 reinoud 82 1.1 reinoud /* Constants used to divide the USPACE area */ 83 1.1 reinoud 84 1.1 reinoud /* 85 1.1 reinoud * The USPACE area contains : 86 1.16 rmind * 1. the pcb structure for the process 87 1.18 matt * 2. the kernel (svc) stack 88 1.1 reinoud * 89 1.1 reinoud * The layout of the area looks like this 90 1.1 reinoud * 91 1.18 matt * | uarea | kernel stack | 92 1.1 reinoud * 93 1.16 rmind * The size of the uarea is known. 94 1.1 reinoud * The kernel stack should be at least 4K is size. 95 1.1 reinoud * 96 1.1 reinoud * The stack top addresses are used to set the stack pointers. The stack bottom 97 1.1 reinoud * addresses at the addresses monitored by the diagnostic code for stack overflows 98 1.1 reinoud * 99 1.1 reinoud */ 100 1.1 reinoud 101 1.1 reinoud #define USPACE_SVC_STACK_TOP (USPACE) 102 1.18 matt #define USPACE_SVC_STACK_BOTTOM (sizeof(struct pcb)) 103 1.1 reinoud 104 1.20 rkujawa #define arm_btop(x) ((unsigned)(x) >> PGSHIFT) 105 1.20 rkujawa #define arm_ptob(x) ((unsigned)(x) << PGSHIFT) 106 1.26 skrll 107 1.1 reinoud #ifdef _KERNEL 108 1.1 reinoud #ifndef _LOCORE 109 1.25 chs #ifndef __HIDE_DELAY 110 1.14 dsl void delay(unsigned); 111 1.1 reinoud #define DELAY(x) delay(x) 112 1.1 reinoud #endif 113 1.1 reinoud #endif 114 1.25 chs #endif 115 1.5 bjh21 116 1.5 bjh21 #include <arm/param.h> 117 1.1 reinoud 118 1.3 matt #endif /* _ARM_ARM32_PARAM_H_ */ 119