Prepare for a larger kernel virtual address space. Specifically, once

KERNBASE and VM_MIN_KERNEL_ADDRESS are no longer the same, the physical
memory allocated during bootstrap will be offset from the low-end of the
kernel's page table.
This commit is contained in:
Alan Cox 2008-06-21 19:19:09 +00:00
parent 80a6a0328a
commit 0ee1368a96
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179917

View File

@ -441,8 +441,10 @@ create_pagetables(vm_paddr_t *firstaddr)
/* Read-only from zero to physfree */
/* XXX not fully used, underneath 2M pages */
for (i = 0; (i << PAGE_SHIFT) < *firstaddr; i++) {
((pt_entry_t *)KPTphys)[i] = i << PAGE_SHIFT;
((pt_entry_t *)KPTphys)[i] |= PG_RW | PG_V | PG_G;
((pt_entry_t *)KPTphys)[(KERNBASE - VM_MIN_KERNEL_ADDRESS) /
PAGE_SIZE + i] = i << PAGE_SHIFT;
((pt_entry_t *)KPTphys)[(KERNBASE - VM_MIN_KERNEL_ADDRESS) /
PAGE_SIZE + i] |= PG_RW | PG_V | PG_G;
}
/* Now map the page tables at their location within PTmap */
@ -454,8 +456,10 @@ create_pagetables(vm_paddr_t *firstaddr)
/* Map from zero to end of allocations under 2M pages */
/* This replaces some of the KPTphys entries above */
for (i = 0; (i << PDRSHIFT) < *firstaddr; i++) {
((pd_entry_t *)KPDphys)[i] = i << PDRSHIFT;
((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G;
((pd_entry_t *)KPDphys)[(KERNBASE - VM_MIN_KERNEL_ADDRESS) /
NBPDR + i] = i << PDRSHIFT;
((pd_entry_t *)KPDphys)[(KERNBASE - VM_MIN_KERNEL_ADDRESS) /
NBPDR + i] |= PG_RW | PG_V | PG_PS | PG_G;
}
/* And connect up the PD to the PDP */