diff mbox series

[uclibc-ng-devel] csky: support bsd-setjmp and bsd-_setjmp.

Message ID 1521081627-9322-1-git-send-email-ren_guo@c-sky.com
State Accepted
Headers show
Series [uclibc-ng-devel] csky: support bsd-setjmp and bsd-_setjmp. | expand

Commit Message

Guo Ren March 15, 2018, 2:40 a.m. UTC
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
---
 libc/sysdeps/linux/csky/setjmp.S | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

Comments

Waldemar Brodkorb March 15, 2018, 7:46 p.m. UTC | #1
Hi Guo,
Guo Ren wrote,

> Signed-off-by: Guo Ren <ren_guo@c-sky.com>

Thanks, applied and pushed.

best regards
 Waldemar
diff mbox series

Patch

diff --git a/libc/sysdeps/linux/csky/setjmp.S b/libc/sysdeps/linux/csky/setjmp.S
index 03b402b..fb4b156 100644
--- a/libc/sysdeps/linux/csky/setjmp.S
+++ b/libc/sysdeps/linux/csky/setjmp.S
@@ -7,7 +7,7 @@ 
 
 #include <sysdep.h>
 
-ENTRY(setjmp)
+ENTRY(__sigsetjmp)
 	stw     sp, (a0, 0)
 	stw     lr, (a0, 4)
 
@@ -43,8 +43,20 @@  ENTRY(setjmp)
 	ldw	lr, (sp, 0)
 	addi	sp, 8
 	rts
+END(__sigsetjmp)
+
+/* 
+ * Support bsd-setjmp and bsd-_setjmp with tail-call method.
+ * Use br to keep the lr-reg, we must return to the Caller not setjmp.
+ * And we will rts by __sigsetjmp.
+ */
+ENTRY(setjmp)
+	movi	a1, 1
+	br	__sigsetjmp
 END(setjmp)
 
-strong_alias(setjmp, __sigsetjmp)
-strong_alias(setjmp, _setjmp)
+ENTRY(_setjmp)
+	movi	a1, 0
+	br	__sigsetjmp
+END(_setjmp)