summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-02-11 20:40:33 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-02-11 20:40:33 +0000
commit759b3fa140febfdb14de299f1424aa00e3c602e6 (patch)
tree4b5afd1ba7db79688d2d7f9a0751a09116a76a54 /sys/arch
parent404f1dc875990e0ff79d51b87fd1348190ce5fc6 (diff)
A couple fixes:
- evict the memory from cache in pmap_page_free(). - make sure to sync cache in pmap_protect() if it marks a modified cacheable page as read-only.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mips64/mips64/pmap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c
index 7f007da9b42..7ba10cbefb4 100644
--- a/sys/arch/mips64/mips64/pmap.c
+++ b/sys/arch/mips64/mips64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.31 2008/01/15 19:44:50 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.32 2008/02/11 20:40:32 miod Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -345,7 +345,6 @@ pmap_destroy(pmap_t pmap)
panic("pmap_destroy: segmap not empty");
}
#endif
- Mips_HitInvalidateDCache((vaddr_t)pte, PAGE_SIZE);
pmap_page_free((vaddr_t)pte);
#ifdef PARANOIA
pmap->pm_segtab->seg_tab[i] = NULL;
@@ -573,6 +572,9 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
entry = *pte;
if (!(entry & PG_V))
continue;
+ if ((entry & PG_M) != 0 /* && p != PG_M */)
+ if ((entry & PG_CACHEMODE) == PG_CACHED)
+ Mips_HitSyncDCache(sva, PAGE_SIZE);
entry = (entry & ~(PG_M | PG_RO)) | p;
*pte = entry;
/*
@@ -607,6 +609,9 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
entry = *pte;
if (!(entry & PG_V))
continue;
+ if ((entry & PG_M) != 0 /* && p != PG_M */)
+ if ((entry & PG_CACHEMODE) == PG_CACHED)
+ Mips_SyncDCachePage(sva);
entry = (entry & ~(PG_M | PG_RO)) | p;
*pte = entry;
if (pmap->pm_tlbgen == tlbpid_gen)
@@ -1155,6 +1160,7 @@ pmap_page_free(vaddr_t va)
{
vm_page_t pg;
+ Mips_HitInvalidateDCache(va, PAGE_SIZE);
pg = PHYS_TO_VM_PAGE(XKPHYS_TO_PHYS(va));
uvm_pagefree(pg);
}