xref: /dragonfly/sys/platform/pc64/include/vmparam.h (revision b2b3ffcd)
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * Copyright (c) 1994 John S. Dyson
4  * Copyright (c) 2003 Peter Wemm
5  * Copyright (c) 2008 The DragonFly Project.
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. All advertising materials mentioning features or use of this software
20  *    must display the following acknowledgement:
21  *	This product includes software developed by the University of
22  *	California, Berkeley and its contributors.
23  * 4. Neither the name of the University nor the names of its contributors
24  *    may be used to endorse or promote products derived from this software
25  *    without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37  * SUCH DAMAGE.
38  *
39  *	from: @(#)vmparam.h	5.9 (Berkeley) 5/12/91
40  * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.44 2003/12/07 04:51:04 alc Exp $
41  * $DragonFly: src/sys/platform/pc64/include/vmparam.h,v 1.2 2008/08/29 17:07:17 dillon Exp $
42  */
43 
44 
45 #ifndef _MACHINE_VMPARAM_H_
46 #define	_MACHINE_VMPARAM_H_
47 
48 /*
49  * Machine dependent constants for x86_64.
50  */
51 
52 /*
53  * Virtual memory related constants, all in bytes
54  */
55 #define	MAXTSIZ		(128UL*1024*1024)	/* max text size */
56 #ifndef DFLDSIZ
57 #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
58 #endif
59 #ifndef MAXDSIZ
60 #define	MAXDSIZ		(32768UL*1024*1024)	/* max data size */
61 #endif
62 #ifndef	DFLSSIZ
63 #define	DFLSSIZ		(8UL*1024*1024)		/* initial stack size limit */
64 #endif
65 #ifndef	MAXSSIZ
66 #define	MAXSSIZ		(512UL*1024*1024)	/* max stack size */
67 #endif
68 #ifndef SGROWSIZ
69 #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
70 #endif
71 
72 /*
73  * The time for a process to be blocked before being very swappable.
74  * This is a number of seconds which the system takes as being a non-trivial
75  * amount of real time.  You probably shouldn't change this;
76  * it is used in subtle ways (fractions and multiples of it are, that is, like
77  * half of a ``long time'', almost a long time, etc.)
78  * It is related to human patience and other factors which don't really
79  * change over time.
80  */
81 #define	MAXSLP 		20
82 
83 /*
84  * We provide a machine specific single page allocator through the use
85  * of the direct mapped segment.  This uses 2MB pages for reduced
86  * TLB pressure.
87  */
88 #define	UMA_MD_SMALL_ALLOC
89 
90 /*
91  * The number of PHYSSEG entries must be one greater than the number
92  * of phys_avail entries because the phys_avail entry that spans the
93  * largest physical address that is accessible by ISA DMA is split
94  * into two PHYSSEG entries.
95  */
96 #define	VM_PHYSSEG_MAX		31
97 
98 /*
99  * Virtual addresses of things.  Derived from the page directory and
100  * page table indexes from pmap.h for precision.
101  * Because of the page that is both a PD and PT, it looks a little
102  * messy at times, but hey, we'll do anything to save a page :-)
103  */
104 
105 #define	VM_MAX_KERNEL_ADDRESS	KVADDR(KPML4I, NPDPEPG-1, NPDEPG-1, NPTEPG-1)
106 #define	VM_MIN_KERNEL_ADDRESS	KVADDR(KPML4I, NPDPEPG-7, 0, 0)
107 
108 #define	DMAP_MIN_ADDRESS	KVADDR(DMPML4I, 0, 0, 0)
109 #define	DMAP_MAX_ADDRESS	KVADDR(DMPML4I+1, 0, 0, 0)
110 
111 #define	KERNBASE		KVADDR(KPML4I, KPDPI, 0, 0)
112 #define	PTOV_OFFSET		KERNBASE
113 
114 #if JG
115 #define KPT_MAX_ADDRESS		VADDR(PTDPTDI, KPTDI+NKPT)
116 #define KPT_MIN_ADDRESS		VADDR(PTDPTDI, KPTDI)
117 #endif
118 
119 #define UPT_MAX_ADDRESS		KVADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I)
120 #define UPT_MIN_ADDRESS		KVADDR(PML4PML4I, 0, 0, 0)
121 
122 #define VM_MIN_USER_ADDRESS	((vm_offset_t)0)
123 #define VM_MAX_USER_ADDRESS	UVADDR(NUPML4E, 0, 0, 0)
124 
125 #define USRSTACK		VM_MAX_USER_ADDRESS
126 
127 #define	PHYS_TO_DMAP(x)		((vm_offset_t)(x) | DMAP_MIN_ADDRESS)
128 #define	DMAP_TO_PHYS(x)		((vm_paddr_t)(x) & ~DMAP_MIN_ADDRESS)
129 
130 /* initial pagein size of beginning of executable file */
131 #ifndef VM_INITIAL_PAGEIN
132 #define	VM_INITIAL_PAGEIN	16
133 #endif
134 
135 #endif /* _MACHINE_VMPARAM_H_ */
136