Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 Check the virtual address 'va' for each PDI...
details: https://anonhg.NetBSD.org/src/rev/cc162997e9d8
branches: trunk
changeset: 756386:cc162997e9d8
user: jym <jym%NetBSD.org@localhost>
date: Thu Jul 15 21:14:31 2010 +0000
description:
Check the virtual address 'va' for each PDIR_SLOT_PTE entry. PDP_SIZE
is 4 with PAE (Xen only currently), 1 otherwise: loop should be unrolled
when PDP_SIZE is 1.
pmap_alloc_level() is used by pmap_growkernel(), the PDE is a kernel
mapping: mark it so with PG_k. While here, use pmap_pa2pte() for physical
address 'pa'.
No functional change.
diffstat:
sys/arch/x86/x86/pmap.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diffs (71 lines):
diff -r 679f92be5014 -r cc162997e9d8 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Thu Jul 15 20:04:14 2010 +0000
+++ b/sys/arch/x86/x86/pmap.c Thu Jul 15 21:14:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.111 2010/07/07 01:14:53 chs Exp $ */
+/* $NetBSD: pmap.c,v 1.112 2010/07/15 21:14:31 jym Exp $ */
/*
* Copyright (c) 2007 Manuel Bouyer.
@@ -149,7 +149,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2010/07/07 01:14:53 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.112 2010/07/15 21:14:31 jym Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -3405,6 +3405,7 @@
pd_entry_t * const *pdes;
struct pv_entry *pv_tofree = NULL;
bool result;
+ int i;
paddr_t ptppa;
vaddr_t blkendva, va = sva;
struct vm_page *ptp;
@@ -3470,9 +3471,11 @@
* be VM_MAX_ADDRESS.
*/
- if (pl_i(va, PTP_LEVELS) == PDIR_SLOT_PTE)
- /* XXXCDC: ugly hack to avoid freeing PDP here */
- continue;
+ /* XXXCDC: ugly hack to avoid freeing PDP here */
+ for (i = 0; i < PDP_SIZE; i++) {
+ if (pl_i(va, PTP_LEVELS) == PDIR_SLOT_PTE+i)
+ continue;
+ }
lvl = pmap_pdes_invalid(va, pdes, &pde);
if (lvl != 0) {
@@ -3829,6 +3832,7 @@
void
pmap_write_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
{
+ int i;
pt_entry_t *ptes, *epte;
pt_entry_t *spte;
pd_entry_t * const *pdes;
@@ -3861,8 +3865,10 @@
*/
/* XXXCDC: ugly hack to avoid freeing PDP here */
- if (pl_i(va, PTP_LEVELS) == PDIR_SLOT_PTE)
- continue;
+ for (i = 0; i < PDP_SIZE; i++) {
+ if (pl_i(va, PTP_LEVELS) == PDIR_SLOT_PTE+i)
+ continue;
+ }
/* empty block? */
if (!pmap_pdes_valid(va, pdes, NULL))
@@ -4282,7 +4288,7 @@
}
#endif
#else /* XEN */
- pdep[i] = pa | PG_RW | PG_V;
+ pdep[i] = pmap_pa2pte(pa) | PG_k | PG_V | PG_RW;
#endif /* XEN */
KASSERT(level != PTP_LEVELS || nkptp[level - 1] +
pl_i(VM_MIN_KERNEL_ADDRESS, level) == i);
Home |
Main Index |
Thread Index |
Old Index