]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 A |
6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
7 | * | |
8 | * This file contains Original Code and/or Modifications of Original Code | |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * @OSF_COPYRIGHT@ | |
27 | */ | |
28 | /* | |
29 | * Mach Operating System | |
30 | * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University | |
31 | * All Rights Reserved. | |
32 | * | |
33 | * Permission to use, copy, modify and distribute this software and its | |
34 | * documentation is hereby granted, provided that both the copyright | |
35 | * notice and this permission notice appear in all copies of the | |
36 | * software, derivative works or modified versions, and any portions | |
37 | * thereof, and that both notices appear in supporting documentation. | |
38 | * | |
39 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
40 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
41 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
42 | * | |
43 | * Carnegie Mellon requests users of this software to return to | |
44 | * | |
45 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
46 | * School of Computer Science | |
47 | * Carnegie Mellon University | |
48 | * Pittsburgh PA 15213-3890 | |
49 | * | |
50 | * any improvements or extensions that they make and grant Carnegie Mellon | |
51 | * the rights to redistribute these changes. | |
52 | */ | |
53 | ||
54 | /* | |
55 | * Copyright (c) 1994 The University of Utah and | |
56 | * the Computer Systems Laboratory at the University of Utah (CSL). | |
57 | * All rights reserved. | |
58 | * | |
59 | * Permission to use, copy, modify and distribute this software is hereby | |
60 | * granted provided that (1) source code retains these copyright, permission, | |
61 | * and disclaimer notices, and (2) redistributions including binaries | |
62 | * reproduce the notices in supporting documentation, and (3) all advertising | |
63 | * materials mentioning features or use of this software display the following | |
64 | * acknowledgement: ``This product includes software developed by the | |
65 | * Computer Systems Laboratory at the University of Utah.'' | |
66 | * | |
67 | * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS | |
68 | * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF | |
69 | * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
70 | * | |
71 | * CSL requests users of this software to return to csl-dist@cs.utah.edu any | |
72 | * improvements that they make and grant CSL redistribution rights. | |
73 | * | |
74 | */ | |
75 | ||
76 | /* | |
77 | * File: vm_param.h | |
78 | * Author: Avadis Tevanian, Jr. | |
79 | * Date: 1985 | |
80 | * | |
81 | * I386 machine dependent virtual memory parameters. | |
82 | * Most of the declarations are preceeded by I386_ (or i386_) | |
83 | * which is OK because only I386 specific code will be using | |
84 | * them. | |
85 | */ | |
86 | ||
87 | #ifndef _MACH_I386_VM_PARAM_H_ | |
88 | #define _MACH_I386_VM_PARAM_H_ | |
89 | ||
90 | #define BYTE_SIZE 8 /* byte size in bits */ | |
91 | ||
92 | #define I386_PGBYTES 4096 /* bytes per 80386 page */ | |
93 | #define I386_PGSHIFT 12 /* number of bits to shift for pages */ | |
94 | ||
95 | /* | |
96 | * Convert bytes to pages and convert pages to bytes. | |
97 | * No rounding is used. | |
98 | */ | |
99 | ||
100 | #define i386_btop(x) (((unsigned)(x)) >> I386_PGSHIFT) | |
101 | #define machine_btop(x) i386_btop(x) | |
102 | #define i386_ptob(x) (((unsigned)(x)) << I386_PGSHIFT) | |
103 | ||
104 | /* | |
105 | * Round off or truncate to the nearest page. These will work | |
106 | * for either addresses or counts. (i.e. 1 byte rounds to 1 page | |
107 | * bytes. | |
108 | */ | |
109 | ||
110 | #define i386_round_page(x) ((((unsigned)(x)) + I386_PGBYTES - 1) & \ | |
111 | ~(I386_PGBYTES-1)) | |
112 | #define i386_trunc_page(x) (((unsigned)(x)) & ~(I386_PGBYTES-1)) | |
113 | ||
55e303ae A |
114 | #define VM_MAX_PAGE_ADDRESS 0x00000000C0000000ULL |
115 | ||
1c79356b | 116 | #define VM_MIN_ADDRESS ((vm_offset_t) 0) |
55e303ae | 117 | #define VM_MAX_ADDRESS ((vm_offset_t) (VM_MAX_PAGE_ADDRESS & 0xFFFFFFFF)) |
1c79356b A |
118 | |
119 | #define LINEAR_KERNEL_ADDRESS ((vm_offset_t) 0xc0000000) | |
120 | ||
121 | #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t) 0x00000000U) | |
122 | #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t) 0x3fffffffU) | |
123 | ||
124 | #define VM_MIN_KERNEL_LOADED_ADDRESS ((vm_offset_t) 0x0c000000U) | |
125 | #define VM_MAX_KERNEL_LOADED_ADDRESS ((vm_offset_t) 0x1fffffffU) | |
126 | ||
127 | /* FIXME - always leave like this? */ | |
128 | #define INTSTACK_SIZE (I386_PGBYTES*4) | |
129 | #define KERNEL_STACK_SIZE (I386_PGBYTES*4) | |
130 | ||
1c79356b A |
131 | /* |
132 | * Conversion between 80386 pages and VM pages | |
133 | */ | |
134 | ||
135 | #define trunc_i386_to_vm(p) (atop(trunc_page(i386_ptob(p)))) | |
136 | #define round_i386_to_vm(p) (atop(round_page(i386_ptob(p)))) | |
137 | #define vm_to_i386(p) (i386_btop(ptoa(p))) | |
138 | ||
139 | /* | |
140 | * Physical memory is mapped 1-1 with virtual memory starting | |
141 | * at VM_MIN_KERNEL_ADDRESS. | |
142 | */ | |
143 | #define phystokv(a) ((vm_offset_t)(a) + VM_MIN_KERNEL_ADDRESS) | |
144 | ||
145 | /* | |
146 | * For 386 only, ensure that pages are installed in the | |
147 | * kernel_pmap with VM_PROT_WRITE enabled. This avoids | |
148 | * code in pmap_enter that disallows a read-only mapping | |
149 | * in the kernel's pmap. (See ri-osc CR1387.) | |
150 | * | |
151 | * An entry in kernel_pmap is made only by the kernel or | |
152 | * a collocated server -- by definition (;-)), the requester | |
153 | * is trusted code. If it asked for read-only access, | |
154 | * it won't attempt a write. We don't have to enforce the | |
155 | * restriction. (Naturally, this assumes that any collocated | |
156 | * server will _not_ depend on trapping write accesses to pages | |
157 | * mapped read-only; this cannot be made to work in the current | |
158 | * i386-inspired pmap model.) | |
159 | */ | |
160 | ||
161 | /*#if defined(AT386) | |
162 | ||
163 | #define PMAP_ENTER_386_CHECK \ | |
164 | if (cpuid_family == CPUID_FAMILY_386) | |
165 | ||
166 | #else -- FIXME? We're only running on Pentiums or better */ | |
167 | ||
168 | #define PMAP_ENTER_386_CHECK | |
169 | ||
170 | /*#endif*/ | |
171 | ||
9bccf70c | 172 | #define PMAP_ENTER(pmap, virtual_address, page, protection, flags, wired) \ |
1c79356b A |
173 | MACRO_BEGIN \ |
174 | vm_prot_t __prot__ = \ | |
175 | (protection) & ~(page)->page_lock; \ | |
176 | \ | |
177 | PMAP_ENTER_386_CHECK \ | |
178 | if ((pmap) == kernel_pmap) \ | |
179 | __prot__ |= VM_PROT_WRITE; \ | |
180 | pmap_enter( \ | |
181 | (pmap), \ | |
182 | (virtual_address), \ | |
55e303ae | 183 | (page)->phys_page, \ |
1c79356b | 184 | __prot__, \ |
9bccf70c | 185 | flags, \ |
1c79356b A |
186 | (wired) \ |
187 | ); \ | |
188 | MACRO_END | |
189 | ||
190 | #endif /* _MACH_I386_VM_PARAM_H_ */ |