arch-arm: Introduce HavePACExt helper

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>
diff --git a/src/arch/arm/utility.cc b/src/arch/arm/utility.cc
index ad0a3da..a189c4a 100644
--- a/src/arch/arm/utility.cc
+++ b/src/arch/arm/utility.cc
@@ -315,6 +315,14 @@
 }
 
 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)
 {
     AA64MMFR1 id_aa64mmfr1 = tc->readMiscReg(MISCREG_ID_AA64MMFR1_EL1);
diff --git a/src/arch/arm/utility.hh b/src/arch/arm/utility.hh
index f00f606..f17ebc5 100644
--- a/src/arch/arm/utility.hh
+++ b/src/arch/arm/utility.hh
@@ -151,6 +151,7 @@
     return opModeToEL((OperatingMode) (uint8_t)cpsr.mode);
 }
 
+bool HavePACExt(ThreadContext *tc);
 bool HaveVirtHostExt(ThreadContext *tc);
 bool HaveSecureEL2Ext(ThreadContext *tc);
 bool IsSecureEL2Enabled(ThreadContext *tc);