Skip site navigation (1)Skip section navigation (2)
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>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------E659A4761554CE83B6F5FBCD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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
--------------E659A4761554CE83B6F5FBCD
Content-Type: text/plain; charset=us-ascii;
 name="alpha.diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="alpha.diffs"

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)
 
 	/*

--------------E659A4761554CE83B6F5FBCD
Content-Type: text/plain; charset=us-ascii;
 name="alpha_uthread.diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="alpha_uthread.diffs"

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

--------------E659A4761554CE83B6F5FBCD--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C23598D.FAB79E8>