summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-11-22 05:46:08 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-11-22 05:46:08 +0000
commit7815850270898a866fd8d581f696dc3ac46f3f5e (patch)
tree940a7099d011a06829d101173a137b2ce229c223 /sys/arch
parent87eb0efadd1a61e4eb4cb8047fede2761f8d64aa (diff)
Add an extra parameter to pmap_remove_pte() to control whether it will
flush tlbs or not. This is used by pmap_enter() to avoid flushing the same tlb entry twice.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/m88k/m88k/pmap.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index 7a73530dfa0..6c66bd1811a 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.37 2007/11/21 19:41:43 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.38 2007/11/22 05:46:07 miod Exp $ */
/*
* Copyright (c) 2001-2004, Miodrag Vallat
* Copyright (c) 1998-2001 Steve Murphree, Jr.
@@ -162,7 +162,7 @@ vaddr_t kmapva = 0;
*/
static void flush_atc_entry(pmap_t, vaddr_t);
pt_entry_t *pmap_expand_kmap(vaddr_t, vm_prot_t, int);
-void pmap_remove_pte(pmap_t, vaddr_t, pt_entry_t *);
+void pmap_remove_pte(pmap_t, vaddr_t, pt_entry_t *, boolean_t);
void pmap_remove_range(pmap_t, vaddr_t, vaddr_t);
void pmap_expand(pmap_t, vaddr_t);
void pmap_release(pmap_t);
@@ -1032,7 +1032,7 @@ pmap_reference(pmap_t pmap)
* its zone.
*/
void
-pmap_remove_pte(pmap_t pmap, vaddr_t va, pt_entry_t *pte)
+pmap_remove_pte(pmap_t pmap, vaddr_t va, pt_entry_t *pte, boolean_t flush)
{
pt_entry_t opte;
pv_entry_t prev, cur, pvl;
@@ -1041,7 +1041,7 @@ pmap_remove_pte(pmap_t pmap, vaddr_t va, pt_entry_t *pte)
#ifdef PMAPDEBUG
if (pmap_debug & CD_RM)
- printf("pmap_remove_pte(%p, %p)\n", pmap, va);
+ printf("pmap_remove_pte(%p, %p, %d)\n", pmap, va, flush);
#endif
if (pte == NULL || !PDT_VALID(pte)) {
@@ -1062,7 +1062,8 @@ pmap_remove_pte(pmap_t pmap, vaddr_t va, pt_entry_t *pte)
*/
opte = invalidate_pte(pte) & PG_M_U;
- flush_atc_entry(pmap, va);
+ if (flush)
+ flush_atc_entry(pmap, va);
pg = PHYS_TO_VM_PAGE(pa);
@@ -1173,7 +1174,8 @@ pmap_remove_range(pmap_t pmap, vaddr_t s, vaddr_t e)
va = eseg;
else {
while (va != eseg) {
- pmap_remove_pte(pmap, va, sdt_pte(sdt, va));
+ pmap_remove_pte(pmap, va, sdt_pte(sdt, va),
+ TRUE);
va += PAGE_SIZE;
}
}
@@ -1310,7 +1312,7 @@ remove_all_Retry:
goto next;
}
- pmap_remove_pte(pmap, va, pte);
+ pmap_remove_pte(pmap, va, pte, TRUE);
/*
* Do not free any page tables,
@@ -1633,7 +1635,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
pmap->pm_stats.wired_count--;
} else {
/* Remove old mapping from the PV list if necessary. */
- pmap_remove_pte(pmap, va, pte);
+ pmap_remove_pte(pmap, va, pte, FALSE);
if (pvl != NULL) {
/*
@@ -1642,7 +1644,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
*/
if (pvl->pv_pmap == NULL) {
/*
- * No mappings yet
+ * No mappings yet.
*/
pvl->pv_va = va;
pvl->pv_pmap = pmap;
@@ -1654,6 +1656,9 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
*/
pv_e = pool_get(&pvpool, PR_NOWAIT);
if (pv_e == NULL) {
+ /* Invalidate the old pte anyway */
+ flush_atc_entry(pmap, va);
+
if (flags & PMAP_CANFAIL) {
PMAP_UNLOCK(pmap);
splx(spl);