vmparam.h revision 169291
121118Sache/*- 221118Sache * Copyright (c) 1990 The Regents of the University of California. 350477Speter * All rights reserved. 421118Sache * Copyright (c) 1994 John S. Dyson 577980Sache * All rights reserved. 621118Sache * 721118Sache * This code is derived from software contributed to Berkeley by 821118Sache * William Jolitz. 921118Sache * 1021118Sache * Redistribution and use in source and binary forms, with or without 1121118Sache * modification, are permitted provided that the following conditions 1221118Sache * are met: 1321118Sache * 1. Redistributions of source code must retain the above copyright 1421118Sache * notice, this list of conditions and the following disclaimer. 1521118Sache * 2. Redistributions in binary form must reproduce the above copyright 1621118Sache * notice, this list of conditions and the following disclaimer in the 1721118Sache * documentation and/or other materials provided with the distribution. 1821118Sache * 3. All advertising materials mentioning features or use of this software 1921118Sache * must display the following acknowledgement: 2021118Sache * This product includes software developed by the University of 2121118Sache * California, Berkeley and its contributors. 2221118Sache * 4. Neither the name of the University nor the names of its contributors 2321118Sache * may be used to endorse or promote products derived from this software 2421118Sache * without specific prior written permission. 2521118Sache * 2621118Sache * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2721118Sache * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2821118Sache * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2921118Sache * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3021118Sache * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3121118Sache * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3221118Sache * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3321118Sache * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3421118Sache * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3521118Sache * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3621118Sache * SUCH DAMAGE. 3721118Sache * 3821118Sache * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 39 * from: FreeBSD: src/sys/i386/include/vmparam.h,v 1.33 2000/03/30 40 * $FreeBSD: head/sys/sparc64/include/vmparam.h 169291 2007-05-05 19:50:28Z alc $ 41 */ 42 43 44#ifndef _MACHINE_VMPARAM_H_ 45#define _MACHINE_VMPARAM_H_ 46 47/* 48 * Virtual memory related constants, all in bytes 49 */ 50#ifndef MAXTSIZ 51#define MAXTSIZ (1*1024*1024*1024) /* max text size */ 52#endif 53#ifndef DFLDSIZ 54#define DFLDSIZ (128*1024*1024) /* initial data size limit */ 55#endif 56#ifndef MAXDSIZ 57#define MAXDSIZ (1*1024*1024*1024) /* max data size */ 58#endif 59#ifndef DFLSSIZ 60#define DFLSSIZ (128*1024*1024) /* initial stack size limit */ 61#endif 62#ifndef MAXSSIZ 63#define MAXSSIZ (1*1024*1024*1024) /* max stack size */ 64#endif 65#ifndef SGROWSIZ 66#define SGROWSIZ (128*1024) /* amount to grow stack */ 67#endif 68 69/* 70 * The time for a process to be blocked before being very swappable. 71 * This is a number of seconds which the system takes as being a non-trivial 72 * amount of real time. You probably shouldn't change this; 73 * it is used in subtle ways (fractions and multiples of it are, that is, like 74 * half of a ``long time'', almost a long time, etc.) 75 * It is related to human patience and other factors which don't really 76 * change over time. 77 */ 78#define MAXSLP 20 79 80/* 81 * The physical address space is sparsely populated. 82 */ 83#define VM_PHYSSEG_SPARSE 84 85/* 86 * Address space layout. 87 * 88 * UltraSPARC I and II implement a 44 bit virtual address space. The address 89 * space is split into 2 regions at each end of the 64 bit address space, with 90 * an out of range "hole" in the middle. UltraSPARC III implements the full 91 * 64 bit virtual address space, but we don't really have any use for it and 92 * 43 bits of user address space is considered to be "enough", so we ignore it. 93 * 94 * Upper region: 0xffffffffffffffff 95 * 0xfffff80000000000 96 * 97 * Hole: 0xfffff7ffffffffff 98 * 0x0000080000000000 99 * 100 * Lower region: 0x000007ffffffffff 101 * 0x0000000000000000 102 * 103 * In general we ignore the upper region, and use the lower region as mappable 104 * space. 105 * 106 * We define some interesting address constants: 107 * 108 * VM_MIN_ADDRESS and VM_MAX_ADDRESS define the start and of the entire 64 bit 109 * address space, mostly just for convenience. 110 * 111 * VM_MIN_DIRECT_ADDRESS and VM_MAX_DIRECT_ADDRESS define the start and end 112 * of the direct mapped region. This maps virtual addresses to physical 113 * addresses directly using 4mb tlb entries, with the physical address encoded 114 * in the lower 43 bits of virtual address. These mappings are convenient 115 * because they do not require page tables, and because they never change they 116 * do not require tlb flushes. However, since these mappings are cacheable, 117 * we must ensure that all pages accessed this way are either not double 118 * mapped, or that all other mappings have virtual color equal to physical 119 * color, in order to avoid creating illegal aliases in the data cache. 120 * 121 * VM_MIN_KERNEL_ADDRESS and VM_MAX_KERNEL_ADDRESS define the start and end of 122 * mappable kernel virtual address space. VM_MIN_KERNEL_ADDRESS is basically 123 * arbitrary, a convenient address is chosen which allows both the kernel text 124 * and data and the prom's address space to be mapped with 1 4mb tsb page. 125 * VM_MAX_KERNEL_ADDRESS is variable, computed at startup time based on the 126 * amount of physical memory available. Each 4mb tsb page provides 1g of 127 * virtual address space, with the only practical limit being available 128 * phsyical memory. 129 * 130 * VM_MIN_PROM_ADDRESS and VM_MAX_PROM_ADDRESS define the start and end of the 131 * prom address space. On startup the prom's mappings are duplicated in the 132 * kernel tsb, to allow prom memory to be accessed normally by the kernel. 133 * 134 * VM_MIN_USER_ADDRESS and VM_MAX_USER_ADDRESS define the start and end of the 135 * user address space. There are some hardware errata about using addresses 136 * at the boundary of the va hole, so we allow just under 43 bits of user 137 * address space. Note that the kernel and user address spaces overlap, but 138 * this doesn't matter because they use different tlb contexts, and because 139 * the kernel address space is not mapped into each process' address space. 140 */ 141#define VM_MIN_ADDRESS (0x0000000000000000UL) 142#define VM_MAX_ADDRESS (0xffffffffffffffffUL) 143 144#define VM_MIN_DIRECT_ADDRESS (0xfffff80000000000UL) 145#define VM_MAX_DIRECT_ADDRESS (VM_MAX_ADDRESS) 146 147#define VM_MIN_KERNEL_ADDRESS (0x00000000c0000000UL) 148#define VM_MAX_KERNEL_ADDRESS (vm_max_kernel_address) 149 150#define VM_MIN_PROM_ADDRESS (0x00000000f0000000UL) 151#define VM_MAX_PROM_ADDRESS (0x00000000ffffe000UL) 152 153#define VM_MIN_USER_ADDRESS (0x0000000000000000UL) 154#define VM_MAX_USER_ADDRESS (0x000007fe00000000UL) 155 156#define VM_MINUSER_ADDRESS (VM_MIN_USER_ADDRESS) 157#define VM_MAXUSER_ADDRESS (VM_MAX_USER_ADDRESS) 158 159#define KERNBASE (VM_MIN_KERNEL_ADDRESS) 160#define USRSTACK (VM_MAX_USER_ADDRESS) 161 162/* 163 * Virtual size (bytes) for various kernel submaps. 164 */ 165#ifndef VM_KMEM_SIZE 166#define VM_KMEM_SIZE (16*1024*1024) 167#endif 168 169/* 170 * How many physical pages per KVA page allocated. 171 * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), 172 * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX) 173 * is the total KVA space allocated for kmem_map. 174 */ 175#ifndef VM_KMEM_SIZE_SCALE 176#define VM_KMEM_SIZE_SCALE (3) 177#endif 178 179/* 180 * Initial pagein size of beginning of executable file. 181 */ 182#ifndef VM_INITIAL_PAGEIN 183#define VM_INITIAL_PAGEIN 16 184#endif 185 186#define UMA_MD_SMALL_ALLOC 187 188extern vm_offset_t vm_max_kernel_address; 189 190#endif /* !_MACHINE_VMPARAM_H_ */ 191