diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-04-16 11:14:27 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-04-16 11:14:27 +0000 |
commit | a611d42472835de53a9ca76984e0a6708d7f5b15 (patch) | |
tree | 8c5c4b817e7102b7b7c3f6cbc41287a26bbc13b2 /sys/arch | |
parent | 050b76eae02f1a86b57b8b6117e01e92768697bf (diff) |
Make enabling the BTI feature a per-pmap thing by storing the ATTR_GP bit
in a new pm_guarded member of struct pmap and using this member to add
the bits to the PTEs
ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm64/arm64/pmap.c | 7 | ||||
-rw-r--r-- | sys/arch/arm64/include/pmap.h | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c index 23bb1d2e436..038adcfca31 100644 --- a/sys/arch/arm64/arm64/pmap.c +++ b/sys/arch/arm64/arm64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.95 2023/04/13 15:23:22 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.96 2023/04/16 11:14:26 kettenis Exp $ */ /* * Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com> * @@ -1220,10 +1220,12 @@ pmap_bootstrap(long kvo, paddr_t lpt1, long kernelstart, long kernelend, vp1 = (struct pmapvp1 *)pt1pa; pmap_kernel()->pm_vp.l1 = (struct pmapvp1 *)va; pmap_kernel()->pm_privileged = 1; + pmap_kernel()->pm_guarded = ATTR_GP; pmap_kernel()->pm_asid = 0; pmap_tramp.pm_vp.l1 = (struct pmapvp1 *)va + 1; pmap_tramp.pm_privileged = 1; + pmap_tramp.pm_guarded = ATTR_GP; pmap_tramp.pm_asid = 0; /* Mark ASID 0 as in-use. */ @@ -1689,8 +1691,7 @@ pmap_pte_update(struct pte_desc *pted, uint64_t *pl3) access_bits = ap_bits_user[pted->pted_pte & PROT_MASK]; #ifndef SMALL_KERNEL - if (pm == pmap_kernel()) - access_bits |= ATTR_GP; + access_bits |= pm->pm_guarded; #endif pte = (pted->pted_pte & PTE_RPGN) | attr | access_bits | L3_P; diff --git a/sys/arch/arm64/include/pmap.h b/sys/arch/arm64/include/pmap.h index 89fa7cdd5e3..d61d9936c66 100644 --- a/sys/arch/arm64/include/pmap.h +++ b/sys/arch/arm64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.22 2023/02/16 20:32:39 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.23 2023/04/16 11:14:26 kettenis Exp $ */ /* * Copyright (c) 2008,2009,2014 Dale Rahn <drahn@dalerahn.com> * @@ -66,6 +66,7 @@ struct pmap { } pm_vp; uint64_t pm_pt0pa; uint64_t pm_asid; + uint64_t pm_guarded; int have_4_level_pt; int pm_privileged; int pm_refs; /* ref count */ |