target-arm: support thumb exception handlers
authorRabin Vincent <rabin@rab.in>
Sun, 14 Feb 2010 18:32:36 +0000 (00:02 +0530)
committerPaul Brook <paul@codesourcery.com>
Fri, 19 Feb 2010 15:20:21 +0000 (15:20 +0000)
When handling an exception, switch to the correct mode based on the
Thumb Exception (TE) bit in the SCTLR.

Signed-off-by: Rabin Vincent <rabin@rab.in>
target-arm/helper.c

index 27001e8..6f40084 100644 (file)
@@ -824,11 +824,10 @@ void do_interrupt(CPUARMState *env)
     env->spsr = cpsr_read(env);
     /* Clear IT bits.  */
     env->condexec_bits = 0;
-    /* Switch to the new mode, and switch to Arm mode.  */
-    /* ??? Thumb interrupt handlers not implemented.  */
+    /* Switch to the new mode, and to the correct instruction set.  */
     env->uncached_cpsr = (env->uncached_cpsr & ~CPSR_M) | new_mode;
     env->uncached_cpsr |= mask;
-    env->thumb = 0;
+    env->thumb = (env->cp15.c1_sys & (1 << 30)) != 0;
     env->regs[14] = env->regs[15] + offset;
     env->regs[15] = addr;
     env->interrupt_request |= CPU_INTERRUPT_EXITTB;