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