Date: Fri, 21 Dec 2001 17:46:36 +0100 From: Bernd Walter <ticso@cicely9.cicely.de> To: Dan Eischen <eischen@vigrid.com> Cc: Andrew Gallatin <gallatin@cs.duke.edu>, freebsd-alpha@FreeBSD.ORG Subject: Re: Munging jmp_bufs on alpha Message-ID: <20011221164636.GC97006@cicely9.cicely.de> In-Reply-To: <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> <3C23598D.FAB79E8@vigrid.com>
index | next in thread | previous in thread | raw e-mail
On Fri, Dec 21, 2001 at 10:47:25AM -0500, Dan Eischen wrote:
> 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?
_setjmp and _longjmp are functions and the caller should not expect
any temporary register to keep it's contents after calling any function.
There is no need to save/restore them.
The point is with overwriting the return address to a function address
_longjmp does not return but call a function without knowing it and
a function caller needs to initialise t12 first.
> 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.
It works for me with my patch.
You can even remove the RA and T12 line because they are never used.
It should work with your patch too - I have no idea why it does not.
--
B.Walter COSMO-Project http://www.cosmo-project.de
ticso@cicely.de Usergroup info@cosmo-project.de
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011221164636.GC97006>
