[git commit prelink 1/1] microblaze: Fix setjmp/longjmp

Steven J. Magnani steve at digidescorp.com
Sun Nov 28 19:50:38 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=4dc998596f0ed8c9f1da6dc57a5640e3928cc12b
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink

Some state and registers are missing from setjmp/longjmp handling.

Signed-off-by: Steven J. Magnani <steve at digidescorp.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/sysdeps/linux/microblaze/__longjmp.S   |   36 ++++++++++++----------
 libc/sysdeps/linux/microblaze/bits/setjmp.h |   10 ++++--
 libc/sysdeps/linux/microblaze/setjmp.S      |   43 ++++++++++++++------------
 3 files changed, 50 insertions(+), 39 deletions(-)

diff --git a/libc/sysdeps/linux/microblaze/__longjmp.S b/libc/sysdeps/linux/microblaze/__longjmp.S
index 2752f0b..c4423be 100644
--- a/libc/sysdeps/linux/microblaze/__longjmp.S
+++ b/libc/sysdeps/linux/microblaze/__longjmp.S
@@ -16,30 +16,34 @@
 #define _ASM
 #include <bits/setjmp.h>
 
-#include <clinkage.h>
+#include <libc-symbols.h>
 
 	.text
-C_ENTRY(__longjmp):
+	.globl C_SYMBOL_NAME(__longjmp)
+	.align 4
+C_SYMBOL_NAME(__longjmp):
 	/* load registers from memory to r5 (arg0) */
 	lwi	r1, r5, 0
 	lwi	r15, r5, 4
-	lwi	r18, r5, 8
-	lwi	r19, r5, 12
-	lwi	r20, r5, 16
-	lwi	r21, r5, 20
-	lwi	r22, r5, 24
-	lwi	r23, r5, 28
-	lwi	r24, r5, 32
-	lwi	r25, r5, 36
-	lwi	r26, r5, 40
-	lwi	r27, r5, 44
-	lwi	r28, r5, 48
-	lwi	r29, r5, 52
-	lwi	r30, r5, 56
+	lwi	r2,  r5, 8
+	lwi	r13, r5, 12
+	lwi	r18, r5, 16
+	lwi	r19, r5, 20
+	lwi	r20, r5, 24
+	lwi	r21, r5, 28
+	lwi	r22, r5, 32
+	lwi	r23, r5, 36
+	lwi	r24, r5, 40
+	lwi	r25, r5, 44
+	lwi	r26, r5, 48
+	lwi	r27, r5, 52
+	lwi	r28, r5, 56
+	lwi	r29, r5, 60
+	lwi	r30, r5, 64
+	lwi	r31, r5, 68
 
 	addi	r3, r0, 1		/* return val */
 	rtsd	r15, 8			/* normal return */
 	nop
 
-C_END(__longjmp)
 libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/microblaze/bits/setjmp.h b/libc/sysdeps/linux/microblaze/bits/setjmp.h
index d966efd..0c0573c 100644
--- a/libc/sysdeps/linux/microblaze/bits/setjmp.h
+++ b/libc/sysdeps/linux/microblaze/bits/setjmp.h
@@ -28,12 +28,16 @@ typedef struct
     /* Link pointer.  */
     void *__lp;
 
-    /* Callee-saved registers r18-r30.  */
-    int __regs[13];
+    /* SDA pointers */
+    void *__SDA;
+    void *__SDA2;
+
+    /* Callee-saved registers r18-r31.  */
+    int __regs[14];
   } __jmp_buf[1];
 #endif
 
-#define JB_SIZE		(4 * 15)
+#define JB_SIZE		(4 * 18)
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
diff --git a/libc/sysdeps/linux/microblaze/setjmp.S b/libc/sysdeps/linux/microblaze/setjmp.S
index 7068d4b..7acb9ea 100644
--- a/libc/sysdeps/linux/microblaze/setjmp.S
+++ b/libc/sysdeps/linux/microblaze/setjmp.S
@@ -8,7 +8,7 @@
  * This file is subject to the terms and conditions of the GNU Lesser
  * General Public License.  See the file COPYING.LIB in the main
  * directory of this archive for more details.
- * 
+ *
  * Written by Miles Bader <miles at gnu.org>
  */
 
@@ -16,38 +16,41 @@
 #define _ASM
 #include <bits/setjmp.h>
 
-#include <clinkage.h>
+#include <libc-symbols.h>
 
 	.text
-C_ENTRY(setjmp):
-	addi	r6, r0, 1			/* Save the signal mask.  */
+	.globl C_SYMBOL_NAME(setjmp)
+	.align 4
+C_SYMBOL_NAME(setjmp):
 	braid	C_SYMBOL_NAME(__sigsetjmp)
-	nop
+	addi	r6, r0, 1			/* Save the signal mask.  */
 
 	.globl C_SYMBOL_NAME(_setjmp)
 C_SYMBOL_NAME(_setjmp):
-	add	r6, r0, r0			/* Don't save the signal mask.  */
+	and	r6, r0, r0			/* Don't save the signal mask.  */
 
 	.globl C_SYMBOL_NAME(__sigsetjmp)
 C_SYMBOL_NAME(__sigsetjmp):
 	/* Save registers relative to r5 (arg0)*/
 	swi	r1, r5, 0			/* stack pointer */
 	swi	r15, r5, 4			/* link register */
-	swi	r18, r5, 8			/* assembler temp */
-	swi	r19, r5, 12			/* now call-preserved regs */
-	swi	r20, r5, 16
-	swi	r21, r5, 20
-	swi	r22, r5, 24
-	swi	r23, r5, 28
-	swi	r24, r5, 32
-	swi	r25, r5, 36
-	swi	r26, r5, 40
-	swi	r27, r5, 44
-	swi	r28, r5, 48
-	swi	r29, r5, 52
-	swi	r30, r5, 56
+	swi	r2,  r5, 8			/* SDA and SDA2 ptrs */
+	swi	r13, r5, 12
+	swi	r18, r5, 16			/* assembler temp */
+	swi	r19, r5, 20			/* now call-preserved regs */
+	swi	r20, r5, 24
+	swi	r21, r5, 28
+	swi	r22, r5, 32
+	swi	r23, r5, 36
+	swi	r24, r5, 40
+	swi	r25, r5, 44
+	swi	r26, r5, 48
+	swi	r27, r5, 52
+	swi	r28, r5, 56
+	swi	r29, r5, 60
+	swi	r30, r5, 64
+	swi	r31, r5, 68
 
 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
 	braid	C_SYMBOL_NAME(__sigjmp_save)
 	nop
-C_END(setjmp)
-- 
1.7.2.2



More information about the uClibc-cvs mailing list