vmparam.h revision 1.50 1 /* $NetBSD: vmparam.h,v 1.50 2011/08/24 16:01:53 matt Exp $ */
2
3 /*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: vmparam.h 1.16 91/01/18
37 *
38 * @(#)vmparam.h 8.2 (Berkeley) 4/22/94
39 */
40
41 #ifndef _MIPS_VMPARAM_H_
42 #define _MIPS_VMPARAM_H_
43
44 #ifdef _KERNEL_OPT
45 #include "opt_multiprocessor.h"
46 #include "opt_cputype.h"
47 #endif
48
49 /*
50 * Machine dependent VM constants for MIPS.
51 */
52
53 /*
54 * We normally use a 4K page but may use 16K on MIPS systems.
55 * Override PAGE_* definitions to compile-time constants.
56 */
57 #ifdef ENABLE_MIPS_16KB_PAGE
58 #define PAGE_SHIFT 14
59 #elif defined(ENABLE_MIPS_4KB_PAGE) || 1
60 #define PAGE_SHIFT 12
61 #else
62 #error ENABLE_MIPS_xKB_PAGE not defined
63 #endif
64 #define PAGE_SIZE (1 << PAGE_SHIFT)
65 #define PAGE_MASK (PAGE_SIZE - 1)
66
67 /*
68 * USRSTACK is the top (end) of the user stack.
69 *
70 * USRSTACK needs to start a little below 0x8000000 because the R8000
71 * and some QED CPUs perform some virtual address checks before the
72 * offset is calculated. We use 0x8000 since that's the max displacement
73 * in an instruction.
74 */
75 #define USRSTACK (VM_MAXUSER_ADDRESS-0x8000) /* Start of user stack */
76 #define USRSTACK32 ((uint32_t)VM_MAXUSER32_ADDRESS-0x8000)
77
78 /* alignment requirement for u-area space in bytes */
79 #define USPACE_ALIGN USPACE
80
81 /*
82 * Virtual memory related constants, all in bytes
83 */
84 #if defined(__mips_o32)
85 #ifndef MAXTSIZ
86 #define MAXTSIZ (64*1024*1024) /* max text size */
87 #endif
88 #ifndef DFLDSIZ
89 #define DFLDSIZ (128*1024*1024) /* initial data size limit */
90 #endif
91 #ifndef MAXDSIZ
92 #define MAXDSIZ (512*1024*1024) /* max data size */
93 #endif
94 #ifndef DFLSSIZ
95 #define DFLSSIZ (4*1024*1024) /* initial stack size limit */
96 #endif
97 #ifndef MAXSSIZ
98 #define MAXSSIZ (32*1024*1024) /* max stack size */
99 #endif
100 #else
101 /*
102 * 64-bit ABIs need more space.
103 */
104 #ifndef MAXTSIZ
105 #define MAXTSIZ (128*1024*1024) /* max text size */
106 #endif
107 #ifndef DFLDSIZ
108 #define DFLDSIZ (256*1024*1024) /* initial data size limit */
109 #endif
110 #ifndef MAXDSIZ
111 #define MAXDSIZ (1536*1024*1024) /* max data size */
112 #endif
113 #ifndef DFLSSIZ
114 #define DFLSSIZ (16*1024*1024) /* initial stack size limit */
115 #endif
116 #ifndef MAXSSIZ
117 #define MAXSSIZ (120*1024*1024) /* max stack size */
118 #endif
119 #endif /* !__mips_o32 */
120
121 /*
122 * Virtual memory related constants, all in bytes
123 */
124 #ifndef MAXTSIZ32
125 #define MAXTSIZ32 MAXTSIZ /* max text size */
126 #endif
127 #ifndef DFLDSIZ32
128 #define DFLDSIZ32 DFLDSIZ /* initial data size limit */
129 #endif
130 #ifndef MAXDSIZ32
131 #define MAXDSIZ32 MAXDSIZ /* max data size */
132 #endif
133 #ifndef DFLSSIZ32
134 #define DFLSSIZ32 DFLTSIZ /* initial stack size limit */
135 #endif
136 #ifndef MAXSSIZ32
137 #define MAXSSIZ32 MAXSSIZ /* max stack size */
138 #endif
139
140 /*
141 * PTEs for mapping user space into the kernel for phyio operations.
142 * The default PTE number is enough to cover 8 disks * MAXBSIZE.
143 */
144 #ifndef USRIOSIZE
145 #define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8)
146 #endif
147
148 /*
149 * Mach derived constants
150 */
151
152 /*
153 * user/kernel map constants
154 * These are negative addresses since MIPS addresses are signed.
155 */
156 #define VM_MIN_ADDRESS ((vaddr_t)0x00000000)
157 #ifdef _LP64
158 #define MIPS_VM_MAXUSER_ADDRESS ((vaddr_t) 1L << (4*PGSHIFT-8))
159 #ifdef ENABLE_MIPS_16KB_PAGE
160 #define VM_MAXUSER_ADDRESS mips_vm_maxuser_address
161 #else
162 #define VM_MAXUSER_ADDRESS MIPS_VM_MAXUSER_ADDRESS
163 #endif
164 /* 0x0000010000000000 */
165 #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
166 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) 3L << 62) /* 0xC000000000000000 */
167 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) -1L << 31) /* 0xFFFFFFFF80000000 */
168 #else
169 #define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */
170 #define VM_MAX_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */
171 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xFFFFFFFFC0000000 */
172 #ifdef ENABLE_MIPS_TX3900
173 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x01000000) /* 0xFFFFFFFFFF000000 */
174 #else
175 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x00004000) /* 0xFFFFFFFFFFFFC000 */
176 #endif
177 #endif
178 #define VM_MAXUSER32_ADDRESS ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */
179
180 /*
181 * The address to which unspecified mapping requests default
182 */
183 #define __USE_TOPDOWN_VM
184 #define VM_DEFAULT_ADDRESS(da, sz) \
185 trunc_page(USRSTACK - MAXSSIZ - (sz))
186 #define VM_DEFAULT_ADDRESS32(da, sz) \
187 trunc_page(USRSTACK32 - MAXSSIZ32 - (sz))
188
189 /* virtual sizes (bytes) for various kernel submaps */
190 #define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
191
192 /* VM_PHYSSEG_MAX defined by platform-dependent code. */
193 #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
194 #define VM_PHYSSEG_NOADD /* can add RAM after vm_mem_init */
195
196 #ifndef VM_NFREELIST
197 #define VM_NFREELIST 16 /* 16 distinct memory segments */
198 #define VM_FREELIST_DEFAULT 0
199 #define VM_FREELIST_MAX 1
200 #endif
201
202 #ifdef _KERNEL
203 #define UVM_KM_VMFREELIST mips_poolpage_vmfreelist
204 extern int mips_poolpage_vmfreelist;
205 #ifdef ENABLE_MIPS_16KB_PAGE
206 extern vaddr_t mips_vm_maxuser_address;
207 #endif
208 #endif
209
210 #endif /* ! _MIPS_VMPARAM_H_ */
211