Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 - make AP{IB,DA,DB}Key are also ena...



details:   https://anonhg.NetBSD.org/src/rev/62bf1999eebb
branches:  trunk
changeset: 1010535:62bf1999eebb
user:      ryo <ryo%NetBSD.org@localhost>
date:      Thu May 28 04:51:44 2020 +0000

description:
- make AP{IB,DA,DB}Key are also enabled when ARMV83_PAC.
- If no ARMV83_PAC, clearly disable SCTLR_En{IA,IB,DA,DB}

diffstat:

 sys/arch/aarch64/aarch64/genassym.cf |   5 ++++-
 sys/arch/aarch64/aarch64/locore.S    |  19 +++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diffs (80 lines):

diff -r 06ab7603faa6 -r 62bf1999eebb sys/arch/aarch64/aarch64/genassym.cf
--- a/sys/arch/aarch64/aarch64/genassym.cf      Wed May 27 23:52:19 2020 +0000
+++ b/sys/arch/aarch64/aarch64/genassym.cf      Thu May 28 04:51:44 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.25 2020/05/23 18:08:59 ryo Exp $
+# $NetBSD: genassym.cf,v 1.26 2020/05/28 04:51:44 ryo Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -368,6 +368,9 @@
 define SCTLR_nTLSMD            SCTLR_nTLSMD
 define SCTLR_LSMAOE            SCTLR_LSMAOE
 define SCTLR_EnIA              SCTLR_EnIA
+define SCTLR_EnIB              SCTLR_EnIB
+define SCTLR_EnDA              SCTLR_EnDA
+define SCTLR_EnDB              SCTLR_EnDB
 
 define ICC_SRE_EL2_EN          ICC_SRE_EL2_EN
 define ICC_SRE_EL2_SRE         ICC_SRE_EL2_SRE
diff -r 06ab7603faa6 -r 62bf1999eebb sys/arch/aarch64/aarch64/locore.S
--- a/sys/arch/aarch64/aarch64/locore.S Wed May 27 23:52:19 2020 +0000
+++ b/sys/arch/aarch64/aarch64/locore.S Thu May 28 04:51:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.63 2020/05/27 19:49:37 ryo Exp $  */
+/*     $NetBSD: locore.S,v 1.64 2020/05/28 04:51:44 ryo Exp $  */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -38,7 +38,7 @@
 #include <aarch64/hypervisor.h>
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.63 2020/05/27 19:49:37 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.64 2020/05/28 04:51:44 ryo Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define        MAIR_DEVICE_MEM         MAIR_DEVICE_nGnRnE
@@ -183,7 +183,8 @@
        bl      aarch64_pac_init
        cbnz    w0, 1f                  /* if (aarch64_pac_init() == 0) */
        mrs     x0, sctlr_el1
-       orr     x0, x0, #SCTLR_EnIA     /*  enable PAC */
+       ldr     x1, sctlr_pac
+       orr     x0, x0, x1              /*  enable PAC */
        msr     sctlr_el1, x0
 1:
 
@@ -517,7 +518,8 @@
        bl      aarch64_pac_init
        cbnz    w0, 1f                  /* if (aarch64_pac_init() == 0) */
        mrs     x0, sctlr_el1
-       orr     x0, x0, #SCTLR_EnIA     /*  enable PAC */
+       ldr     x1, sctlr_pac
+       orr     x0, x0, x1              /*  enable PAC */
        msr     sctlr_el1, x0
 1:
 
@@ -956,6 +958,8 @@
        mrs     x0, sctlr_el1
        ldr     x1, sctlr_clear
        bic     x0, x0, x1
+       ldr     x1, sctlr_pac   /* disable PAC */
+       bic     x0, x0, x1
        ldr     x1, sctlr_set
        orr     x0, x0, x1
 
@@ -1051,6 +1055,13 @@
            SCTLR_SA |      /* Enable SP alignment check */ \
            SCTLR_A |       /* Alignment check enable */ \
            0)
+sctlr_pac:
+       .quad ( \
+           SCTLR_EnIA |    /* PACIA (APIAKey_EL1) instruction enable */ \
+           SCTLR_EnIB |    /* PACIB (APIBKey_EL1) instruction enable */ \
+           SCTLR_EnDA |    /* PACDA (APDAKey_EL1) instruction enable */ \
+           SCTLR_EnDB |    /* PACDB (APDBKey_EL1) instruction enable */ \
+           0)
 
 mdscr_setting:
        .quad ( \



Home | Main Index | Thread Index | Old Index