xref: /freebsd/sys/i386/include/vmparam.h (revision 9a8196ce190e6a13ae50849b3384496e7aa57b0c)
15b81b6b3SRodney W. Grimes /*-
251369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
351369649SPedro F. Giffuni  *
45b81b6b3SRodney W. Grimes  * Copyright (c) 1990 The Regents of the University of California.
55b81b6b3SRodney W. Grimes  * All rights reserved.
67f8cb368SDavid Greenman  * Copyright (c) 1994 John S. Dyson
77f8cb368SDavid Greenman  * All rights reserved.
85b81b6b3SRodney W. Grimes  *
95b81b6b3SRodney W. Grimes  * This code is derived from software contributed to Berkeley by
105b81b6b3SRodney W. Grimes  * William Jolitz.
115b81b6b3SRodney W. Grimes  *
125b81b6b3SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
135b81b6b3SRodney W. Grimes  * modification, are permitted provided that the following conditions
145b81b6b3SRodney W. Grimes  * are met:
155b81b6b3SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
165b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
175b81b6b3SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
185b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
195b81b6b3SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
20fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
215b81b6b3SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
225b81b6b3SRodney W. Grimes  *    without specific prior written permission.
235b81b6b3SRodney W. Grimes  *
245b81b6b3SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
255b81b6b3SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
265b81b6b3SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
275b81b6b3SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
285b81b6b3SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
295b81b6b3SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
305b81b6b3SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
315b81b6b3SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
325b81b6b3SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
335b81b6b3SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
345b81b6b3SRodney W. Grimes  * SUCH DAMAGE.
355b81b6b3SRodney W. Grimes  *
36d42d25c4SRodney W. Grimes  *	from: @(#)vmparam.h	5.9 (Berkeley) 5/12/91
37c3aac50fSPeter Wemm  * $FreeBSD$
385b81b6b3SRodney W. Grimes  */
395b81b6b3SRodney W. Grimes 
405b81b6b3SRodney W. Grimes 
416e393973SGarrett Wollman #ifndef _MACHINE_VMPARAM_H_
426e393973SGarrett Wollman #define _MACHINE_VMPARAM_H_ 1
436e393973SGarrett Wollman 
445b81b6b3SRodney W. Grimes /*
455b81b6b3SRodney W. Grimes  * Machine dependent constants for 386.
465b81b6b3SRodney W. Grimes  */
475b81b6b3SRodney W. Grimes 
485b81b6b3SRodney W. Grimes /*
495b81b6b3SRodney W. Grimes  * Virtual memory related constants, all in bytes
505b81b6b3SRodney W. Grimes  */
51f4fabec6SDavid Greenman #define	MAXTSIZ		(128UL*1024*1024)	/* max text size */
525b81b6b3SRodney W. Grimes #ifndef DFLDSIZ
53f4fabec6SDavid Greenman #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
545b81b6b3SRodney W. Grimes #endif
555b81b6b3SRodney W. Grimes #ifndef MAXDSIZ
567416845fSJordan K. Hubbard #define	MAXDSIZ		(512UL*1024*1024)	/* max data size */
575b81b6b3SRodney W. Grimes #endif
585b81b6b3SRodney W. Grimes #ifndef	DFLSSIZ
5929360eb0SDavid Greenman #define	DFLSSIZ		(8UL*1024*1024)		/* initial stack size limit */
605b81b6b3SRodney W. Grimes #endif
615b81b6b3SRodney W. Grimes #ifndef	MAXSSIZ
62e10a6186SDavid Greenman #define	MAXSSIZ		(64UL*1024*1024)	/* max stack size */
635b81b6b3SRodney W. Grimes #endif
6429360eb0SDavid Greenman #ifndef SGROWSIZ
6529360eb0SDavid Greenman #define SGROWSIZ	(128UL*1024)		/* amount to grow stack */
6629360eb0SDavid Greenman #endif
675b81b6b3SRodney W. Grimes 
685b81b6b3SRodney W. Grimes /*
69271f0f12SAlan Cox  * Choose between DENSE and SPARSE based on whether lower execution time or
70271f0f12SAlan Cox  * lower kernel address space consumption is desired.  Under PAE, kernel
71271f0f12SAlan Cox  * address space is often in short supply.
7204a18977SAlan Cox  */
73271f0f12SAlan Cox #ifdef PAE
74271f0f12SAlan Cox #define	VM_PHYSSEG_SPARSE
75271f0f12SAlan Cox #else
7604a18977SAlan Cox #define	VM_PHYSSEG_DENSE
77271f0f12SAlan Cox #endif
7804a18977SAlan Cox 
7904a18977SAlan Cox /*
80e5c45405SAlan Cox  * The number of PHYSSEG entries must be one greater than the number
81e5c45405SAlan Cox  * of phys_avail entries because the phys_avail entry that spans the
82e5c45405SAlan Cox  * largest physical address that is accessible by ISA DMA is split
83e5c45405SAlan Cox  * into two PHYSSEG entries.
84e5c45405SAlan Cox  */
85e5c45405SAlan Cox #define	VM_PHYSSEG_MAX		17
86e5c45405SAlan Cox 
87e5c45405SAlan Cox /*
88966272caSAlan Cox  * Create one free page pool.  Since the i386 kernel virtual address
89e5c45405SAlan Cox  * space does not include a mapping onto the machine's entire physical
90e5c45405SAlan Cox  * memory, VM_FREEPOOL_DIRECT is defined as an alias for the default
91e5c45405SAlan Cox  * pool, VM_FREEPOOL_DEFAULT.
92e5c45405SAlan Cox  */
93966272caSAlan Cox #define	VM_NFREEPOOL		1
94e5c45405SAlan Cox #define	VM_FREEPOOL_DEFAULT	0
95e5c45405SAlan Cox #define	VM_FREEPOOL_DIRECT	0
96e5c45405SAlan Cox 
97e5c45405SAlan Cox /*
98e5c45405SAlan Cox  * Create two free page lists: VM_FREELIST_DEFAULT is for physical
99e5c45405SAlan Cox  * pages that are above the largest physical address that is
100e5c45405SAlan Cox  * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages
101e5c45405SAlan Cox  * that are below that address.
102e5c45405SAlan Cox  */
103e5c45405SAlan Cox #define	VM_NFREELIST		2
104e5c45405SAlan Cox #define	VM_FREELIST_DEFAULT	0
105e5c45405SAlan Cox #define	VM_FREELIST_ISADMA	1
106e5c45405SAlan Cox 
107e5c45405SAlan Cox /*
108e5c45405SAlan Cox  * The largest allocation size is 2MB under PAE and 4MB otherwise.
109e5c45405SAlan Cox  */
110e5c45405SAlan Cox #ifdef PAE
111e5c45405SAlan Cox #define	VM_NFREEORDER		10
112e5c45405SAlan Cox #else
113e5c45405SAlan Cox #define	VM_NFREEORDER		11
114e5c45405SAlan Cox #endif
115e5c45405SAlan Cox 
116e5c45405SAlan Cox /*
117fdcd29b5SAlan Cox  * Enable superpage reservations: 1 level.
118b8e7fc24SAlan Cox  */
119b8e7fc24SAlan Cox #ifndef	VM_NRESERVLEVEL
120fdcd29b5SAlan Cox #define	VM_NRESERVLEVEL		1
121b8e7fc24SAlan Cox #endif
122b8e7fc24SAlan Cox 
123b8e7fc24SAlan Cox /*
12434c15db9SKonstantin Belousov  * Level 0 reservations consist of 512 pages when PAE pagetables are
12534c15db9SKonstantin Belousov  * used, and 1024 pages otherwise.
126b8e7fc24SAlan Cox  */
127b8e7fc24SAlan Cox #ifndef	VM_LEVEL_0_ORDER
12834c15db9SKonstantin Belousov #if defined(PAE) || defined(PAE_TABLES)
129b8e7fc24SAlan Cox #define	VM_LEVEL_0_ORDER	9
130b8e7fc24SAlan Cox #else
131b8e7fc24SAlan Cox #define	VM_LEVEL_0_ORDER	10
132b8e7fc24SAlan Cox #endif
133b8e7fc24SAlan Cox #endif
134b8e7fc24SAlan Cox 
135b8e7fc24SAlan Cox /*
1366ccf265bSPeter Wemm  * Kernel physical load address.
1376ccf265bSPeter Wemm  */
1386ccf265bSPeter Wemm #ifndef KERNLOAD
1396ccf265bSPeter Wemm #define	KERNLOAD		(1 << PDRSHIFT)
14093ee134aSKip Macy #endif /* !defined(KERNLOAD) */
1416ccf265bSPeter Wemm 
1426ccf265bSPeter Wemm /*
14368c1eb12SPoul-Henning Kamp  * Virtual addresses of things.  Derived from the page directory and
14468c1eb12SPoul-Henning Kamp  * page table indexes from pmap.h for precision.
14568c1eb12SPoul-Henning Kamp  * Because of the page that is both a PD and PT, it looks a little
14668c1eb12SPoul-Henning Kamp  * messy at times, but hey, we'll do anything to save a page :-)
1475b81b6b3SRodney W. Grimes  */
1485b81b6b3SRodney W. Grimes 
14946ea68ddSJake Burkholder #define VM_MAX_KERNEL_ADDRESS	VADDR(KPTDI+NKPDE-1, NPTEPG-1)
15093ee134aSKip Macy 
15168c1eb12SPoul-Henning Kamp #define VM_MIN_KERNEL_ADDRESS	VADDR(PTDPTDI, PTDPTDI)
1527f8cb368SDavid Greenman 
15368c1eb12SPoul-Henning Kamp #define	KERNBASE		VADDR(KPTDI, 0)
15468c1eb12SPoul-Henning Kamp 
15568c1eb12SPoul-Henning Kamp #define UPT_MAX_ADDRESS		VADDR(PTDPTDI, PTDPTDI)
15668c1eb12SPoul-Henning Kamp #define UPT_MIN_ADDRESS		VADDR(PTDPTDI, 0)
15768c1eb12SPoul-Henning Kamp 
1585cd612b2SJake Burkholder #define VM_MAXUSER_ADDRESS	VADDR(PTDPTDI, 0)
15968c1eb12SPoul-Henning Kamp 
160d69ae412SKonstantin Belousov #define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
161d69ae412SKonstantin Belousov #define	USRSTACK		SHAREDPAGE
16268c1eb12SPoul-Henning Kamp 
16368c1eb12SPoul-Henning Kamp #define VM_MAX_ADDRESS		VADDR(PTDPTDI, PTDPTDI)
16468c1eb12SPoul-Henning Kamp #define VM_MIN_ADDRESS		((vm_offset_t)0)
1655b81b6b3SRodney W. Grimes 
166d9bed5beSJohn Dyson /*
167c70af487SAlan Cox  * How many physical pages per kmem arena virtual page.
168d9bed5beSJohn Dyson  */
169d9bed5beSJohn Dyson #ifndef VM_KMEM_SIZE_SCALE
170d9bed5beSJohn Dyson #define	VM_KMEM_SIZE_SCALE	(3)
171d9bed5beSJohn Dyson #endif
172d9bed5beSJohn Dyson 
173d9bed5beSJohn Dyson /*
174c70af487SAlan Cox  * Optional floor (in bytes) on the size of the kmem arena.
175c70af487SAlan Cox  */
176c70af487SAlan Cox #ifndef VM_KMEM_SIZE_MIN
177c70af487SAlan Cox #define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024)
178c70af487SAlan Cox #endif
179c70af487SAlan Cox 
180c70af487SAlan Cox /*
181c70af487SAlan Cox  * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
182c70af487SAlan Cox  * kernel map rounded to the nearest multiple of the superpage size.
183d9bed5beSJohn Dyson  */
184d9bed5beSJohn Dyson #ifndef VM_KMEM_SIZE_MAX
185c5ecbfb4SAlan Cox #define	VM_KMEM_SIZE_MAX	(((((VM_MAX_KERNEL_ADDRESS - \
186c5ecbfb4SAlan Cox     VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT)
1877bcc0f3dSTor Egge #endif
1885b81b6b3SRodney W. Grimes 
18995461b45SJohn Dyson /* initial pagein size of beginning of executable file */
19095461b45SJohn Dyson #ifndef VM_INITIAL_PAGEIN
19195461b45SJohn Dyson #define	VM_INITIAL_PAGEIN	16
19295461b45SJohn Dyson #endif
19395461b45SJohn Dyson 
194cfb00e5aSMatthew D Fleming #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
195cfb00e5aSMatthew D Fleming 
19679f62ed6SAlfred Perlstein #ifndef VM_MAX_AUTOTUNE_MAXUSERS
19779f62ed6SAlfred Perlstein #define VM_MAX_AUTOTUNE_MAXUSERS 384
19879f62ed6SAlfred Perlstein #endif
19979f62ed6SAlfred Perlstein 
200c8d2ffd6SGleb Smirnoff #define	SFBUF
201c8d2ffd6SGleb Smirnoff #define	SFBUF_MAP
202c8d2ffd6SGleb Smirnoff #define	SFBUF_CPUSET
203c8d2ffd6SGleb Smirnoff #define	SFBUF_PROCESS_PAGE
204c8d2ffd6SGleb Smirnoff 
205*9a8196ceSNathan Whitehorn #define	PMAP_HAS_DMAP	0
206*9a8196ceSNathan Whitehorn 
2076e393973SGarrett Wollman #endif /* _MACHINE_VMPARAM_H_ */
208