diff options
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/pmap.c | 15 | ||||
-rw-r--r-- | sys/i386/include/vmparam.h | 8 |
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index c9bff6b..3bd44d9 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -133,6 +133,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_extern.h> #include <vm/vm_pageout.h> #include <vm/vm_pager.h> +#include <vm/vm_phys.h> #include <vm/vm_radix.h> #include <vm/vm_reserv.h> #include <vm/uma.h> @@ -374,6 +375,15 @@ pmap_bootstrap(vm_paddr_t firstaddr) int i; /* + * Add a physical memory segment (vm_phys_seg) corresponding to the + * preallocated kernel page table pages so that vm_page structures + * representing these pages will be created. The vm_page structures + * are required for promotion of the corresponding kernel virtual + * addresses to superpage mappings. + */ + vm_phys_add_seg(KPTphys, KPTphys + ptoa(nkpt)); + + /* * Initialize the first available kernel virtual address. However, * using "firstaddr" may waste a few pages of the kernel virtual * address space, because locore may not have mapped every physical @@ -778,9 +788,10 @@ pmap_init(void) /* * Calculate the size of the pv head table for superpages. + * Handle the possibility that "vm_phys_segs[...].end" is zero. */ - for (i = 0; phys_avail[i + 1]; i += 2); - pv_npg = round_4mpage(phys_avail[(i - 2) + 1]) / NBPDR; + pv_npg = trunc_4mpage(vm_phys_segs[vm_phys_nsegs - 1].end - + PAGE_SIZE) / NBPDR + 1; /* * Allocate memory for the pv head table for superpages. diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index c086d76..9a0dfd8 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -64,9 +64,15 @@ #endif /* - * The physical address space is densely populated. + * Choose between DENSE and SPARSE based on whether lower execution time or + * lower kernel address space consumption is desired. Under PAE, kernel + * address space is often in short supply. */ +#ifdef PAE +#define VM_PHYSSEG_SPARSE +#else #define VM_PHYSSEG_DENSE +#endif /* * The number of PHYSSEG entries must be one greater than the number |