Date: Fri, 21 Dec 2001 10:47:25 -0500 From: Dan Eischen <eischen@vigrid.com> To: Bernd Walter <ticso@cicely9.cicely.de> Cc: Andrew Gallatin <gallatin@cs.duke.edu>, freebsd-alpha@FreeBSD.ORG Subject: Re: Munging jmp_bufs on alpha Message-ID: <3C23598D.FAB79E8@vigrid.com> References: <3C21000F.994BD53D@vigrid.com> <15393.15450.563749.55393@grasshopper.cs.duke.edu> <20011220063713.GC67179@cicely9.cicely.de> <20011221051904.GA71395@cicely9.cicely.de>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Bernd Walter wrote:
>
> My first explanation was a bit wrong but nevertheless here are the
> patches for libc and Daniels testprogramm.
Hmm, as long as we're going to restore T12 with the return
address, shouldn't we just save and restore T12 in _setjmp
and _longjmp respectively? And then let the threads library
put the return address in T12 like it already does?
There's still something I don't understand. With my patch,
why does R_RA (return address) need to be set in the jmp_buf?
In _longjmp, ra is loaded from where sc_pc is stored (jb[2]),
not from where ra is stored (jb[R_RA + 4]). If you modify
the jmp_buf munging macro to zero jb[R_RA + 4] (like it
has done before), it doesn't work:
#define SET_RETURN_ADDR_JB(jb, ra) do { \
(jb)[0]._jb[2] = (long)(ra); \
(jb)[0]._jb[R_RA + 4] = 0; \
(jb)[0]._jb[R_T12 + 4] = (long)(ra); \
It seems like it should because jb[R_RA + 4] is not used
by _longjmp.
--
Dan Eischen
[-- Attachment #2 --]
Index: gen/_setjmp.S
===================================================================
RCS file: /home/ncvs/src/lib/libc/alpha/gen/_setjmp.S,v
retrieving revision 1.7
diff -u -r1.7 _setjmp.S
--- gen/_setjmp.S 24 Jan 2001 12:58:52 -0000 1.7
+++ gen/_setjmp.S 20 Dec 2001 13:47:04 -0000
@@ -55,6 +55,7 @@
stq s5, ((14 + 4) * 8)(a0)
stq s6, ((15 + 4) * 8)(a0)
stq ra, ((26 + 4) * 8)(a0)
+ stq t12,((27 + 4) * 8)(a0)
stq sp, ((30 + 4) * 8)(a0)
ldiq t0, 0xacedbadd /* sigcontext magic number */
stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */
@@ -104,6 +105,7 @@
ldq s5, ((14 + 4) * 8)(a0)
ldq s6, ((15 + 4) * 8)(a0)
/* ldq ra, ((26 + 4) * 8)(a0) set above */
+ ldq t12,((27 + 4) * 8)(a0)
ldq sp, ((30 + 4) * 8)(a0)
ldt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */
ldt fs1, ((3 + 37) * 8)(a0)
Index: gen/setjmp.S
===================================================================
RCS file: /home/ncvs/src/lib/libc/alpha/gen/setjmp.S,v
retrieving revision 1.14
diff -u -r1.14 setjmp.S
--- gen/setjmp.S 24 Jan 2001 12:58:52 -0000 1.14
+++ gen/setjmp.S 21 Dec 2001 14:27:40 -0000
@@ -55,6 +55,7 @@
stq s5, ((14 + 4) * 8)(a0)
stq s6, ((15 + 4) * 8)(a0)
stq ra, ((26 + 4) * 8)(a0)
+ stq t12,((27 + 4) * 8)(a0)
stq sp, ((30 + 4) * 8)(a0)
/*
[-- Attachment #3 --]
Index: uthread/pthread_private.h
===================================================================
RCS file: /home/ncvs/src/lib/libc_r/uthread/pthread_private.h,v
retrieving revision 1.64
diff -u -r1.64 pthread_private.h
--- uthread/pthread_private.h 17 Nov 2001 14:28:39 -0000 1.64
+++ uthread/pthread_private.h 21 Dec 2001 15:07:22 -0000
@@ -96,8 +96,8 @@
#define FP_SAVE_UC(ucp)
#define FP_RESTORE_UC(ucp)
#define SET_RETURN_ADDR_JB(jb, ra) do { \
- (jb)[0]._jb[2] = (unsigned long)(ra) + 8UL; \
- (jb)[0]._jb[R_RA + 4] = 0; \
+ (jb)[0]._jb[2] = (long)(ra); \
+ (jb)[0]._jb[R_RA + 4] = (long)(ra); \
(jb)[0]._jb[R_T12 + 4] = (long)(ra); \
} while (0)
#else
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C23598D.FAB79E8>
