Skip to content

Commit 6ecf830

Browse files
tpurtellRussell King
authored andcommitted
ARM: 7880/1: Clear the IT state independent of the Thumb-2 mode
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>
1 parent e16b31b commit 6ecf830

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎arch/arm/kernel/signal.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,18 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig,
375375
*/
376376
thumb = handler & 1;
377377

378-
if (thumb) {
379-
cpsr |= PSR_T_BIT;
380378
#if __LINUX_ARM_ARCH__ >= 7
381-
/* clear the If-Then Thumb-2 execution state */
382-
cpsr &= ~PSR_IT_MASK;
379+
/*
380+
* Clear the If-Then Thumb-2 execution state
381+
* ARM spec requires this to be all 000s in ARM mode
382+
* Snapdragon S4/Krait misbehaves on a Thumb=>ARM
383+
* signal transition without this.
384+
*/
385+
cpsr &= ~PSR_IT_MASK;
383386
#endif
387+
388+
if (thumb) {
389+
cpsr |= PSR_T_BIT;
384390
} else
385391
cpsr &= ~PSR_T_BIT;
386392
}

0 commit comments

Comments
 (0)