summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2008-06-21 19:19:09 +0000
committeralc <alc@FreeBSD.org>2008-06-21 19:19:09 +0000
commit2d03a1918bd34dbff4beaad25c10d8f46b01e562 (patch)
tree48d4f54e9fa63ce636020e1a526806a423c45d67
parent5af49a019f118fb653213ca9514286e6e0fc5b85 (diff)
downloadFreeBSD-src-2d03a1918bd34dbff4beaad25c10d8f46b01e562.zip
FreeBSD-src-2d03a1918bd34dbff4beaad25c10d8f46b01e562.tar.gz
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.
-rw-r--r--sys/amd64/amd64/pmap.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 9e8b257..2d33c2a 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -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 */
OpenPOWER on IntegriCloud