summaryrefslogtreecommitdiffstats
path: root/target-arm/helper.c
diff options
context:
space:
mode:
authorPeter Maydell2014-08-19 19:56:26 +0200
committerPeter Maydell2014-08-19 20:02:03 +0200
commit662cefb7753c1f04d960b443c60e7622c83144d3 (patch)
tree2116183e3c60a028c2628fcb32e09ebd445b2fdf /target-arm/helper.c
parenttarget-arm: Don't allow AArch32 to access RES0 CPSR bits (diff)
downloadqemu-662cefb7753c1f04d960b443c60e7622c83144d3.tar.gz
qemu-662cefb7753c1f04d960b443c60e7622c83144d3.tar.xz
qemu-662cefb7753c1f04d960b443c60e7622c83144d3.zip
target-arm: Correctly handle PSTATE.SS when taking exception to AArch32
When an exception is taken to AArch32, we must clear the PSTATE.SS bit for the exception handler, and must also ensure that the SS bit is not set in the value saved to SPSR_<mode>. Achieve both of these aims by clearing the bit in uncached_cpsr before saving it to the SPSR. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Diffstat (limited to 'target-arm/helper.c')
-rw-r--r--target-arm/helper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 22bf6d3f68..f981569ae2 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -3550,6 +3550,10 @@ void arm_cpu_do_interrupt(CPUState *cs)
addr += env->cp15.vbar_el[1];
}
switch_mode (env, new_mode);
+ /* For exceptions taken to AArch32 we must clear the SS bit in both
+ * PSTATE and in the old-state value we save to SPSR_<mode>, so zero it now.
+ */
+ env->uncached_cpsr &= ~PSTATE_SS;
env->spsr = cpsr_read(env);
/* Clear IT bits. */
env->condexec_bits = 0;