summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2005-06-10 03:33:36 +0000
committeralc <alc@FreeBSD.org>2005-06-10 03:33:36 +0000
commit2d109601cbaeb90e93aad0948a9367a78f196f9d (patch)
tree1fda0878f37dc5e54399f30ad5588c0876f46516 /sys/amd64
parent5273b0bf9faa803d4d586ba6d8c03c9d340e85c9 (diff)
downloadFreeBSD-src-2d109601cbaeb90e93aad0948a9367a78f196f9d.zip
FreeBSD-src-2d109601cbaeb90e93aad0948a9367a78f196f9d.tar.gz
Introduce a procedure, pmap_page_init(), that initializes the
vm_page's machine-dependent fields. Use this function in vm_pageq_add_new_page() so that the vm_page's machine-dependent and machine-independent fields are initialized at the same time. Remove code from pmap_init() for initializing the vm_page's machine-dependent fields. Remove stale comments from pmap_init(). Eliminate the Boolean variable pmap_initialized from the alpha, amd64, i386, and ia64 pmap implementations. Its use is no longer required because of the above changes and earlier changes that result in physical memory that is being mapped at initialization time being mapped without pv entries. Tested by: cognet, kensmith, marcel
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 3f8981e..507e09c 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -165,7 +165,6 @@ vm_paddr_t avail_start; /* PA of first available physical page */
vm_paddr_t avail_end; /* PA of last 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) */
-static boolean_t pmap_initialized = FALSE; /* Has pmap_init completed? */
static int nkpt;
static int ndmpdp;
@@ -531,29 +530,24 @@ pmap_bootstrap(firstaddr)
}
/*
+ * Initialize a vm_page's machine-dependent fields.
+ */
+void
+pmap_page_init(vm_page_t m)
+{
+
+ TAILQ_INIT(&m->md.pv_list);
+ m->md.pv_list_count = 0;
+}
+
+/*
* Initialize the pmap module.
* Called by vm_init, to initialize any structures that the pmap
* system needs to map virtual memory.
- * pmap_init has been enhanced to support in a fairly consistant
- * way, discontiguous physical memory.
*/
void
pmap_init(void)
{
- int i;
-
- /*
- * Allocate memory for random pmap data structures. Includes the
- * pv_head_table.
- */
-
- for(i = 0; i < vm_page_array_size; i++) {
- vm_page_t m;
-
- m = &vm_page_array[i];
- TAILQ_INIT(&m->md.pv_list);
- m->md.pv_list_count = 0;
- }
/*
* init the pv free list
@@ -561,11 +555,6 @@ pmap_init(void)
pvzone = uma_zcreate("PV ENTRY", sizeof (struct pv_entry), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE);
uma_prealloc(pvzone, MINPV);
-
- /*
- * Now it is safe to enable pv_table recording.
- */
- pmap_initialized = TRUE;
}
/*
@@ -1675,7 +1664,7 @@ pmap_remove_all(vm_page_t m)
/*
* XXX This makes pmap_remove_all() illegal for non-managed pages!
*/
- if (!pmap_initialized || (m->flags & PG_FICTITIOUS)) {
+ if (m->flags & PG_FICTITIOUS) {
panic("pmap_remove_all: illegal for unmanaged page, va: 0x%lx",
VM_PAGE_TO_PHYS(m));
}
@@ -1955,8 +1944,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
* raise IPL while manipulating pv_table since pmap_enter can be
* called at interrupt time.
*/
- if (pmap_initialized &&
- (m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) == 0) {
+ if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) {
pmap_insert_entry(pmap, va, m);
pa |= PG_MANAGED;
}
@@ -2449,7 +2437,7 @@ pmap_page_exists_quick(pmap, m)
pv_entry_t pv;
int loops = 0;
- if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
+ if (m->flags & PG_FICTITIOUS)
return FALSE;
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
@@ -2567,7 +2555,7 @@ pmap_is_modified(vm_page_t m)
boolean_t rv;
rv = FALSE;
- if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
+ if (m->flags & PG_FICTITIOUS)
return (rv);
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
@@ -2628,7 +2616,7 @@ pmap_clear_ptes(vm_page_t m, long bit)
register pv_entry_t pv;
pt_entry_t pbits, *pte;
- if (!pmap_initialized || (m->flags & PG_FICTITIOUS) ||
+ if ((m->flags & PG_FICTITIOUS) ||
(bit == PG_RW && (m->flags & PG_WRITEABLE) == 0))
return;
@@ -2713,7 +2701,7 @@ pmap_ts_referenced(vm_page_t m)
pt_entry_t v;
int rtval = 0;
- if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
+ if (m->flags & PG_FICTITIOUS)
return (rtval);
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
OpenPOWER on IntegriCloud