kernel - Rewrite the x86-64 pmap code
[dragonfly.git] / sys / platform / pc64 / include / vmparam.h
CommitLineData
39923942
SS
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
39923942 3 * Copyright (c) 1994 John S. Dyson
39923942 4 * Copyright (c) 2003 Peter Wemm
c8fe38ae 5 * Copyright (c) 2008 The DragonFly Project.
39923942
SS
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 $
c8fe38ae 41 * $DragonFly: src/sys/platform/pc64/include/vmparam.h,v 1.2 2008/08/29 17:07:17 dillon Exp $
39923942
SS
42 */
43
44
45#ifndef _MACHINE_VMPARAM_H_
46#define _MACHINE_VMPARAM_H_
47
48/*
b2b3ffcd 49 * Machine dependent constants for x86_64.
39923942
SS
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
a2a636cc 60#define MAXDSIZ (32768UL*1024*1024) /* max data size */
39923942
SS
61#endif
62#ifndef DFLSSIZ
63#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */
64#endif
65#ifndef MAXSSIZ
a2a636cc 66#define MAXSSIZ (512UL*1024*1024) /* max stack size */
39923942
SS
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/*
c8fe38ae
MD
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/*
39923942
SS
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 :-)
791c6551
MD
103 *
104 * The kernel address space can be up to (I think) 511 page directory
105 * pages. Each one represents 1G. NKPDPE defines the size of the kernel
ad54aa11 106 * address space, curently set to 128G.
da23a592
MD
107 *
108 * The ending address is non-inclusive of the per-cpu data array
109 * which starts at MPPTDI (-16MB mark). MPPTDI is the page directory
110 * index in the last PD of the kernel address space and is typically
111 * set to (NPDEPG - 8) = (512 - 8).
39923942 112 */
ad54aa11 113#define NKPDPE 128
da23a592
MD
114#define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG - NKPDPE, 0, 0)
115#define VM_MAX_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG - 1, MPPTDI, NPTEPG - 1)
39923942
SS
116
117#define DMAP_MIN_ADDRESS KVADDR(DMPML4I, 0, 0, 0)
118#define DMAP_MAX_ADDRESS KVADDR(DMPML4I+1, 0, 0, 0)
119
67553e72
JG
120#define KERNBASE KVADDR(KPML4I, KPDPI, 0, 0)
121#define PTOV_OFFSET KERNBASE
c8fe38ae 122
67553e72
JG
123#define UPT_MAX_ADDRESS KVADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I)
124#define UPT_MIN_ADDRESS KVADDR(PML4PML4I, 0, 0, 0)
39923942
SS
125
126#define VM_MIN_USER_ADDRESS ((vm_offset_t)0)
701c977e 127#define VM_MAX_USER_ADDRESS UVADDR(NUPDP_USER, 0, 0, 0)
67553e72
JG
128
129#define USRSTACK VM_MAX_USER_ADDRESS
39923942 130
bfc09ba0
MD
131#define PHYS_TO_DMAP(x) ((vm_offset_t)(x) | DMAP_MIN_ADDRESS)
132#define DMAP_TO_PHYS(x) ((vm_paddr_t)(x) & ~DMAP_MIN_ADDRESS)
39923942 133
39923942
SS
134/* initial pagein size of beginning of executable file */
135#ifndef VM_INITIAL_PAGEIN
136#define VM_INITIAL_PAGEIN 16
137#endif
138
139#endif /* _MACHINE_VMPARAM_H_ */