logo       

Re: 0.9.19: Memory fault with setjmp on arm7tdmi: msg#00099

lib.uclibc.general

Subject: Re: 0.9.19: Memory fault with setjmp on arm7tdmi

On Tue Mar 11, 2003 at 01:50:50PM +0100, Markus Pietrek wrote:
> Hi folks,
>
> just compiled uClibc-0.9.19 for an NetARM+50 (arm7tdmi)/uclinux-2.4.20 and
> I'am impressed. All went smooth and the gcc wrapper makes life much easier
> now :-)

cool

> The applications I tested so far work fine. But using setjmp() results in an
> "Memory fault", even the uclibc-0.9.19 setjmp_test

I see you have both UCLIBC_HAS_FLOATS and UCLIBC_HAS_SOFT_FLOAT
enabled, and you have HAS_FPU disabled. Hmm. Lemme take a look
at the setjmp code for that case.

<sound of Erik reading the arm *jmp code>

Yeah, that does look broken to me. Could you try this patch and
let me know if it fixes the problem for you?


--- libc/sysdeps/linux/arm/setjmp.S 3 Mar 2003 00:05:15 -0000 1.9
+++ libc/sysdeps/linux/arm/setjmp.S 11 Mar 2003 15:32:31 -0000
@@ -29,14 +30,16 @@ __sigsetjmp:
/* Save registers */
#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
sfmea f4, 4, [r0]!
-#else
- add r0, r0, #48 /* skip the FP registers */
-#endif
stmia r0, {v1-v6, sl, fp, sp, lr}

/* Restore pointer to jmp_buf */
sub r0, r0, #48
+#else
+ stmia r0, {v1-v6, sl, fp, sp, lr}
+#endif

/* Make a tail call to __sigjmp_save; it takes the same args. */
B __sigjmp_save (PLT)
-.size __sigsetjmp,.-__sigsetjmp;
+
+.size __sigsetjmp,.-__sigsetjmp
+
--- libc/sysdeps/linux/arm/__longjmp.S 23 Feb 2003 23:24:44 -0000 1.4
+++ libc/sysdeps/linux/arm/__longjmp.S 11 Mar 2003 15:13:26 -0000
@@ -26,17 +26,16 @@
.globl __longjmp;
.type __longjmp,%function
.align 4;
+
__longjmp:
mov ip, r0 /* save jmp_buf pointer */
-
movs r0, r1 /* get the return value in place */
moveq r0, #1 /* can't let setjmp() return zero! */

#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
lfmfd f4, 4, [ip] ! /* load the floating point regs */
-#else
- add ip, ip, #48 /* skip the FP registers */
#endif

ldmia ip , {v1-v6, sl, fp, sp, pc}
-.size __longjmp,.-__longjmp;
+
+.size __longjmp,.-__longjmp

-Erik

--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise