From 6b60fc318d17cdf095877da0b91fc6f2eb53c369 Mon Sep 17 00:00:00 2001 From: patrick Date: Fri, 29 Jul 2016 06:46:15 +0000 Subject: [PATCH] Only flush the virtual page if it was actually mapped. Otherwise we will run into translation faults. ok tom@ --- sys/arch/arm/arm/pmap7.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c index c3414325596..b616f6c18ee 100644 --- a/sys/arch/arm/arm/pmap7.c +++ b/sys/arch/arm/arm/pmap7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap7.c,v 1.28 2016/07/27 21:12:49 patrick Exp $ */ +/* $OpenBSD: pmap7.c,v 1.29 2016/07/29 06:46:15 patrick Exp $ */ /* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */ /* @@ -1132,7 +1132,7 @@ pmap_page_remove(struct vm_page *pg) struct l2_bucket *l2b; struct pv_entry *pv, *npv; pmap_t pm, curpm; - pt_entry_t *ptep, pte; + pt_entry_t *ptep; boolean_t flush; NPDEBUG(PDB_FOLLOW, @@ -1156,10 +1156,9 @@ pmap_page_remove(struct vm_page *pg) ptep = &l2b->l2b_kva[l2pte_index(pv->pv_va)]; if (*ptep != 0) { - pte = *ptep; - /* inline pmap_is_current(pm) */ - if (pm == curpm || pm == pmap_kernel()) { + if (l2pte_valid(*ptep) && + (pm == curpm || pm == pmap_kernel())) { if (PV_BEEN_EXECD(pv->pv_flags)) cpu_icache_sync_range(pv->pv_va, PAGE_SIZE); if (flush == FALSE) { -- 2.20.1