[klibc] [PATCH] fix ARM longjmp with zero 'val'.

Bill Pringlemeir bpringle at sympatico.ca
Tue Oct 2 10:29:52 PDT 2012


[klibc] [PATCH] fix ARM longjmp with zero 'val'.

We need to set the condition codes on the ARM.  The previous version was
using a left over condition code from the caller.  Also, use conditional
execution to eliminate branch and reduce size.

Signed-off-by: Bill Pringlemeir <bpringle at sympatico.ca>

diff --git a/usr/klibc/arch/arm/setjmp.S b/usr/klibc/arch/arm/setjmp.S
index 92ffc43..9f96274 100644
--- a/usr/klibc/arch/arm/setjmp.S
+++ b/usr/klibc/arch/arm/setjmp.S
@@ -40,10 +40,9 @@ setjmp:
        .type longjmp, #function
 longjmp:
        ldmia   r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr}
-       mov     r0, r1
-       bne     1f
-       mov     r0, #1
-1:     BX(lr)
+       movs    r0, r1
+       moveq   r0, #1
+       BX(lr)
        .size longjmp,.-longjmp
 
 #else /* __thumb__ */


More information about the klibc mailing list