1 /* $NetBSD: vmparam.h,v 1.47 2011/02/08 20:20:19 rmind 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 /* 45 * Machine dependent VM constants for MIPS. 46 */ 47 48 /* 49 * We normally use a 4K page but may use 16K on MIPS systems. 50 * Override PAGE_* definitions to compile-time constants. 51 */ 52 #ifdef ENABLE_MIPS_16KB_PAGE 53 #define PAGE_SHIFT 14 54 #elif defined(ENABLE_MIPS_4KB_PAGE) || 1 55 #define PAGE_SHIFT 12 56 #else 57 #error ENABLE_MIPS_xKB_PAGE not defined 58 #endif 59 #define PAGE_SIZE (1 << PAGE_SHIFT) 60 #define PAGE_MASK (PAGE_SIZE - 1) 61 62 /* 63 * USRSTACK is the top (end) of the user stack. 64 * 65 * USRSTACK needs to start a little below 0x8000000 because the R8000 66 * and some QED CPUs perform some virtual address checks before the 67 * offset is calculated. 68 */ 69 #define USRSTACK (VM_MAXUSER_ADDRESS-PAGE_SIZE) /* Start of user stack */ 70 #define USRSTACK32 ((uint32_t)VM_MAXUSER32_ADDRESS-PAGE_SIZE) 71 72 /* alignment requirement for u-area space in bytes */ 73 #define USPACE_ALIGN USPACE 74 75 /* 76 * Virtual memory related constants, all in bytes 77 */ 78 #ifndef MAXTSIZ 79 #define MAXTSIZ (64*1024*1024) /* max text size */ 80 #endif 81 #ifndef DFLDSIZ 82 #define DFLDSIZ (128*1024*1024) /* initial data size limit */ 83 #endif 84 #ifndef MAXDSIZ 85 #define MAXDSIZ (512*1024*1024) /* max data size */ 86 #endif 87 #ifndef DFLSSIZ 88 #define DFLSSIZ (4*1024*1024) /* initial stack size limit */ 89 #endif 90 #ifndef MAXSSIZ 91 #define MAXSSIZ (32*1024*1024) /* max stack size */ 92 #endif 93 94 /* 95 * Virtual memory related constants, all in bytes 96 */ 97 #ifndef MAXTSIZ32 98 #define MAXTSIZ32 MAXTSIZ /* max text size */ 99 #endif 100 #ifndef DFLDSIZ32 101 #define DFLDSIZ32 DFLDSIZ /* initial data size limit */ 102 #endif 103 #ifndef MAXDSIZ32 104 #define MAXDSIZ32 MAXDSIZ /* max data size */ 105 #endif 106 #ifndef DFLSSIZ32 107 #define DFLSSIZ32 DFLTSIZ /* initial stack size limit */ 108 #endif 109 #ifndef MAXSSIZ32 110 #define MAXSSIZ32 MAXSSIZ /* max stack size */ 111 #endif 112 113 /* 114 * PTEs for mapping user space into the kernel for phyio operations. 115 * The default PTE number is enough to cover 8 disks * MAXBSIZE. 116 */ 117 #ifndef USRIOSIZE 118 #define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8) 119 #endif 120 121 /* 122 * Mach derived constants 123 */ 124 125 /* 126 * user/kernel map constants 127 * These are negative addresses since MIPS addresses are signed. 128 */ 129 #define VM_MIN_ADDRESS ((vaddr_t)0x00000000) 130 #ifdef _LP64 131 #if 1 132 #define VM_MAXUSER_ADDRESS ((vaddr_t) 1L << 31) /* 0x0000000080000000 */ 133 #else 134 #define VM_MAXUSER_ADDRESS ((vaddr_t) 1L << 62) /* 0x4000000000000000 */ 135 #endif 136 #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS 137 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) 3L << 62) /* 0xC000000000000000 */ 138 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) -1L << 31) /* 0xFFFFFFFF80000000 */ 139 #else 140 #define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */ 141 #define VM_MAX_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */ 142 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xFFFFFFFFC0000000 */ 143 #ifdef ENABLE_MIPS_TX3900 144 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x01000000) /* 0xFFFFFFFFFF000000 */ 145 #else 146 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x00004000) /* 0xFFFFFFFFFFFFC000 */ 147 #endif 148 #endif 149 #define VM_MAXUSER32_ADDRESS ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */ 150 151 /* 152 * The address to which unspecified mapping requests default 153 */ 154 #define __USE_TOPDOWN_VM 155 #define VM_DEFAULT_ADDRESS(da, sz) \ 156 trunc_page(USRSTACK - MAXSSIZ - (sz)) 157 #define VM_DEFAULT_ADDRESS32(da, sz) \ 158 trunc_page(USRSTACK32 - MAXSSIZ32 - (sz)) 159 160 /* virtual sizes (bytes) for various kernel submaps */ 161 #define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) 162 163 /* VM_PHYSSEG_MAX defined by platform-dependent code. */ 164 #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH 165 166 #ifndef VM_NFREELIST 167 #define VM_NFREELIST 16 /* 16 distinct memory segments */ 168 #define VM_FREELIST_DEFAULT 0 169 #define VM_FREELIST_FIRST16M 1 /* ISA DMA range */ 170 #define VM_FREELIST_FIRST512M 2 /* KSEG0/1 */ 171 #define VM_FREELIST_FIRST4G 3 /* 32bit addrs */ 172 #define VM_FREELIST_MAX 4 173 #endif 174 175 #endif /* ! _MIPS_VMPARAM_H_ */ 176