1/* $OpenBSD: vmparam.h,v 1.25 2024/11/08 01:44:52 jsg 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 _MACHINE_VMPARAM_H_
39#define _MACHINE_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)256*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)128*1024*1024*1024) /* max data size */
64#endif
65#ifndef BRKSIZ
66#define BRKSIZ ((paddr_t)8*1024*1024*1024) /* heap gap size */
67#endif
68#ifndef DFLSSIZ
69#define DFLSSIZ ((paddr_t)2*1024*1024) /* initial stack size limit */
70#endif
71#ifndef MAXSSIZ
72#define MAXSSIZ ((paddr_t)32*1024*1024) /* max stack size */
73#endif
74
75#define STACKGAP_RANDOM 256*1024
76
77/*
78 * Size of shared memory map
79 */
80#ifndef SHMMAXPGS
81#define SHMMAXPGS 8192
82#endif
83
84/*
85 * Size of User Raw I/O map
86 */
87#define USRIOSIZE 300
88
89/*
90 * Mach derived constants
91 */
92
93/* user/kernel map constants */
94#define VM_MIN_ADDRESS PAGE_SIZE
95#define VM_MAXUSER_ADDRESS 0x00007f7fffffc000
96#define VM_MAX_ADDRESS 0x00007fbfdfeff000
97#ifdef _KERNEL
98#define VM_MIN_STACK_ADDRESS 0x0000600000000000
99#endif
100#define VM_MIN_KERNEL_ADDRESS 0xffff800000000000
101#define VM_MAX_KERNEL_ADDRESS 0xffff800100000000
102
103/* map PIE into approximately the first quarter of user va space */
104#define VM_PIE_MIN_ADDR VM_MIN_ADDRESS
105#define VM_PIE_MAX_ADDR 0x200000000000
106
107/* virtual sizes (bytes) for various kernel submaps */
108#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
109
110#define VM_PHYSSEG_MAX 16 /* actually we could have this many segments */
111#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST
112#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */
113
114#endif /* _MACHINE_VMPARAM_H_ */