diff options
author | Sergey Sorokin <afarallax@yandex.ru> | 2015-10-16 11:14:52 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-10-16 11:14:52 +0100 |
commit | 2cde031f5a34996bab32571a26b1a6bcf3e5b5d9 (patch) | |
tree | 8ac0b45996a034a6de7e20376d16ddc1e0212dc7 /target-arm/helper.c | |
parent | 6df99dec9e81838423d723996e96236693fa31fe (diff) | |
download | hqemu-2cde031f5a34996bab32571a26b1a6bcf3e5b5d9.zip hqemu-2cde031f5a34996bab32571a26b1a6bcf3e5b5d9.tar.gz |
target-arm: Avoid calling arm_el_is_aa64() function for unimplemented EL
It is incorrect to call arm_el_is_aa64() function for unimplemented EL.
This patch fixes several attempts to do so.
Signed-off-by: Sergey Sorokin <afarallax@yandex.ru>
[PMM: Reworked several of the comments to be more verbose.]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm/helper.c')
-rw-r--r-- | target-arm/helper.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c index b498670..b2d78b0 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -5224,11 +5224,22 @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, uint32_t cur_el, bool secure) { CPUARMState *env = cs->env_ptr; - int rw = ((env->cp15.scr_el3 & SCR_RW) == SCR_RW); + int rw; int scr; int hcr; int target_el; - int is64 = arm_el_is_aa64(env, 3); + /* Is the highest EL AArch64? */ + int is64 = arm_feature(env, ARM_FEATURE_AARCH64); + + if (arm_feature(env, ARM_FEATURE_EL3)) { + rw = ((env->cp15.scr_el3 & SCR_RW) == SCR_RW); + } else { + /* Either EL2 is the highest EL (and so the EL2 register width + * is given by is64); or there is no EL2 or EL3, in which case + * the value of 'rw' does not affect the table lookup anyway. + */ + rw = is64; + } switch (excp_idx) { case EXCP_IRQ: |