| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.146 2011/12/08 22:36:42 rmind Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -161,27 +161,27 @@ | | | @@ -161,27 +161,27 @@ |
161 | * Hibler/Jolitz pmap, as modified for FreeBSD by John S. Dyson | | 161 | * Hibler/Jolitz pmap, as modified for FreeBSD by John S. Dyson |
162 | * and David Greenman. | | 162 | * and David Greenman. |
163 | * | | 163 | * |
164 | * [3] the Mach pmap. this pmap, from CMU, seems to have migrated | | 164 | * [3] the Mach pmap. this pmap, from CMU, seems to have migrated |
165 | * between several processors. the VAX version was done by | | 165 | * between several processors. the VAX version was done by |
166 | * Avadis Tevanian, Jr., and Michael Wayne Young. the i386 | | 166 | * Avadis Tevanian, Jr., and Michael Wayne Young. the i386 |
167 | * version was done by Lance Berc, Mike Kupfer, Bob Baron, | | 167 | * version was done by Lance Berc, Mike Kupfer, Bob Baron, |
168 | * David Golub, and Richard Draves. the alpha version was | | 168 | * David Golub, and Richard Draves. the alpha version was |
169 | * done by Alessandro Forin (CMU/Mach) and Chris Demetriou | | 169 | * done by Alessandro Forin (CMU/Mach) and Chris Demetriou |
170 | * (NetBSD/alpha). | | 170 | * (NetBSD/alpha). |
171 | */ | | 171 | */ |
172 | | | 172 | |
173 | #include <sys/cdefs.h> | | 173 | #include <sys/cdefs.h> |
174 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.146 2011/12/08 22:36:42 rmind Exp $"); | | 174 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs Exp $"); |
175 | | | 175 | |
176 | #include "opt_user_ldt.h" | | 176 | #include "opt_user_ldt.h" |
177 | #include "opt_lockdebug.h" | | 177 | #include "opt_lockdebug.h" |
178 | #include "opt_multiprocessor.h" | | 178 | #include "opt_multiprocessor.h" |
179 | #include "opt_xen.h" | | 179 | #include "opt_xen.h" |
180 | #if !defined(__x86_64__) | | 180 | #if !defined(__x86_64__) |
181 | #include "opt_kstack_dr0.h" | | 181 | #include "opt_kstack_dr0.h" |
182 | #endif /* !defined(__x86_64__) */ | | 182 | #endif /* !defined(__x86_64__) */ |
183 | | | 183 | |
184 | #include <sys/param.h> | | 184 | #include <sys/param.h> |
185 | #include <sys/systm.h> | | 185 | #include <sys/systm.h> |
186 | #include <sys/proc.h> | | 186 | #include <sys/proc.h> |
187 | #include <sys/pool.h> | | 187 | #include <sys/pool.h> |
| @@ -1355,33 +1355,33 @@ pmap_bootstrap(vaddr_t kva_start) | | | @@ -1355,33 +1355,33 @@ pmap_bootstrap(vaddr_t kva_start) |
1355 | pmap_update_pg(tmpva); | | 1355 | pmap_update_pg(tmpva); |
1356 | | | 1356 | |
1357 | pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME)); | | 1357 | pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME)); |
1358 | *pde = ((paddr_t)i << L2_SHIFT) | | | 1358 | *pde = ((paddr_t)i << L2_SHIFT) | |
1359 | PG_RW | PG_V | PG_U | PG_PS | PG_G; | | 1359 | PG_RW | PG_V | PG_U | PG_PS | PG_G; |
1360 | } | | 1360 | } |
1361 | for (i = 0; i < ndmpdp; i++) { | | 1361 | for (i = 0; i < ndmpdp; i++) { |
1362 | pdp = (paddr_t)&(((pd_entry_t *)dmpdp)[i]); | | 1362 | pdp = (paddr_t)&(((pd_entry_t *)dmpdp)[i]); |
1363 | *pte = (pdp & PG_FRAME) | PG_V | PG_RW; | | 1363 | *pte = (pdp & PG_FRAME) | PG_V | PG_RW; |
1364 | pmap_update_pg((vaddr_t)tmpva); | | 1364 | pmap_update_pg((vaddr_t)tmpva); |
1365 | | | 1365 | |
1366 | pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME)); | | 1366 | pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME)); |
1367 | *pde = (dmpd + (i << PAGE_SHIFT)) | | | 1367 | *pde = (dmpd + (i << PAGE_SHIFT)) | |
1368 | PG_RW | PG_V | PG_U | PG_G; | | 1368 | PG_RW | PG_V | PG_U; |
1369 | } | | 1369 | } |
1370 | } | | 1370 | } |
1371 | | | 1371 | |
1372 | kpm->pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | PG_V | PG_U; | | 1372 | kpm->pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | PG_V | PG_U; |
1373 | | | 1373 | |
1374 | tlbflushg(); | | 1374 | tlbflush(); |
1375 | | | 1375 | |
1376 | #else | | 1376 | #else |
1377 | if (VM_MIN_KERNEL_ADDRESS != KERNBASE) { | | 1377 | if (VM_MIN_KERNEL_ADDRESS != KERNBASE) { |
1378 | /* | | 1378 | /* |
1379 | * zero_pte is stuck at the end of mapped space for the kernel | | 1379 | * zero_pte is stuck at the end of mapped space for the kernel |
1380 | * image (disjunct from kva space). This is done so that it | | 1380 | * image (disjunct from kva space). This is done so that it |
1381 | * can safely be used in pmap_growkernel (pmap_get_physpage), | | 1381 | * can safely be used in pmap_growkernel (pmap_get_physpage), |
1382 | * when it's called for the first time. | | 1382 | * when it's called for the first time. |
1383 | * XXXfvdl fix this for MULTIPROCESSOR later. | | 1383 | * XXXfvdl fix this for MULTIPROCESSOR later. |
1384 | */ | | 1384 | */ |
1385 | | | 1385 | |
1386 | early_zerop = (void *)(KERNBASE + NKL2_KIMG_ENTRIES * NBPD_L2); | | 1386 | early_zerop = (void *)(KERNBASE + NKL2_KIMG_ENTRIES * NBPD_L2); |
1387 | early_zero_pte = PTE_BASE + pl1_i((vaddr_t)early_zerop); | | 1387 | early_zero_pte = PTE_BASE + pl1_i((vaddr_t)early_zerop); |