aboutsummaryrefslogtreecommitdiff
path: root/i386/intel/pmap.h
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-22 13:33:05 +0200
committerJustus Winter <justus@gnupg.org>2016-11-01 12:10:55 +0100
commit65553178d1222b3291143bdddfef9478e0b09021 (patch)
tree18c24a5ed0933fa71b17948d3822fcf7cd66a55f /i386/intel/pmap.h
parentc8e687cb8a6ba8f278c58bf78126f843ceb292bb (diff)
downloadgnumach-65553178d1222b3291143bdddfef9478e0b09021.tar.gz
gnumach-65553178d1222b3291143bdddfef9478e0b09021.tar.bz2
gnumach-65553178d1222b3291143bdddfef9478e0b09021.zip
i386: Use discontiguous page directories when using PAE.
Previously, we used contiguous page directories four pages in length when using PAE. To prevent physical memory fragmentation, we need to use virtual memory for objects spanning multiple pages. Virtual kernel memory, however, is a scarce commodity. * i386/intel/pmap.h (lin2pdenum): Never include the page directory pointer table index. (lin2pdenum_cont): New macro which does include said index. (struct pmap): Remove the directory base pointer when using PAE. * i386/intel/pmap.c (pmap_pde): Fix lookup. (pmap_pte): Fix check for uninitialized pmap. (pmap_bootstrap): Do not store the page directory base if PAE. (pmap_init): Reduce size of page directories to one page, use direct-mapped memory. (pmap_create): Allocate four page directories per pmap. (pmap_destroy): Adapt to the discontinuous directories. (pmap_collect): Likewise. * i386/i386/xen.h (hyp_mmu_update_la): Adapt code manipulating the kernels page directory. * i386/i386at/model_dep.c (i386at_init): Likewise.
Diffstat (limited to 'i386/intel/pmap.h')
-rw-r--r--i386/intel/pmap.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/i386/intel/pmap.h b/i386/intel/pmap.h
index e6a3ede8..ee600cd5 100644
--- a/i386/intel/pmap.h
+++ b/i386/intel/pmap.h
@@ -89,11 +89,14 @@ typedef phys_addr_t pt_entry_t;
/*
* Convert linear offset to page descriptor index
*/
+#define lin2pdenum(a) (((a) >> PDESHIFT) & PDEMASK)
+
#if PAE
-/* Making it include the page directory pointer table index too */
-#define lin2pdenum(a) (((a) >> PDESHIFT) & 0x7ff)
+/* Special version assuming contiguous page directories. Making it
+ include the page directory pointer table index too. */
+#define lin2pdenum_cont(a) (((a) >> PDESHIFT) & 0x7ff)
#else
-#define lin2pdenum(a) (((a) >> PDESHIFT) & PDEMASK)
+#define lin2pdenum_cont(a) lin2pdenum(a)
#endif
/*
@@ -159,10 +162,11 @@ typedef volatile long cpu_set; /* set of CPUs - must be <= 32 */
/* changed by other processors */
struct pmap {
+#if ! PAE
pt_entry_t *dirbase; /* page directory table */
-#if PAE
+#else
pt_entry_t *pdpbase; /* page directory pointer table */
-#endif /* PAE */
+#endif /* ! PAE */
int ref_count; /* reference count */
decl_simple_lock_data(,lock)
/* lock on map */