xref: /dflybsd-src/sys/platform/vkernel64/include/vmparam.h (revision 3206d8877be9b4cfed19ba8b59f3b1933b91ca42)
1da673940SJordan Gordeev /*
2da673940SJordan Gordeev  * Copyright (c) 2006 The DragonFly Project.  All rights reserved.
3da673940SJordan Gordeev  *
4da673940SJordan Gordeev  * This code is derived from software contributed to The DragonFly Project
5da673940SJordan Gordeev  * by Matthew Dillon <dillon@backplane.com>
6da673940SJordan Gordeev  *
7da673940SJordan Gordeev  * Redistribution and use in source and binary forms, with or without
8da673940SJordan Gordeev  * modification, are permitted provided that the following conditions
9da673940SJordan Gordeev  * are met:
10da673940SJordan Gordeev  *
11da673940SJordan Gordeev  * 1. Redistributions of source code must retain the above copyright
12da673940SJordan Gordeev  *    notice, this list of conditions and the following disclaimer.
13da673940SJordan Gordeev  * 2. Redistributions in binary form must reproduce the above copyright
14da673940SJordan Gordeev  *    notice, this list of conditions and the following disclaimer in
15da673940SJordan Gordeev  *    the documentation and/or other materials provided with the
16da673940SJordan Gordeev  *    distribution.
17da673940SJordan Gordeev  * 3. Neither the name of The DragonFly Project nor the names of its
18da673940SJordan Gordeev  *    contributors may be used to endorse or promote products derived
19da673940SJordan Gordeev  *    from this software without specific, prior written permission.
20da673940SJordan Gordeev  *
21da673940SJordan Gordeev  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22da673940SJordan Gordeev  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23da673940SJordan Gordeev  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24da673940SJordan Gordeev  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25da673940SJordan Gordeev  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26da673940SJordan Gordeev  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27da673940SJordan Gordeev  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28da673940SJordan Gordeev  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29da673940SJordan Gordeev  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30da673940SJordan Gordeev  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31da673940SJordan Gordeev  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32da673940SJordan Gordeev  * SUCH DAMAGE.
33da673940SJordan Gordeev  *
34da673940SJordan Gordeev  * $DragonFly: src/sys/platform/vkernel/include/vmparam.h,v 1.5 2007/01/14 00:01:07 dillon Exp $
35da673940SJordan Gordeev  */
36da673940SJordan Gordeev 
37da673940SJordan Gordeev #ifndef _MACHINE_VMPARAM_H_
38da673940SJordan Gordeev #define _MACHINE_VMPARAM_H_
39da673940SJordan Gordeev 
40da673940SJordan Gordeev /*
41da673940SJordan Gordeev  * Indicate that read access also means execution access (XXX newer PCs
42da673940SJordan Gordeev  * have a separate bit).
43da673940SJordan Gordeev  */
44da673940SJordan Gordeev #define VM_PROT_READ_IS_EXEC
45da673940SJordan Gordeev 
46da673940SJordan Gordeev /*
47da673940SJordan Gordeev  * Virtual memory related constants, all in bytes
48da673940SJordan Gordeev  */
49*3206d887SMatthew Dillon #define	MAXTSIZ		(32UL*1024*1024*1024)	/* max text size */
50*3206d887SMatthew Dillon 
51da673940SJordan Gordeev #ifndef DFLDSIZ
52da673940SJordan Gordeev #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
53da673940SJordan Gordeev #endif
54da673940SJordan Gordeev #ifndef MAXDSIZ
55*3206d887SMatthew Dillon #define	MAXDSIZ		(32UL*1024*1024*1024)	/* max data size */
56da673940SJordan Gordeev #endif
57da673940SJordan Gordeev #ifndef	DFLSSIZ
58da673940SJordan Gordeev #define	DFLSSIZ		(8UL*1024*1024)		/* initial stack size limit */
59da673940SJordan Gordeev #endif
60da673940SJordan Gordeev #ifndef	MAXSSIZ
61da673940SJordan Gordeev #define	MAXSSIZ		(512UL*1024*1024)	/* max stack size */
62da673940SJordan Gordeev #endif
634837705eSMatthew Dillon #ifndef	MAXTHRSSIZ
64*3206d887SMatthew Dillon #define	MAXTHRSSIZ	(128UL*1024*1024*1024) /* thread stack area */
654837705eSMatthew Dillon #endif
66da673940SJordan Gordeev #ifndef SGROWSIZ
67da673940SJordan Gordeev #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
68da673940SJordan Gordeev #endif
69da673940SJordan Gordeev 
70da673940SJordan Gordeev /*
71da673940SJordan Gordeev  * After this period of time allow a process to become swappable.  This
72da673940SJordan Gordeev  * parameter is mostly obsolete now.
73da673940SJordan Gordeev  */
74da673940SJordan Gordeev #define	MAXSLP 		20
75da673940SJordan Gordeev 
76da673940SJordan Gordeev /*
77da673940SJordan Gordeev  * For virtual kernels running as userland processes the user and kernel
78da673940SJordan Gordeev  * address spaces exist in different VM spaces and can overlap.
79da673940SJordan Gordeev  */
80a86ce0cdSMatthew Dillon #define KERNEL_KVA_START	(512ULL << 30)	/* From 512GB */
81a86ce0cdSMatthew Dillon #define KERNEL_KVA_SIZE		(512UL * 1024 * 1024 * 1024)
82a86ce0cdSMatthew Dillon #define KERNEL_STACK_SIZE	(512 * PAGE_SIZE)
83a86ce0cdSMatthew Dillon 
84a86ce0cdSMatthew Dillon #define VKERNEL_USEABLE_PHYS_RAM_BASE (128ULL << 30) /* from 32GB */
85da673940SJordan Gordeev 
8611ba7f73SMatthew Dillon /*
8711ba7f73SMatthew Dillon  * Do not allow the top 2MB of the user stack to be mapped to work around
8811ba7f73SMatthew Dillon  * an AMD bug wherein the cpu can lockup or destabilize if the instruction
8911ba7f73SMatthew Dillon  * prefetcher crosses over into non-canonical address space.  Only the top
9011ba7f73SMatthew Dillon  * 4KB needs to be disallowed, but taking out the whole 2MB allows potential
9111ba7f73SMatthew Dillon  * 2MB PTE optimizations to be retained.
9211ba7f73SMatthew Dillon  */
93da673940SJordan Gordeev #define VM_MIN_USER_ADDRESS	((vm_offset_t)0)
9411ba7f73SMatthew Dillon #define VM_MAX_USER_ADDRESS	UVADDR(NUPML4E - 1, NPDPEPG - 1, NPDEPG - 1, 0)
95da673940SJordan Gordeev 
96da673940SJordan Gordeev #define DMAP_SIZE		(512UL * 1024 * 1024 * 1024)
97da673940SJordan Gordeev 
98da673940SJordan Gordeev #define KERNBASE		0xC0000000	/* XXX totally wrong */
99da673940SJordan Gordeev 
100da673940SJordan Gordeev #define USRSTACK		VM_MAX_USER_ADDRESS
101da673940SJordan Gordeev 
102da673940SJordan Gordeev extern void *dmap_min_address;
103da673940SJordan Gordeev #define	PHYS_TO_DMAP(x)		((uint64_t)(x) + (uint64_t)dmap_min_address)
104da673940SJordan Gordeev #define	DMAP_TO_PHYS(x)		((uint64_t)(x) - (uint64_t)dmap_min_address)
105da673940SJordan Gordeev 
106da673940SJordan Gordeev /*
107da673940SJordan Gordeev  * Initial memory map preload
108da673940SJordan Gordeev  */
109da673940SJordan Gordeev #ifndef VM_INITIAL_PAGEIN
110da673940SJordan Gordeev #define	VM_INITIAL_PAGEIN	16
111da673940SJordan Gordeev #endif
112da673940SJordan Gordeev 
113da673940SJordan Gordeev #endif /* _MACHINE_VMPARAM_H_ */
114