summaryrefslogtreecommitdiff
path: root/lib/aarch64/misc_helpers.S
diff options
context:
space:
mode:
Diffstat (limited to 'lib/aarch64/misc_helpers.S')
-rw-r--r--lib/aarch64/misc_helpers.S20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/aarch64/misc_helpers.S b/lib/aarch64/misc_helpers.S
index f605bf4..672d269 100644
--- a/lib/aarch64/misc_helpers.S
+++ b/lib/aarch64/misc_helpers.S
@@ -45,6 +45,7 @@
#if SUPPORT_VFP
.globl enable_vfp
+ .globl disable_fp_traps
#endif
func get_afflvl_shift
@@ -67,7 +68,6 @@ func mpidr_mask_lower_afflvls
func eret
eret
-
func smc
smc #0
@@ -169,4 +169,22 @@ func enable_vfp
msr cptr_el3, x0
isb
ret
+
+func disable_fp_traps
+ JUMP_EL1_OR_EL2 x0, _disable_fp_traps_el1, _disable_fp_traps_el2
+_disable_fp_traps_el1:
+ /* Read EL1 Coprocessor Access Control Register (CPACR) */
+ mrs x0, cpacr_el1
+ /* Disable trapping of instructions accessing FP regs */
+ orr x0, x0, #CPACR_EL1_FPEN(3)
+ /* Write back EL1 Coprocessor Access Control Register (CPACR) */
+ msr cpacr_el1, x0
+ ret
+_disable_fp_traps_el2:
+ mrs x0, cptr_el2
+ mov x1, #TFP_BIT
+ bic x0, x0, x1
+ msr cptr_el2, x0
+ ret
+
#endif