From 6d15745532df2dd306ecc15bd0e9f79914be1682 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Tue, 25 Aug 2020 12:15:17 +0100 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33454 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg Tested-by: kokoro --- src/arch/arm/utility.cc | 8 ++++++++ src/arch/arm/utility.hh | 1 + 2 files changed, 9 insertions(+) diff --git a/src/arch/arm/utility.cc b/src/arch/arm/utility.cc index ad0a3da3f..a189c4aa9 100644 --- a/src/arch/arm/utility.cc +++ b/src/arch/arm/utility.cc @@ -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) { diff --git a/src/arch/arm/utility.hh b/src/arch/arm/utility.hh index f00f606ed..f17ebc5f9 100644 --- a/src/arch/arm/utility.hh +++ b/src/arch/arm/utility.hh @@ -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); -- 2.30.2