summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/pmap.c12
-rw-r--r--sys/i386/i386/pmap.c14
2 files changed, 12 insertions, 14 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 5a923b2..da7d300 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -2061,6 +2061,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
boolean_t wired)
{
vm_paddr_t pa;
+ pd_entry_t *pde;
register pt_entry_t *pte;
vm_paddr_t opa;
pt_entry_t origpte, newpte;
@@ -2098,7 +2099,13 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
}
#endif
- pte = pmap_pte(pmap, va);
+ pde = pmap_pde(pmap, va);
+ if (pde != NULL) {
+ if ((*pde & PG_PS) != 0)
+ panic("pmap_enter: attempted pmap_enter on 2MB page");
+ pte = pmap_pde_to_pte(pde, va);
+ } else
+ pte = NULL;
/*
* Page Directory table entry not valid, we need a new PT page
@@ -2111,9 +2118,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
origpte = *pte;
opa = origpte & PG_FRAME;
- if (origpte & PG_PS)
- panic("pmap_enter: attempted pmap_enter on 2MB page");
-
/*
* Mapping has not changed, must be protection or wiring change.
*/
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index ca9525b..a69c09e 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -2090,6 +2090,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
boolean_t wired)
{
vm_paddr_t pa;
+ pd_entry_t *pde;
register pt_entry_t *pte;
vm_paddr_t opa;
pt_entry_t origpte, newpte;
@@ -2128,6 +2129,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
}
#endif
+ pde = pmap_pde(pmap, va);
+ if ((*pde & PG_PS) != 0)
+ panic("pmap_enter: attempted pmap_enter on 4MB page");
pte = pmap_pte_quick(pmap, va);
/*
@@ -2143,16 +2147,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
origpte = *pte;
opa = origpte & PG_FRAME;
- if (origpte & PG_PS) {
- /*
- * Yes, I know this will truncate upper address bits for PAE,
- * but I'm actually more interested in the lower bits
- */
- printf("pmap_enter: va %p, pte %p, origpte %p\n",
- (void *)va, (void *)pte, (void *)(uintptr_t)origpte);
- panic("pmap_enter: attempted pmap_enter on 4MB page");
- }
-
/*
* Mapping has not changed, must be protection or wiring change.
*/
OpenPOWER on IntegriCloud