Clear the IT state when invoking a Thumb-2 signal handler
authorCatalin Marinas <catalin.marinas@arm.com>
Sat, 30 May 2009 13:00:15 +0000 (14:00 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Sat, 30 May 2009 13:00:15 +0000 (14:00 +0100)
If a process is interrupted during an If-Then block and a signal is
invoked, the ITSTATE bits must be cleared otherwise the handler would
not run correctly.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Joseph S. Myers <joseph@codesourcery.com>
arch/arm/include/asm/ptrace.h
arch/arm/kernel/signal.c

index 236a06b9b7ce0e9e4bb11caa5a48e48759a59ef7..4a4290f7b4a28356c81382707633555890858dfe 100644 (file)
 #define PSR_x          0x0000ff00      /* Extension            */
 #define PSR_c          0x000000ff      /* Control              */
 
+/*
+ * ARMv7 groups of APSR bits
+ */
+#define PSR_ISET_MASK  0x01000010      /* ISA state (J, T) mask */
+#define PSR_IT_MASK    0x0600fc00      /* If-Then execution state mask */
+#define PSR_ENDIAN_MASK        0x00000200      /* Endianness state mask */
+
 #ifndef __ASSEMBLY__
 
 /*
index 80b8b5c7e07a1a472b1b18458c41d32412e642e6..442b87476f97105963df1862efcf089bc542f7d0 100644 (file)
@@ -426,9 +426,13 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
                 */
                thumb = handler & 1;
 
-               if (thumb)
+               if (thumb) {
                        cpsr |= PSR_T_BIT;
-               else
+#if __LINUX_ARM_ARCH__ >= 7
+                       /* clear the If-Then Thumb-2 execution state */
+                       cpsr &= ~PSR_IT_MASK;
+#endif
+               } else
                        cpsr &= ~PSR_T_BIT;
        }
 #endif