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