[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 25/25] target/arm: Fix Secure PL1 tests in fp_exception_el
From: |
Richard Henderson |
Subject: |
[PATCH v2 25/25] target/arm: Fix Secure PL1 tests in fp_exception_el |
Date: |
Mon, 6 Jun 2022 19:47:34 -0700 |
We were using arm_is_secure and is_a64, which are
tests against the current EL, as opposed to
arm_el_is_aa64 and arm_is_secure_below_el3, which
can be applied to a different EL than current.
Consolidate the two tests.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/helper.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index eeca1a5dc8..1d81a01c94 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -13400,27 +13400,22 @@ int fp_exception_el(CPUARMState *env, int cur_el)
int fpen = FIELD_EX64(env->cp15.cpacr_el1, CPACR_EL1, FPEN);
switch (fpen) {
+ case 1:
+ if (cur_el != 0) {
+ break;
+ }
+ /* fall through */
case 0:
case 2:
- if (cur_el == 0 || cur_el == 1) {
- /* Trap to PL1, which might be EL1 or EL3 */
- if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) {
- return 3;
- }
- return 1;
- }
- if (cur_el == 3 && !is_a64(env)) {
- /* Secure PL1 running at EL3 */
+ /* Trap from Secure PL0 or PL1 to Secure PL1. */
+ if (!arm_el_is_aa64(env, 3)
+ && (cur_el == 3 || arm_is_secure_below_el3(env))) {
return 3;
}
- break;
- case 1:
- if (cur_el == 0) {
+ if (cur_el <= 1) {
return 1;
}
break;
- case 3:
- break;
}
}
--
2.34.1
- [PATCH v2 16/25] target/arm: Move gen_exception to translate.c, (continued)
- [PATCH v2 16/25] target/arm: Move gen_exception to translate.c, Richard Henderson, 2022/06/06
- [PATCH v2 18/25] target/arm: Introduce gen_exception, Richard Henderson, 2022/06/06
- [PATCH v2 22/25] target/arm: Create raise_exception_debug, Richard Henderson, 2022/06/06
- [PATCH v2 20/25] target/arm: Introduce helper_exception_with_syndrome, Richard Henderson, 2022/06/06
- [PATCH v2 23/25] target/arm: Move arm_debug_target_el to debug_helper.c, Richard Henderson, 2022/06/06
- [PATCH v2 25/25] target/arm: Fix Secure PL1 tests in fp_exception_el,
Richard Henderson <=
- [PATCH v2 19/25] target/arm: Introduce gen_exception_el_v, Richard Henderson, 2022/06/06
- [PATCH v2 21/25] target/arm: Remove default_exception_el, Richard Henderson, 2022/06/06
- [PATCH v2 24/25] target/arm: Rearrange Secure PL1 test in arm_debug_target_el, Richard Henderson, 2022/06/06