summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i386/intel/pmap.c2
-rw-r--r--i386/intel/pmap.h7
2 files changed, 8 insertions, 1 deletions
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 86d2415..76055f8 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -831,7 +831,7 @@ void pmap_set_page_readonly_init(void *_vaddr) {
vm_offset_t vaddr = (vm_offset_t) _vaddr;
#if PAE
pt_entry_t *pdpbase = (void*) boot_info.pt_base;
- vm_offset_t dirbase = ptetokv(pdpbase[0]);
+ vm_offset_t dirbase = ptetokv(pdpbase[lin2pdpnum(vaddr)]);
#else
vm_offset_t dirbase = boot_info.pt_base;
#endif
diff --git a/i386/intel/pmap.h b/i386/intel/pmap.h
index e02ad36..11bca80 100644
--- a/i386/intel/pmap.h
+++ b/i386/intel/pmap.h
@@ -101,6 +101,13 @@ typedef unsigned int pt_entry_t;
#endif
/*
+ * Convert linear offset to page directory pointer index
+ */
+#if PAE
+#define lin2pdpnum(a) (((a) >> PDPSHIFT) & PDPMASK)
+#endif
+
+/*
* Convert page descriptor index to linear address
*/
#define pdenum2lin(a) ((vm_offset_t)(a) << PDESHIFT)