1 /* $NetBSD: vmparam.h,v 1.48 2011/02/20 07:45:47 matt Exp $ */ 2 3 /* 4 * Copyright (c) 1988 University of Utah. 5 * Copyright (c) 1992, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * the Systems Programming Group of the University of Utah Computer 10 * Science Department and Ralph Campbell. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. Neither the name of the University nor the names of its contributors 21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: Utah Hdr: vmparam.h 1.16 91/01/18 37 * 38 * @(#)vmparam.h 8.2 (Berkeley) 4/22/94 39 */ 40 41 #ifndef _MIPS_VMPARAM_H_ 42 #define _MIPS_VMPARAM_H_ 43 44 #ifdef _KERNEL_OPT 45 #include "opt_multiprocessor.h" 46 #endif 47 48 /* 49 * Machine dependent VM constants for MIPS. 50 */ 51 52 /* 53 * We normally use a 4K page but may use 16K on MIPS systems. 54 * Override PAGE_* definitions to compile-time constants. 55 */ 56 #ifdef ENABLE_MIPS_16KB_PAGE 57 #define PAGE_SHIFT 14 58 #elif defined(ENABLE_MIPS_4KB_PAGE) || 1 59 #define PAGE_SHIFT 12 60 #else 61 #error ENABLE_MIPS_xKB_PAGE not defined 62 #endif 63 #define PAGE_SIZE (1 << PAGE_SHIFT) 64 #define PAGE_MASK (PAGE_SIZE - 1) 65 66 /* 67 * USRSTACK is the top (end) of the user stack. 68 * 69 * USRSTACK needs to start a little below 0x8000000 because the R8000 70 * and some QED CPUs perform some virtual address checks before the 71 * offset is calculated. We use 0x8000 since that's the max displacement 72 * in an instruction. 73 */ 74 #define USRSTACK (VM_MAXUSER_ADDRESS-0x8000) /* Start of user stack */ 75 #define USRSTACK32 ((uint32_t)VM_MAXUSER32_ADDRESS-0x8000) 76 77 /* alignment requirement for u-area space in bytes */ 78 #define USPACE_ALIGN USPACE 79 80 /* 81 * Virtual memory related constants, all in bytes 82 */ 83 #if defined(__mips_o32) 84 #ifndef MAXTSIZ 85 #define MAXTSIZ (64*1024*1024) /* max text size */ 86 #endif 87 #ifndef DFLDSIZ 88 #define DFLDSIZ (128*1024*1024) /* initial data size limit */ 89 #endif 90 #ifndef MAXDSIZ 91 #define MAXDSIZ (512*1024*1024) /* max data size */ 92 #endif 93 #ifndef DFLSSIZ 94 #define DFLSSIZ (4*1024*1024) /* initial stack size limit */ 95 #endif 96 #ifndef MAXSSIZ 97 #define MAXSSIZ (32*1024*1024) /* max stack size */ 98 #endif 99 #else 100 /* 101 * 64-bit ABIs need more space. 102 */ 103 #ifndef MAXTSIZ 104 #define MAXTSIZ (128*1024*1024) /* max text size */ 105 #endif 106 #ifndef DFLDSIZ 107 #define DFLDSIZ (256*1024*1024) /* initial data size limit */ 108 #endif 109 #ifndef MAXDSIZ 110 #define MAXDSIZ (1536*1024*1024) /* max data size */ 111 #endif 112 #ifndef DFLSSIZ 113 #define DFLSSIZ (16*1024*1024) /* initial stack size limit */ 114 #endif 115 #ifndef MAXSSIZ 116 #define MAXSSIZ (120*1024*1024) /* max stack size */ 117 #endif 118 #endif /* !__mips_o32 */ 119 120 /* 121 * Virtual memory related constants, all in bytes 122 */ 123 #ifndef MAXTSIZ32 124 #define MAXTSIZ32 MAXTSIZ /* max text size */ 125 #endif 126 #ifndef DFLDSIZ32 127 #define DFLDSIZ32 DFLDSIZ /* initial data size limit */ 128 #endif 129 #ifndef MAXDSIZ32 130 #define MAXDSIZ32 MAXDSIZ /* max data size */ 131 #endif 132 #ifndef DFLSSIZ32 133 #define DFLSSIZ32 DFLTSIZ /* initial stack size limit */ 134 #endif 135 #ifndef MAXSSIZ32 136 #define MAXSSIZ32 MAXSSIZ /* max stack size */ 137 #endif 138 139 /* 140 * PTEs for mapping user space into the kernel for phyio operations. 141 * The default PTE number is enough to cover 8 disks * MAXBSIZE. 142 */ 143 #ifndef USRIOSIZE 144 #define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8) 145 #endif 146 147 /* 148 * Mach derived constants 149 */ 150 151 /* 152 * user/kernel map constants 153 * These are negative addresses since MIPS addresses are signed. 154 */ 155 #define VM_MIN_ADDRESS ((vaddr_t)0x00000000) 156 #ifdef _LP64 157 #define VM_MAXUSER_ADDRESS ((vaddr_t) 1L << (4*PGSHIFT-8)) 158 /* 0x0000010000000000 */ 159 #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS 160 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) 3L << 62) /* 0xC000000000000000 */ 161 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) -1L << 31) /* 0xFFFFFFFF80000000 */ 162 #else 163 #define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */ 164 #define VM_MAX_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */ 165 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xFFFFFFFFC0000000 */ 166 #ifdef ENABLE_MIPS_TX3900 167 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x01000000) /* 0xFFFFFFFFFF000000 */ 168 #else 169 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x00004000) /* 0xFFFFFFFFFFFFC000 */ 170 #endif 171 #endif 172 #define VM_MAXUSER32_ADDRESS ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */ 173 174 /* 175 * The address to which unspecified mapping requests default 176 */ 177 #define __USE_TOPDOWN_VM 178 #define VM_DEFAULT_ADDRESS(da, sz) \ 179 trunc_page(USRSTACK - MAXSSIZ - (sz)) 180 #define VM_DEFAULT_ADDRESS32(da, sz) \ 181 trunc_page(USRSTACK32 - MAXSSIZ32 - (sz)) 182 183 /* virtual sizes (bytes) for various kernel submaps */ 184 #define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) 185 186 /* VM_PHYSSEG_MAX defined by platform-dependent code. */ 187 #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH 188 #define VM_PHYSSEG_NOADD /* can add RAM after vm_mem_init */ 189 190 #ifndef VM_NFREELIST 191 #define VM_NFREELIST 16 /* 16 distinct memory segments */ 192 #define VM_FREELIST_DEFAULT 0 193 #define VM_FREELIST_MAX 1 194 #endif 195 196 #ifdef _KERNEL 197 #define UVM_KM_VMFREELIST mips_poolpage_vmfreelist 198 extern int mips_poolpage_vmfreelist; 199 #endif 200 201 #endif /* ! _MIPS_VMPARAM_H_ */ 202