[klibc] [PATCH] fix ARM longjmp with zero 'val'.
H. Peter Anvin
hpa at zytor.com
Wed Oct 17 15:29:32 PDT 2012
On 10/02/2012 10:29 AM, Bill Pringlemeir wrote:
>
> [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
>
This is one of many reasons why I made the decision early on to simply
thread setjmp(0) as a user error and not try to DWIM it.
The presumed original reason was to handle legacy code which did
setjmp() without providing an argument, but that will not even compile
anymore.
-hpa
More information about the klibc
mailing list