ARM: Fix up vfp exception location in thumb mode
authorColin Cross <ccross@android.com>
Fri, 14 Jan 2011 22:32:49 +0000 (14:32 -0800)
committerColin Cross <ccross@android.com>
Fri, 14 Jan 2011 23:26:47 +0000 (15:26 -0800)
The exception handler in entry-armv.S checks for thumb mode and
correctly determines the exception location and instruction,
but VFP_bounce uses the uncorrected location off the stack.
If the VFP exception occured in Thumb mode, fix up the
exception location on the stack to match the value that would
be returned in ARM mode.

Fixes segfaults in userspace applications running in Thumb mode
caused by a handled VFP exception returning to the middle of the
instruction that triggered the exception.

Change-Id: I02be4c5b546561d9a967a02c1e9eb1de876cff07
Original-author: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Colin Cross <ccross@android.com>
arch/arm/kernel/entry-armv.S

index bb8e93a76407241042345c51273690f6cdc35578..e572d24d018d409b62baec4b8fd0bd9d9e61ad5f 100644 (file)
@@ -506,7 +506,8 @@ __und_usr:
        blo     __und_usr_unknown
 3:     ldrht   r0, [r4]
        add     r2, r2, #2                      @ r2 is PC + 2, make it PC + 4
-       orr     r0, r0, r5, lsl #16
+       str     r2, [sp, #S_PC]                 @ it's a 2x16bit instr, update
+       orr     r0, r0, r5, lsl #16             @  regs->ARM_pc
 #else
        b       __und_usr_unknown
 #endif