From 8be3a69f1881cb87189164821c631fb398ea2b11 Mon Sep 17 00:00:00 2001 From: Guo Ren Date: Thu, 15 Mar 2018 10:40:27 +0800 Subject: csky: support bsd-setjmp and bsd-_setjmp. Signed-off-by: Guo Ren --- libc/sysdeps/linux/csky/setjmp.S | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/linux/csky/setjmp.S b/libc/sysdeps/linux/csky/setjmp.S index 03b402b2d..fb4b156c4 100644 --- a/libc/sysdeps/linux/csky/setjmp.S +++ b/libc/sysdeps/linux/csky/setjmp.S @@ -7,7 +7,7 @@ #include -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) -- cgit v1.2.3