summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexei Fedorov <Alexei.Fedorov@arm.com>2020-01-08 14:02:18 +0000
committerAlexei Fedorov <Alexei.Fedorov@arm.com>2020-01-08 14:02:18 +0000
commit52fd7337cde13d945dfb2f5b90b89bd76772fe9c (patch)
treed97d286bf69bb900dfffd886fc7b827de65fa16e /lib
parent584b3cb3aba5423c31496a4f46ea6a58e44dd7d9 (diff)
TFTF: Enable ARMv8.3-PAuth in FWU tests.
This patch adds ARMv8.3-PAuth support for FWU tests. Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Change-Id: I36a0a2a3870db51cda0a09bd8fd8004e2d01d2bc
Diffstat (limited to 'lib')
-rw-r--r--lib/extensions/pauth/aarch64/pauth_helpers.S27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/extensions/pauth/aarch64/pauth_helpers.S b/lib/extensions/pauth/aarch64/pauth_helpers.S
index e15cac9..88ef9f5 100644
--- a/lib/extensions/pauth/aarch64/pauth_helpers.S
+++ b/lib/extensions/pauth/aarch64/pauth_helpers.S
@@ -8,6 +8,7 @@
#include <asm_macros.S>
.global pauth_init_enable
+ .global pauth_disable
/* -----------------------------------------------------------
* Program APIAKey_EL1 key and enable Pointer Authentication
@@ -51,3 +52,29 @@ enable_exit:
ldp x29, x30, [sp], #16
ret
endfunc pauth_init_enable
+
+/* -----------------------------------------------------------
+ * Disable pointer authentication in EL1/EL2
+ * -----------------------------------------------------------
+ */
+func pauth_disable
+ /* Detect Current Exception level */
+ mrs x0, CurrentEL
+ cmp x0, #(MODE_EL1 << MODE_EL_SHIFT)
+ b.eq disable_el1
+
+ /* Disable EL2 pointer authentication */
+ mrs x0, sctlr_el2
+ bic x0, x0, #SCTLR_EnIA_BIT
+ msr sctlr_el2, x0
+ isb
+ ret
+
+ /* Disable EL1 pointer authentication */
+disable_el1:
+ mrs x0, sctlr_el1
+ bic x0, x0, #SCTLR_EnIA_BIT
+ msr sctlr_el1, x0
+ isb
+ ret
+endfunc pauth_disable