diff options
author | Soby Mathew <soby.mathew@arm.com> | 2019-10-03 16:22:41 +0000 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2019-10-03 16:22:41 +0000 |
commit | cf9319f46a1dd17c842297a8aeb68059f6f3a06f (patch) | |
tree | cee2a7e8a5904cda825ffb7d9b11ec97086d2c11 /lib | |
parent | 8326aad7be972a66e6fbcc4b1128929fec0cb242 (diff) | |
parent | 530ceda57288aa931d0c8ba7b3066340d587cc9b (diff) |
Merge "TF-A: Add support for ARMv8.3-PAuth in BL1 SMC calls and BL2U" into integration
Diffstat (limited to 'lib')
-rw-r--r-- | lib/extensions/pauth/pauth_helpers.S | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/extensions/pauth/pauth_helpers.S b/lib/extensions/pauth/pauth_helpers.S index c6808de5..d483c7df 100644 --- a/lib/extensions/pauth/pauth_helpers.S +++ b/lib/extensions/pauth/pauth_helpers.S @@ -13,6 +13,7 @@ .global pauth_init_enable_el3 .global pauth_disable_el3 .globl pauth_load_bl31_apiakey + .globl pauth_load_bl1_apiakey_enable /* ------------------------------------------------------------- * Program APIAKey_EL1 and enable pointer authentication in EL1 @@ -97,9 +98,9 @@ func pauth_disable_el3 endfunc pauth_disable_el3 /* ------------------------------------------------------------- - * The following function strictly follows the AArch64 PCS + * The following functions strictly follow the AArch64 PCS * to use x9-x17 (temporary caller-saved registers) to load - * the APIAKey_EL1 used by the firmware. + * the APIAKey_EL1 and enable pointer authentication. * ------------------------------------------------------------- */ func pauth_load_bl31_apiakey @@ -115,3 +116,26 @@ func pauth_load_bl31_apiakey isb ret endfunc pauth_load_bl31_apiakey + +func pauth_load_bl1_apiakey_enable + /* Load instruction key A used by the Trusted Firmware */ + adrp x9, bl1_apiakey + add x9, x9, :lo12:bl1_apiakey + ldp x10, x11, [x9] + + /* Program instruction key A */ + msr APIAKeyLo_EL1, x10 + msr APIAKeyHi_EL1, x11 + + /* Enable pointer authentication */ + mrs x9, sctlr_el3 + orr x9, x9, #SCTLR_EnIA_BIT + +#if ENABLE_BTI + /* Enable PAC branch type compatibility */ + bic x9, x9, #SCTLR_BT_BIT +#endif + msr sctlr_el3, x9 + isb + ret +endfunc pauth_load_bl1_apiakey_enable |