[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/18] target/arm: Allow raise_exception to handle finding target
From: |
Richard Henderson |
Subject: |
[PATCH 01/18] target/arm: Allow raise_exception to handle finding target EL |
Date: |
Mon, 23 May 2022 13:47:25 -0700 |
The work of finding the correct target EL for an exception is
currently split between raise_exception and target_exception_el.
Begin merging these by allowing the input to raise_exception
to be zero and use exception_target_el for that case.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/internals.h | 11 ++++++-----
target/arm/op_helper.c | 13 +++++++++----
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/target/arm/internals.h b/target/arm/internals.h
index b654bee468..03363b0f32 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -111,18 +111,19 @@ FIELD(DBGWCR, SSCE, 29, 1)
/**
* raise_exception: Raise the specified exception.
* Raise a guest exception with the specified value, syndrome register
- * and target exception level. This should be called from helper functions,
- * and never returns because we will longjump back up to the CPU main loop.
+ * and the current or target exception level. This should be called from
+ * helper functions, and never returns because we will longjump back up
+ * to the CPU main loop.
*/
G_NORETURN void raise_exception(CPUARMState *env, uint32_t excp,
- uint32_t syndrome, uint32_t target_el);
+ uint32_t syndrome, uint32_t cur_or_target_el);
/*
* Similarly, but also use unwinding to restore cpu state.
*/
G_NORETURN void raise_exception_ra(CPUARMState *env, uint32_t excp,
- uint32_t syndrome, uint32_t target_el,
- uintptr_t ra);
+ uint32_t syndrome,
+ uint32_t cur_or_target_el, uintptr_t ra);
/*
* For AArch64, map a given EL to an index in the banked_spsr array.
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
index c4bd668870..6b9141b79a 100644
--- a/target/arm/op_helper.c
+++ b/target/arm/op_helper.c
@@ -28,10 +28,15 @@
#define SIGNBIT (uint32_t)0x80000000
#define SIGNBIT64 ((uint64_t)1 << 63)
-void raise_exception(CPUARMState *env, uint32_t excp,
- uint32_t syndrome, uint32_t target_el)
+void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome,
+ uint32_t cur_or_target_el)
{
CPUState *cs = env_cpu(env);
+ int target_el = cur_or_target_el;
+
+ if (cur_or_target_el == 0) {
+ target_el = exception_target_el(env);
+ }
if (target_el == 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) {
/*
@@ -54,7 +59,7 @@ void raise_exception(CPUARMState *env, uint32_t excp,
}
void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
- uint32_t target_el, uintptr_t ra)
+ uint32_t cur_or_target_el, uintptr_t ra)
{
CPUState *cs = env_cpu(env);
@@ -64,7 +69,7 @@ void raise_exception_ra(CPUARMState *env, uint32_t excp,
uint32_t syndrome,
* the caller passed us, and cannot use cpu_loop_exit_restore().
*/
cpu_restore_state(cs, ra, true);
- raise_exception(env, excp, syndrome, target_el);
+ raise_exception(env, excp, syndrome, cur_or_target_el);
}
uint64_t HELPER(neon_tbl)(CPUARMState *env, uint32_t desc,
--
2.34.1
[PATCH 02/18] target/arm: Use arm_current_el for simple exceptions, Richard Henderson, 2022/05/23
[PATCH 04/18] target/arm: Move HCR_TGE check into exception_target_el, Richard Henderson, 2022/05/23
[PATCH 03/18] target/arm: Move and expand parameters to exception_target_el, Richard Henderson, 2022/05/23
[PATCH 05/18] target/arm: Move arm_singlestep_active out of line, Richard Henderson, 2022/05/23