arch-arm: Introduce HavePACExt helper
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 25 Aug 2020 11:15:17 +0000 (12:15 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 28 Aug 2020 09:40:21 +0000 (09:40 +0000)
This will check for presence of pointer authentication extension.
According to the reference manual, Pointer authentication is
implemented if the value of at least one of

ID_AA64ISAR1_EL1.{APA, API, GPA, GPI}

is not 0b0000.

Change-Id: I4e98e65758e8edc953794e5b618d2c6c3f6000ae
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33454
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/utility.cc
src/arch/arm/utility.hh

index ad0a3da3f2a9d37712e2601d9ba5aba80deb7cdc..a189c4aa954d61fcb18174819e5a863ca6462a63 100644 (file)
@@ -314,6 +314,14 @@ getAffinity(ArmSystem *arm_sys, ThreadContext *tc)
     return getAff2(arm_sys, tc) | getAff1(arm_sys, tc) | getAff0(arm_sys, tc);
 }
 
+bool
+HavePACExt(ThreadContext *tc)
+{
+    AA64ISAR1 id_aa64isar1 = tc->readMiscReg(MISCREG_ID_AA64ISAR1_EL1);
+    return id_aa64isar1.api | id_aa64isar1.apa |
+        id_aa64isar1.gpi | id_aa64isar1.gpa;
+}
+
 bool
 HaveVirtHostExt(ThreadContext *tc)
 {
index f00f606ed885082ea4e69108a556b651c72a81ae..f17ebc5f9d7a6f30f2bf6081e0a70209171f57ae 100644 (file)
@@ -151,6 +151,7 @@ currEL(CPSR cpsr)
     return opModeToEL((OperatingMode) (uint8_t)cpsr.mode);
 }
 
+bool HavePACExt(ThreadContext *tc);
 bool HaveVirtHostExt(ThreadContext *tc);
 bool HaveSecureEL2Ext(ThreadContext *tc);
 bool IsSecureEL2Enabled(ThreadContext *tc);