Introduce a new function, pmap_wb_page(), which check all userland mappings for

a given page and, if the pmap is the current pmap, write back the associated
cache line.
Use pmap_wb_page in pmap_qenter() instead of inconditionally
write back/invalidating the data cache.
This commit is contained in:
Olivier Houchard 2005-03-16 23:56:29 +00:00
parent d32c3b7dce
commit 2eeafe13a6

View File

@ -2896,6 +2896,15 @@ pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot)
return (sva); return (sva);
} }
static void
pmap_wb_page(vm_page_t m)
{
struct pv_entry *pv;
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list)
pmap_dcache_wb_range(pv->pv_pmap, pv->pv_va, PAGE_SIZE, FALSE,
(pv->pv_flags & PVF_WRITE) == 0);
}
/* /*
* Add a list of wired pages to the kva * Add a list of wired pages to the kva
@ -2911,11 +2920,11 @@ pmap_qenter(vm_offset_t va, vm_page_t *m, int count)
int i; int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
pmap_wb_page(m[i]);
pmap_kenter_internal(va, VM_PAGE_TO_PHYS(m[i]), pmap_kenter_internal(va, VM_PAGE_TO_PHYS(m[i]),
KENTER_CACHE); KENTER_CACHE);
va += PAGE_SIZE; va += PAGE_SIZE;
} }
cpu_dcache_wbinv_all(); /* XXX: shouldn't be needed */
} }