vmparam.h revision 282065
1287621Smav/*- 2287621Smav * Copyright (c) 1990 The Regents of the University of California. 3287621Smav * All rights reserved. 4287621Smav * Copyright (c) 1994 John S. Dyson 5287621Smav * All rights reserved. 6287621Smav * 7287621Smav * This code is derived from software contributed to Berkeley by 8287621Smav * William Jolitz. 9287621Smav * 10287621Smav * Redistribution and use in source and binary forms, with or without 11287621Smav * modification, are permitted provided that the following conditions 12287621Smav * are met: 13287621Smav * 1. Redistributions of source code must retain the above copyright 14287621Smav * notice, this list of conditions and the following disclaimer. 15287621Smav * 2. Redistributions in binary form must reproduce the above copyright 16287621Smav * notice, this list of conditions and the following disclaimer in the 17287621Smav * documentation and/or other materials provided with the distribution. 18287621Smav * 4. Neither the name of the University nor the names of its contributors 19287621Smav * may be used to endorse or promote products derived from this software 20287621Smav * without specific prior written permission. 21287621Smav * 22287621Smav * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23287621Smav * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24287621Smav * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25287621Smav * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26287621Smav * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27287621Smav * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28287621Smav * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29287621Smav * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30287621Smav * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31287621Smav * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32287621Smav * SUCH DAMAGE. 33287621Smav * 34287621Smav * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 35287621Smav * $FreeBSD: stable/10/sys/i386/include/vmparam.h 282065 2015-04-27 08:02:12Z kib $ 36287621Smav */ 37287621Smav 38287621Smav 39287621Smav#ifndef _MACHINE_VMPARAM_H_ 40287621Smav#define _MACHINE_VMPARAM_H_ 1 41287621Smav 42287621Smav/* 43287621Smav * Machine dependent constants for 386. 44287621Smav */ 45287621Smav 46287621Smav/* 47287621Smav * Virtual memory related constants, all in bytes 48287621Smav */ 49287621Smav#define MAXTSIZ (128UL*1024*1024) /* max text size */ 50287621Smav#ifndef DFLDSIZ 51287621Smav#define DFLDSIZ (128UL*1024*1024) /* initial data size limit */ 52287621Smav#endif 53287621Smav#ifndef MAXDSIZ 54287621Smav#define MAXDSIZ (512UL*1024*1024) /* max data size */ 55287621Smav#endif 56287621Smav#ifndef DFLSSIZ 57287621Smav#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ 58287621Smav#endif 59287621Smav#ifndef MAXSSIZ 60287621Smav#define MAXSSIZ (64UL*1024*1024) /* max stack size */ 61287621Smav#endif 62287621Smav#ifndef SGROWSIZ 63287621Smav#define SGROWSIZ (128UL*1024) /* amount to grow stack */ 64287621Smav#endif 65287621Smav 66287621Smav/* 67287621Smav * Choose between DENSE and SPARSE based on whether lower execution time or 68287621Smav * lower kernel address space consumption is desired. Under PAE, kernel 69287621Smav * address space is often in short supply. 70287621Smav */ 71287621Smav#ifdef PAE 72287621Smav#define VM_PHYSSEG_SPARSE 73287621Smav#else 74287621Smav#define VM_PHYSSEG_DENSE 75287621Smav#endif 76287621Smav 77287621Smav/* 78287621Smav * The number of PHYSSEG entries must be one greater than the number 79287621Smav * of phys_avail entries because the phys_avail entry that spans the 80287621Smav * largest physical address that is accessible by ISA DMA is split 81287621Smav * into two PHYSSEG entries. 82287621Smav */ 83287621Smav#define VM_PHYSSEG_MAX 17 84287621Smav 85287621Smav/* 86287621Smav * Create two free page pools. Since the i386 kernel virtual address 87287621Smav * space does not include a mapping onto the machine's entire physical 88287621Smav * memory, VM_FREEPOOL_DIRECT is defined as an alias for the default 89287621Smav * pool, VM_FREEPOOL_DEFAULT. 90287621Smav */ 91287621Smav#define VM_NFREEPOOL 2 92287621Smav#define VM_FREEPOOL_CACHE 1 93287621Smav#define VM_FREEPOOL_DEFAULT 0 94287621Smav#define VM_FREEPOOL_DIRECT 0 95287621Smav 96287621Smav/* 97287621Smav * Create two free page lists: VM_FREELIST_DEFAULT is for physical 98287621Smav * pages that are above the largest physical address that is 99287621Smav * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages 100287621Smav * that are below that address. 101287621Smav */ 102287621Smav#define VM_NFREELIST 2 103287621Smav#define VM_FREELIST_DEFAULT 0 104287621Smav#define VM_FREELIST_ISADMA 1 105287621Smav 106287621Smav/* 107287621Smav * The largest allocation size is 2MB under PAE and 4MB otherwise. 108287621Smav */ 109287621Smav#ifdef PAE 110287621Smav#define VM_NFREEORDER 10 111287621Smav#else 112287621Smav#define VM_NFREEORDER 11 113287621Smav#endif 114287621Smav 115287621Smav/* 116287621Smav * Enable superpage reservations: 1 level. 117287621Smav */ 118287621Smav#ifndef VM_NRESERVLEVEL 119287621Smav#define VM_NRESERVLEVEL 1 120287621Smav#endif 121287621Smav 122287621Smav/* 123287621Smav * Level 0 reservations consist of 512 pages when PAE pagetables are 124287621Smav * used, and 1024 pages otherwise. 125287621Smav */ 126287621Smav#ifndef VM_LEVEL_0_ORDER 127287621Smav#if defined(PAE) || defined(PAE_TABLES) 128287621Smav#define VM_LEVEL_0_ORDER 9 129287621Smav#else 130287621Smav#define VM_LEVEL_0_ORDER 10 131287621Smav#endif 132287621Smav#endif 133287621Smav 134287621Smav/* 135287621Smav * Kernel physical load address. 136287621Smav */ 137287621Smav#ifndef KERNLOAD 138287621Smav#if defined(XEN) && !defined(XEN_PRIVILEGED_GUEST) 139287621Smav#define KERNLOAD 0 140287621Smav#else 141287621Smav#define KERNLOAD (1 << PDRSHIFT) 142287621Smav#endif 143287621Smav#endif /* !defined(KERNLOAD) */ 144287621Smav 145287621Smav/* 146287621Smav * Virtual addresses of things. Derived from the page directory and 147287621Smav * page table indexes from pmap.h for precision. 148287621Smav * Because of the page that is both a PD and PT, it looks a little 149287621Smav * messy at times, but hey, we'll do anything to save a page :-) 150287621Smav */ 151287621Smav 152287621Smav#ifdef XEN 153287621Smav#define VM_MAX_KERNEL_ADDRESS HYPERVISOR_VIRT_START 154287621Smav#else 155287621Smav#define VM_MAX_KERNEL_ADDRESS VADDR(KPTDI+NKPDE-1, NPTEPG-1) 156287621Smav#endif 157287621Smav 158287957Smav#define VM_MIN_KERNEL_ADDRESS VADDR(PTDPTDI, PTDPTDI) 159287957Smav 160287621Smav#define KERNBASE VADDR(KPTDI, 0) 161287621Smav 162287621Smav#define UPT_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) 163287621Smav#define UPT_MIN_ADDRESS VADDR(PTDPTDI, 0) 164287621Smav 165287621Smav#define VM_MAXUSER_ADDRESS VADDR(PTDPTDI, 0) 166287621Smav 167287621Smav#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) 168287621Smav#define USRSTACK SHAREDPAGE 169287621Smav 170287621Smav#define VM_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) 171287621Smav#define VM_MIN_ADDRESS ((vm_offset_t)0) 172287621Smav 173287621Smav/* 174287621Smav * How many physical pages per kmem arena virtual page. 175287621Smav */ 176287621Smav#ifndef VM_KMEM_SIZE_SCALE 177287621Smav#define VM_KMEM_SIZE_SCALE (3) 178287621Smav#endif 179287621Smav 180287621Smav/* 181287621Smav * Optional floor (in bytes) on the size of the kmem arena. 182287621Smav */ 183287621Smav#ifndef VM_KMEM_SIZE_MIN 184287621Smav#define VM_KMEM_SIZE_MIN (12 * 1024 * 1024) 185287621Smav#endif 186287621Smav 187287621Smav/* 188287621Smav * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the 189287621Smav * kernel map rounded to the nearest multiple of the superpage size. 190287621Smav */ 191287621Smav#ifndef VM_KMEM_SIZE_MAX 192287621Smav#define VM_KMEM_SIZE_MAX (((((VM_MAX_KERNEL_ADDRESS - \ 193287621Smav VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT) 194287621Smav#endif 195287621Smav 196287621Smav/* initial pagein size of beginning of executable file */ 197287621Smav#ifndef VM_INITIAL_PAGEIN 198287621Smav#define VM_INITIAL_PAGEIN 16 199287621Smav#endif 200287621Smav 201287621Smav#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ 202287621Smav 203287621Smav#ifndef VM_MAX_AUTOTUNE_MAXUSERS 204287621Smav#define VM_MAX_AUTOTUNE_MAXUSERS 384 205287621Smav#endif 206287621Smav 207287621Smav#endif /* _MACHINE_VMPARAM_H_ */ 208287621Smav