[klibc] [klibc:master] arm/setjmp.S: fix longjmp

klibc-bot for Steve McIntyre steve at einval.com
Sun Jul 1 13:57:04 PDT 2012


Commit-ID:  d7d16afbdae9bdea83aeb26ac572e6fc4d7d4940
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d7d16afbdae9bdea83aeb26ac572e6fc4d7d4940
Author:     Steve McIntyre <steve at einval.com>
AuthorDate: Fri, 29 Jun 2012 18:13:34 +0100
Committer:  maximilian attems <max at stro.at>
CommitDate: Sun, 1 Jul 2012 22:51:00 +0200

[klibc] arm/setjmp.S: fix longjmp

There's a real bug in the ARM assembly version of longjmp in
usr/klibc/arch/arm/setjmp.S: it will always pass back its first
argument as a return value, even if it's 0 (see the man page for
more details). Oddly, the Thumb implementation in the same file
*is* correct!

Signed-off-by: Steve McIntyre <steve at einval.com>
Signed-off-by: maximilian attems <max at stro.at>

---
 usr/klibc/arch/arm/setjmp.S |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/usr/klibc/arch/arm/setjmp.S b/usr/klibc/arch/arm/setjmp.S
index 6018bda..d351e0e 100644
--- a/usr/klibc/arch/arm/setjmp.S
+++ b/usr/klibc/arch/arm/setjmp.S
@@ -41,7 +41,9 @@ setjmp:
 longjmp:
 	ldmia	r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr}
 	mov	r0, r1
-	BX(lr)
+	bne	1f
+	mov	r0, #1
+1:	BX(lr)
 	.size longjmp,.-longjmp
 
 #else /* __thumb__ */


More information about the klibc mailing list