From e3842da22f28b41d10913e5899ff9312d8cc0fe4 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Wed, 20 Dec 2017 22:17:27 +0000 Subject: [PATCH] Allow pmap_kremove() to remove 1MB section mappings as well as 4K pages. This will allow it to undo temporary device mappings such as those made with pmap_preboot_map_attr(). Reviewed by: cognet --- sys/arm/arm/pmap-v6.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index 423c7dbba341..cc21d2f2c2ef 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -1310,10 +1310,16 @@ pmap_kenter(vm_offset_t va, vm_paddr_t pa) PMAP_INLINE void pmap_kremove(vm_offset_t va) { + pt1_entry_t *pte1p; pt2_entry_t *pte2p; - pte2p = pt2map_entry(va); - pte2_clear(pte2p); + pte1p = kern_pte1(va); + if (pte1_is_section(pte1_load(pte1p))) { + pte1_clear(pte1p); + } else { + pte2p = pt2map_entry(va); + pte2_clear(pte2p); + } } /*