summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2007-03-10 20:26:43 +0000
committeralc <alc@FreeBSD.org>2007-03-10 20:26:43 +0000
commit793fdbb540e122ab8bbaf14cdf4f1e363b388302 (patch)
tree853667e99b7a21be347c0b7f9346c0f86137a809 /sys
parent784667db7cf9e29287bdcbb546009d7fa3db7d84 (diff)
downloadFreeBSD-src-793fdbb540e122ab8bbaf14cdf4f1e363b388302.zip
FreeBSD-src-793fdbb540e122ab8bbaf14cdf4f1e363b388302.tar.gz
Completely eliminate "avail_start". It serves no useful purpose.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/pmap.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 6897299..8719cad 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -168,7 +168,6 @@ __FBSDID("$FreeBSD$");
struct pmap kernel_pmap_store;
-static vm_paddr_t avail_start; /* PA of first available physical page */
vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */
vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
@@ -396,38 +395,38 @@ vtopde(vm_offset_t va)
}
static u_int64_t
-allocpages(int n)
+allocpages(vm_paddr_t *firstaddr, int n)
{
u_int64_t ret;
- ret = avail_start;
+ ret = *firstaddr;
bzero((void *)ret, n * PAGE_SIZE);
- avail_start += n * PAGE_SIZE;
+ *firstaddr += n * PAGE_SIZE;
return (ret);
}
static void
-create_pagetables(void)
+create_pagetables(vm_paddr_t *firstaddr)
{
int i;
/* Allocate pages */
- KPTphys = allocpages(NKPT);
- KPML4phys = allocpages(1);
- KPDPphys = allocpages(NKPML4E);
- KPDphys = allocpages(NKPDPE);
+ KPTphys = allocpages(firstaddr, NKPT);
+ KPML4phys = allocpages(firstaddr, 1);
+ KPDPphys = allocpages(firstaddr, NKPML4E);
+ KPDphys = allocpages(firstaddr, NKPDPE);
ndmpdp = (ptoa(Maxmem) + NBPDP - 1) >> PDPSHIFT;
if (ndmpdp < 4) /* Minimum 4GB of dirmap */
ndmpdp = 4;
- DMPDPphys = allocpages(NDMPML4E);
- DMPDphys = allocpages(ndmpdp);
+ DMPDPphys = allocpages(firstaddr, NDMPML4E);
+ DMPDphys = allocpages(firstaddr, ndmpdp);
dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT;
/* Fill in the underlying page table pages */
/* Read-only from zero to physfree */
/* XXX not fully used, underneath 2M pages */
- for (i = 0; (i << PAGE_SHIFT) < avail_start; i++) {
+ 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;
}
@@ -440,7 +439,7 @@ create_pagetables(void)
/* Map from zero to end of allocations under 2M pages */
/* This replaces some of the KPTphys entries above */
- for (i = 0; (i << PDRSHIFT) < avail_start; i++) {
+ 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;
}
@@ -493,15 +492,12 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
vm_offset_t va;
pt_entry_t *pte, *unused;
- avail_start = *firstaddr;
-
/*
* Create an initial set of page tables to run the kernel in.
*/
- create_pagetables();
- *firstaddr = avail_start;
+ create_pagetables(firstaddr);
- virtual_avail = (vm_offset_t) KERNBASE + avail_start;
+ virtual_avail = (vm_offset_t) KERNBASE + *firstaddr;
virtual_avail = pmap_kmem_choose(virtual_avail);
virtual_end = VM_MAX_KERNEL_ADDRESS;
OpenPOWER on IntegriCloud