From 421516f25e9cfa91b33841f633a463889bc10af7 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Wed, 12 Apr 2023 13:09:06 +0100 Subject: [PATCH] Create pmap_mask_set_locked on arm64 Create a locked version of pmap_mask_set. We will need this for BTI support. Sponsored by: Arm Ltd --- sys/arm64/arm64/pmap.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 2e5b2c23efd788..fc4650c8d449ae 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3837,14 +3837,14 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, pt_entry_t mask, * pmap and range */ static void -pmap_mask_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask, +pmap_mask_set_locked(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask, pt_entry_t nbits, bool invalidate) { vm_offset_t va, va_next; pd_entry_t *l0, *l1, *l2; pt_entry_t *l3p, l3; - PMAP_LOCK(pmap); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); for (; sva < eva; sva = va_next) { l0 = pmap_l0(pmap, sva); if (pmap_load(l0) == 0) { @@ -3938,6 +3938,14 @@ pmap_mask_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask, if (va != va_next && invalidate) pmap_s1_invalidate_range(pmap, va, sva, true); } +} + +static void +pmap_mask_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask, + pt_entry_t nbits, bool invalidate) +{ + PMAP_LOCK(pmap); + pmap_mask_set_locked(pmap, sva, eva, mask, nbits, invalidate); PMAP_UNLOCK(pmap); }