diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2022-06-10 14:32:35 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2022-06-10 14:32:35 +0100 |
commit | 38e8a13c116b114c100f488dc6a32c9c9df3ccd0 (patch) | |
tree | cb06abf8ed0883d2f5050805764c7729ce1a0581 /target/arm/debug_helper.c | |
parent | 04eacf6e79e7489579d188acbfe3046874d7ec3e (diff) | |
download | qemu-38e8a13c116b114c100f488dc6a32c9c9df3ccd0.zip qemu-38e8a13c116b114c100f488dc6a32c9c9df3ccd0.tar.gz qemu-38e8a13c116b114c100f488dc6a32c9c9df3ccd0.tar.bz2 |
target/arm: Move arm_debug_target_el to debug_helper.c
This function is no longer used outside debug_helper.c.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-23-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/debug_helper.c')
-rw-r--r-- | target/arm/debug_helper.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 26004df..b18a6bd 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -12,6 +12,27 @@ #include "exec/helper-proto.h" +/* Return the Exception Level targeted by debug exceptions. */ +static int arm_debug_target_el(CPUARMState *env) +{ + bool secure = arm_is_secure(env); + bool route_to_el2 = false; + + if (arm_is_el2_enabled(env)) { + route_to_el2 = env->cp15.hcr_el2 & HCR_TGE || + env->cp15.mdcr_el2 & MDCR_TDE; + } + + if (route_to_el2) { + return 2; + } else if (arm_feature(env, ARM_FEATURE_EL3) && + !arm_el_is_aa64(env, 3) && secure) { + return 3; + } else { + return 1; + } +} + /* * Raise an exception to the debug target el. * Modify syndrome to indicate when origin and target EL are the same. |