target-arm: Correctly handle PSTATE.SS when taking exception to AArch32
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 19 Aug 2014 17:56:26 +0000 (18:56 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 19 Aug 2014 18:02:03 +0000 (19:02 +0100)
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>
target-arm/helper.c

index 22bf6d3f6870797f6c35adab158a1df71946f5f4..f981569ae2ce17565be43b7cafa18ca42ed1ac12 100644 (file)
@@ -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;