summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2006-04-27 21:26:25 +0000
committeralc <alc@FreeBSD.org>2006-04-27 21:26:25 +0000
commitda3edd51a268d79120d7ab1622016573776363f4 (patch)
treeb241b432af087e0c94c19127187fe9b0e0d1b0fd /sys
parent8bb256220b888d879867a5a28c33d7e58f9ba731 (diff)
downloadFreeBSD-src-da3edd51a268d79120d7ab1622016573776363f4.zip
FreeBSD-src-da3edd51a268d79120d7ab1622016573776363f4.tar.gz
In general, bits in the page directory entry (PDE) and the page table
entry (PTE) have the same meaning. The exception to this rule is the eighth bit (0x080). It is the PS bit in a PDE and the PAT bit in a PTE. This change avoids the possibility that pmap_enter() confuses a PAT bit with a PS bit, avoiding a panic(). Eliminate a diagnostic printf() from the i386 pmap_enter() that serves no current purpose, i.e., I've seen no bug reports in the last two years that are helped by this printf(). Reviewed by: jhb
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