Fix Thumb signal handlers.
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 21 Mar 2008 16:07:30 +0000 (16:07 +0000)
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 21 Mar 2008 16:07:30 +0000 (16:07 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4089 c046a42c-6fe2-441c-8c8c-71466251a162

linux-user/signal.c

index fe3cd58eed209c35d7682e195a77a692499e84f1..3aa8590c68ca2eaa0d47c9476cbea817b2eee78f 100644 (file)
@@ -1129,33 +1129,7 @@ setup_return(CPUState *env, struct emulated_sigaction *ka,
 {
        abi_ulong handler = ka->sa._sa_handler;
        abi_ulong retcode;
-       int thumb = 0;
-#if defined(TARGET_CONFIG_CPU_32)
-#if 0
-       abi_ulong cpsr = env->cpsr;
-
-       /*
-        * Maybe we need to deliver a 32-bit signal to a 26-bit task.
-        */
-       if (ka->sa.sa_flags & SA_THIRTYTWO)
-               cpsr = (cpsr & ~MODE_MASK) | USR_MODE;
-
-#ifdef CONFIG_ARM_THUMB
-       if (elf_hwcap & HWCAP_THUMB) {
-               /*
-                * The LSB of the handler determines if we're going to
-                * be using THUMB or ARM mode for this signal handler.
-                */
-               thumb = handler & 1;
-
-               if (thumb)
-                       cpsr |= T_BIT;
-               else
-                       cpsr &= ~T_BIT;
-       }
-#endif /* CONFIG_ARM_THUMB */
-#endif /* 0 */
-#endif /* TARGET_CONFIG_CPU_32 */
+       int thumb = handler & 1;
 
        if (ka->sa.sa_flags & TARGET_SA_RESTORER) {
                retcode = ka->sa.sa_restorer;
@@ -1178,6 +1152,7 @@ setup_return(CPUState *env, struct emulated_sigaction *ka,
        env->regs[13] = frame_addr;
        env->regs[14] = retcode;
        env->regs[15] = handler & (thumb ? ~1 : ~3);
+       env->thumb = thumb;
 
 #if 0
 #ifdef TARGET_CONFIG_CPU_32
@@ -1295,7 +1270,7 @@ restore_sigcontext(CPUState *env, struct target_sigcontext *sc)
        __get_user_error(env->regs[15], &sc->arm_pc, err);
 #ifdef TARGET_CONFIG_CPU_32
        __get_user_error(cpsr, &sc->arm_cpsr, err);
-        cpsr_write(env, cpsr, 0xffffffff);
+        cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC);
 #endif
 
        err |= !valid_user_regs(env);