Commit 75b680e5234d7641105919a2a47079e9a0d5d800

Authored by pbrook
1 parent 3b89f26c

Fix Thumb signal handlers.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4089 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 3 additions and 28 deletions
linux-user/signal.c
@@ -1129,33 +1129,7 @@ setup_return(CPUState *env, struct emulated_sigaction *ka, @@ -1129,33 +1129,7 @@ setup_return(CPUState *env, struct emulated_sigaction *ka,
1129 { 1129 {
1130 abi_ulong handler = ka->sa._sa_handler; 1130 abi_ulong handler = ka->sa._sa_handler;
1131 abi_ulong retcode; 1131 abi_ulong retcode;
1132 - int thumb = 0;  
1133 -#if defined(TARGET_CONFIG_CPU_32)  
1134 -#if 0  
1135 - abi_ulong cpsr = env->cpsr;  
1136 -  
1137 - /*  
1138 - * Maybe we need to deliver a 32-bit signal to a 26-bit task.  
1139 - */  
1140 - if (ka->sa.sa_flags & SA_THIRTYTWO)  
1141 - cpsr = (cpsr & ~MODE_MASK) | USR_MODE;  
1142 -  
1143 -#ifdef CONFIG_ARM_THUMB  
1144 - if (elf_hwcap & HWCAP_THUMB) {  
1145 - /*  
1146 - * The LSB of the handler determines if we're going to  
1147 - * be using THUMB or ARM mode for this signal handler.  
1148 - */  
1149 - thumb = handler & 1;  
1150 -  
1151 - if (thumb)  
1152 - cpsr |= T_BIT;  
1153 - else  
1154 - cpsr &= ~T_BIT;  
1155 - }  
1156 -#endif /* CONFIG_ARM_THUMB */  
1157 -#endif /* 0 */  
1158 -#endif /* TARGET_CONFIG_CPU_32 */ 1132 + int thumb = handler & 1;
1159 1133
1160 if (ka->sa.sa_flags & TARGET_SA_RESTORER) { 1134 if (ka->sa.sa_flags & TARGET_SA_RESTORER) {
1161 retcode = ka->sa.sa_restorer; 1135 retcode = ka->sa.sa_restorer;
@@ -1178,6 +1152,7 @@ setup_return(CPUState *env, struct emulated_sigaction *ka, @@ -1178,6 +1152,7 @@ setup_return(CPUState *env, struct emulated_sigaction *ka,
1178 env->regs[13] = frame_addr; 1152 env->regs[13] = frame_addr;
1179 env->regs[14] = retcode; 1153 env->regs[14] = retcode;
1180 env->regs[15] = handler & (thumb ? ~1 : ~3); 1154 env->regs[15] = handler & (thumb ? ~1 : ~3);
  1155 + env->thumb = thumb;
1181 1156
1182 #if 0 1157 #if 0
1183 #ifdef TARGET_CONFIG_CPU_32 1158 #ifdef TARGET_CONFIG_CPU_32
@@ -1295,7 +1270,7 @@ restore_sigcontext(CPUState *env, struct target_sigcontext *sc) @@ -1295,7 +1270,7 @@ restore_sigcontext(CPUState *env, struct target_sigcontext *sc)
1295 __get_user_error(env->regs[15], &sc->arm_pc, err); 1270 __get_user_error(env->regs[15], &sc->arm_pc, err);
1296 #ifdef TARGET_CONFIG_CPU_32 1271 #ifdef TARGET_CONFIG_CPU_32
1297 __get_user_error(cpsr, &sc->arm_cpsr, err); 1272 __get_user_error(cpsr, &sc->arm_cpsr, err);
1298 - cpsr_write(env, cpsr, 0xffffffff); 1273 + cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC);
1299 #endif 1274 #endif
1300 1275
1301 err |= !valid_user_regs(env); 1276 err |= !valid_user_regs(env);