1 /* $OpenBSD: vmparam.h,v 1.19 2010/04/22 19:02:49 oga Exp $ */ 2 /* $NetBSD: vmparam.h,v 1.18 2001/05/01 02:19:19 thorpej Exp $ */ 3 4 /* 5 * Copyright (c) 1992, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This software was developed by the Computer Systems Engineering group 9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10 * contributed to Berkeley. 11 * 12 * All advertising materials mentioning features or use of this software 13 * must display the following acknowledgement: 14 * This product includes software developed by the University of 15 * California, Lawrence Berkeley Laboratory. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions 19 * are met: 20 * 1. Redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer. 22 * 2. Redistributions in binary form must reproduce the above copyright 23 * notice, this list of conditions and the following disclaimer in the 24 * documentation and/or other materials provided with the distribution. 25 * 3. Neither the name of the University nor the names of its contributors 26 * may be used to endorse or promote products derived from this software 27 * without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * @(#)vmparam.h 8.1 (Berkeley) 6/11/93 42 */ 43 44 /* 45 * Machine dependent constants for sun4u and sun4v UltraSPARC 46 */ 47 48 #ifndef VMPARAM_H 49 #define VMPARAM_H 50 51 /* 52 * USRTEXT is the start of the user text/data space, while USRSTACK 53 * is the top (end) of the user stack. 54 */ 55 #define USRTEXT 0x2000 /* Start of user text */ 56 #define USRSTACK 0xffffffffffffe000L 57 58 /* 59 * Virtual memory related constants, all in bytes 60 */ 61 /* #ifdef __arch64__ */ 62 #if 0 63 /* 64 * 64-bit limits: 65 * 66 * Since the compiler generates `call' instructions we can't 67 * have more than 4GB in a single text segment. 68 * 69 * And since we only have a 40-bit address space, allow half 70 * of that for data and the other half for stack. 71 */ 72 #ifndef MAXTSIZ 73 #define MAXTSIZ (4L*1024*1024*1024) /* max text size */ 74 #endif 75 #ifndef DFLDSIZ 76 #define DFLDSIZ (128L*1024*1024) /* initial data size limit */ 77 #endif 78 #ifndef MAXDSIZ 79 #define MAXDSIZ (512L*1024*1024*1024) /* max data size */ 80 #endif 81 #ifndef DFLSSIZ 82 #define DFLSSIZ (1024*1024) /* initial stack size limit */ 83 #endif 84 #ifndef MAXSSIZ 85 #define MAXSSIZ MAXDSIZ /* max stack size */ 86 #endif 87 #else 88 /* 89 * 32-bit limits: 90 * 91 * We only have 4GB to play with. Limit stack, data, and text 92 * each to half of that. 93 * 94 * This is silly. Apparently if we go above these numbers 95 * integer overflows in other parts of the kernel cause hangs. 96 */ 97 #ifndef MAXTSIZ 98 #define MAXTSIZ (1*1024*1024*1024) /* max text size */ 99 #endif 100 #ifndef DFLDSIZ 101 #define DFLDSIZ (128*1024*1024) /* initial data size limit */ 102 #endif 103 #ifndef MAXDSIZ 104 #define MAXDSIZ (1*1024*1024*1024) /* max data size */ 105 #endif 106 #ifndef DFLSSIZ 107 #define DFLSSIZ (1024*1024) /* initial stack size limit */ 108 #endif 109 #ifndef MAXSSIZ 110 #define MAXSSIZ (8*1024*1024) /* max stack size */ 111 #endif 112 #endif 113 114 #define STACKGAP_RANDOM 256*1024 115 116 /* 117 * Size of shared memory map 118 */ 119 #ifndef SHMMAXPGS 120 #define SHMMAXPGS 4096 /* 32mb */ 121 #endif 122 123 /* 124 * Mach derived constants 125 */ 126 127 /* 128 * User/kernel map constants. 129 */ 130 #define VM_MIN_ADDRESS ((vaddr_t)0) 131 #define VM_MAX_ADDRESS ((vaddr_t)-1) 132 #define VM_MAXUSER_ADDRESS ((vaddr_t)-1) 133 134 /* map PIE into the first quarter of the address space before hole */ 135 #define VM_PIE_MIN_ADDR PAGE_SIZE 136 #define VM_PIE_MAX_ADDR 0x10000000000 137 138 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)KERNBASE) 139 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0x000007ffffffffffL) 140 141 #define VM_PHYSSEG_MAX 32 /* up to 32 segments */ 142 #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH 143 #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ 144 145 #define VM_NFREELIST 1 146 #define VM_FREELIST_DEFAULT 0 147 148 /* No UVM_IO_RANGES required: IOMMU takes care of this. */ 149 #define UVM_IO_RANGES {} 150 151 #define __HAVE_VM_PAGE_MD 152 /* 153 * For each struct vm_page, there is a list of all currently valid virtual 154 * mappings of that page. An entry is a pv_entry_t, the list is pv_table. 155 * 156 * XXX - this doesn't belong here, but for now we have to keep it here 157 * because of include ordering issues. 158 */ 159 typedef struct pv_entry { 160 struct pv_entry *pv_next; /* next pv_entry */ 161 struct pmap *pv_pmap; /* pmap where mapping lies */ 162 vaddr_t pv_va; /* virtual address for mapping */ 163 } *pv_entry_t; 164 /* PV flags encoded in the low bits of the VA of the first pv_entry */ 165 166 struct vm_page_md { 167 struct pv_entry pvent; 168 }; 169 170 #define VM_MDPAGE_INIT(pg) do { \ 171 (pg)->mdpage.pvent.pv_next = NULL; \ 172 (pg)->mdpage.pvent.pv_pmap = NULL; \ 173 (pg)->mdpage.pvent.pv_va = 0; \ 174 } while (0) 175 176 #if defined (_KERNEL) && !defined(_LOCORE) 177 struct vm_map; 178 vaddr_t dvma_mapin(struct vm_map *, vaddr_t, int, int); 179 void dvma_mapout(vaddr_t, vaddr_t, int); 180 #endif 181 #endif 182