Fix setjmp/longjmp implementation for thumb mode (i.e.: tiva, which is Cortex M3...
authorTomasz Wozniak <t.wozniak@samsung.com>
Tue, 19 Sep 2017 13:21:48 +0000 (15:21 +0200)
committerTomasz Wozniak <t.wozniak@samsung.com>
Tue, 19 Sep 2017 13:21:48 +0000 (15:21 +0200)
Compiles for armv7-a/r in both arm and thumb modes and for armv7-m.

os/arch/arm/src/common/setjmp.S

index bdac7d2..3acd669 100644 (file)
@@ -151,12 +151,19 @@ longjmp:
        ldr     r14, [r0, #((_JB_REG_R14 - _JB_REG_R4) * 4)]
 #endif
 
+#ifndef __thumb__
        /* Validate sp and r14 */
        teq     sp, #0
        it      ne
        teqne   r14, #0
        it      eq
        beq     botch
+#else
+       cmp sp, #0
+       beq botch
+       cmp lr, #0
+       beq botch
+#endif
 
        /* Set return value */
        movs    r0, r1