summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorT.J. Purtell <tj@mobisocial.us>2013-11-06 21:38:05 +0400
committerZefan Li <lizefan@huawei.com>2016-04-27 13:55:19 +0300
commitb2e30785526c7e1b7bba74d5c50784cfcfe0bc21 (patch)
treecc3f3caf00575b4ff4b666fef4d06ca1b773ee33
parent98e57bab3f696bf9642899b57ed733d122f3ed4e (diff)
downloadlinux-b2e30785526c7e1b7bba74d5c50784cfcfe0bc21.tar.xz
ARM: 7880/1: Clear the IT state independent of the Thumb-2 mode
commit 6ecf830e5029598732e04067e325d946097519cb upstream. The ARM architecture reference specifies that the IT state bits in the PSR must be all zeros in ARM mode or behavior is unspecified. On the Qualcomm Snapdragon S4/Krait architecture CPUs the processor continues to consider the IT state bits while in ARM mode. This makes it so that some instructions are skipped by the CPU. Signed-off-by: T.J. Purtell <tj@mobisocial.us> [rmk+kernel@arm.linux.org.uk: fixed whitespace formatting in patch] Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Zefan Li <lizefan@huawei.com>
-rw-r--r--arch/arm/kernel/signal.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index d68d1b694680..ffc090232389 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -437,12 +437,18 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
*/
thumb = handler & 1;
- if (thumb) {
- cpsr |= PSR_T_BIT;
#if __LINUX_ARM_ARCH__ >= 7
- /* clear the If-Then Thumb-2 execution state */
- cpsr &= ~PSR_IT_MASK;
+ /*
+ * Clear the If-Then Thumb-2 execution state
+ * ARM spec requires this to be all 000s in ARM mode
+ * Snapdragon S4/Krait misbehaves on a Thumb=>ARM
+ * signal transition without this.
+ */
+ cpsr &= ~PSR_IT_MASK;
#endif
+
+ if (thumb) {
+ cpsr |= PSR_T_BIT;
} else
cpsr &= ~PSR_T_BIT;
}