xref: /openbsd/sys/arch/amd64/include/vmparam.h (revision bc13e585)
1*bc13e585Srobert /*	$OpenBSD: vmparam.h,v 1.24 2023/04/28 18:33:22 robert Exp $	*/
2f5df1827Smickey /*	$NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $	*/
3f5df1827Smickey 
4f5df1827Smickey /*-
5f5df1827Smickey  * Copyright (c) 1990 The Regents of the University of California.
6f5df1827Smickey  * All rights reserved.
7f5df1827Smickey  *
8f5df1827Smickey  * This code is derived from software contributed to Berkeley by
9f5df1827Smickey  * William Jolitz.
10f5df1827Smickey  *
11f5df1827Smickey  * Redistribution and use in source and binary forms, with or without
12f5df1827Smickey  * modification, are permitted provided that the following conditions
13f5df1827Smickey  * are met:
14f5df1827Smickey  * 1. Redistributions of source code must retain the above copyright
15f5df1827Smickey  *    notice, this list of conditions and the following disclaimer.
16f5df1827Smickey  * 2. Redistributions in binary form must reproduce the above copyright
17f5df1827Smickey  *    notice, this list of conditions and the following disclaimer in the
18f5df1827Smickey  *    documentation and/or other materials provided with the distribution.
19c5217b0aSjsg  * 3. Neither the name of the University nor the names of its contributors
20f5df1827Smickey  *    may be used to endorse or promote products derived from this software
21f5df1827Smickey  *    without specific prior written permission.
22f5df1827Smickey  *
23f5df1827Smickey  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24f5df1827Smickey  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25f5df1827Smickey  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26f5df1827Smickey  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27f5df1827Smickey  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28f5df1827Smickey  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29f5df1827Smickey  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30f5df1827Smickey  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31f5df1827Smickey  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32f5df1827Smickey  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33f5df1827Smickey  * SUCH DAMAGE.
34f5df1827Smickey  *
35f5df1827Smickey  *	@(#)vmparam.h	5.9 (Berkeley) 5/12/91
36f5df1827Smickey  */
37f5df1827Smickey 
382fa72412Spirofti #ifndef _MACHINE_VMPARAM_H_
392fa72412Spirofti #define _MACHINE_VMPARAM_H_
40f5df1827Smickey 
41f5df1827Smickey /*
42f5df1827Smickey  * Machine dependent constants for amd64.
43f5df1827Smickey  */
44f5df1827Smickey 
45f5df1827Smickey /*
46f5df1827Smickey  * USRSTACK is the top (end) of the user stack. Immediately above the
47f5df1827Smickey  * user stack resides the user structure, which is UPAGES long and contains
48f5df1827Smickey  * the kernel stack.
49f5df1827Smickey  *
50f5df1827Smickey  * Immediately after the user structure is the page table map, and then
51ec3c43edSjmc  * kernel address space.
52f5df1827Smickey  */
53f5df1827Smickey #define	USRSTACK	VM_MAXUSER_ADDRESS
54f5df1827Smickey 
55f5df1827Smickey /*
56f5df1827Smickey  * Virtual memory related constants, all in bytes
57f5df1827Smickey  */
58aa12beffSderaadt #define	MAXTSIZ		((paddr_t)256*1024*1024)	/* max text size */
59f5df1827Smickey #ifndef DFLDSIZ
600f91bea7Sweingart #define	DFLDSIZ		((paddr_t)128*1024*1024)	/* initial data size limit */
61f5df1827Smickey #endif
62f5df1827Smickey #ifndef MAXDSIZ
63*bc13e585Srobert #define	MAXDSIZ		((paddr_t)128*1024*1024*1024)	/* max data size */
64f5df1827Smickey #endif
6501d0831fStedu #ifndef BRKSIZ
665f4c67d3Stedu #define	BRKSIZ		((paddr_t)8*1024*1024*1024)	/* heap gap size */
6701d0831fStedu #endif
68f5df1827Smickey #ifndef	DFLSSIZ
690f91bea7Sweingart #define	DFLSSIZ		((paddr_t)2*1024*1024)		/* initial stack size limit */
70f5df1827Smickey #endif
71f5df1827Smickey #ifndef	MAXSSIZ
720f91bea7Sweingart #define	MAXSSIZ		((paddr_t)32*1024*1024)		/* max stack size */
73f5df1827Smickey #endif
74f5df1827Smickey 
75857f7c37Sderaadt #define STACKGAP_RANDOM	256*1024
76a489ea08Sderaadt 
77f5df1827Smickey /*
78f5df1827Smickey  * Size of shared memory map
79f5df1827Smickey  */
80f5df1827Smickey #ifndef SHMMAXPGS
81f5df1827Smickey #define SHMMAXPGS	8192
82f5df1827Smickey #endif
83f5df1827Smickey 
84f5df1827Smickey /*
85f5df1827Smickey  * Size of User Raw I/O map
86f5df1827Smickey  */
87f5df1827Smickey #define	USRIOSIZE 	300
88f5df1827Smickey 
89f5df1827Smickey /*
90f5df1827Smickey  * Mach derived constants
91f5df1827Smickey  */
92f5df1827Smickey 
93f5df1827Smickey /* user/kernel map constants */
94b5da920cSderaadt #define VM_MIN_ADDRESS		PAGE_SIZE
95f5df1827Smickey #define VM_MAXUSER_ADDRESS	0x00007f7fffffc000
96f5df1827Smickey #define VM_MAX_ADDRESS		0x00007fbfdfeff000
97e8dad7d8Skettenis #ifdef _KERNEL
98e8dad7d8Skettenis #define VM_MIN_STACK_ADDRESS	0x0000600000000000
99e8dad7d8Skettenis #endif
100f5df1827Smickey #define VM_MIN_KERNEL_ADDRESS	0xffff800000000000
101f5df1827Smickey #define VM_MAX_KERNEL_ADDRESS	0xffff800100000000
102f5df1827Smickey 
103f5df1827Smickey #define VM_MAXUSER_ADDRESS32	0xffffc000
104f5df1827Smickey 
105c62276a4Skurt /* map PIE into approximately the first quarter of user va space */
106c62276a4Skurt #define VM_PIE_MIN_ADDR		VM_MIN_ADDRESS
107c62276a4Skurt #define VM_PIE_MAX_ADDR		0x200000000000
108c62276a4Skurt 
109f5df1827Smickey /* virtual sizes (bytes) for various kernel submaps */
110f5df1827Smickey #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
111f5df1827Smickey 
1128a23882cSweingart #define VM_PHYSSEG_MAX		16	/* actually we could have this many segments */
113f5df1827Smickey #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
114f5df1827Smickey #define VM_PHYSSEG_NOADD		/* can't add RAM after vm_mem_init */
115f5df1827Smickey 
1162fa72412Spirofti #endif /* _MACHINE_VMPARAM_H_ */
117