On 12/12/19 3:47 AM, Alex Bennée wrote: > A write to the SCR can change the effective EL by droppping the system > from secure to non-secure mode. However if we use a cached current_el > from before the change we'll rebuild the flags incorrectly. To fix > this we introduce the ARM_CP_NEWEL CP flag to indicate the new EL > should be used when recomputing the flags. > > Signed-off-by: Alex Bennée <alex.ben...@linaro.org> > Tested-by: Philippe Mathieu-Daudé <phi...@redhat.com> > Cc: Richard Henderson <richard.hender...@linaro.org> > Message-Id: <20191209143723.6368-1-alex.ben...@linaro.org> > > --- > v2 > - don't override a ARM_CP_SPECIAL, use a new flag > --- > target/arm/cpu.h | 8 ++++++-- > target/arm/helper.h | 1 + > target/arm/helper.c | 14 +++++++++++++- > target/arm/translate.c | 6 +++++- > 4 files changed, 25 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > if (arm_dc_feature(s, ARM_FEATURE_M)) { > gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); > } else { > - gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); > + if (ri->type & ARM_CP_NEWEL) { > + gen_helper_rebuild_hflags_a32_newel(cpu_env); > + } else { > + gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); > + } > } If you tweak this again, an else if would be appropriate. r~