Date: Fri, 21 Dec 2001 10:51:38 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Daniel Eischen <eischen@pcnet1.pcnet.com> Cc: freebsd-alpha@FreeBSD.ORG, Andrew Gallatin <gallatin@cs.duke.edu>, Dan Eischen <eischen@vigrid.com>, Bernd Walter <ticso@cicely9.cicely.de> Subject: Re: Munging jmp_bufs on alpha Message-ID: <XFMail.011221105138.jhb@FreeBSD.org> In-Reply-To: <Pine.SUN.3.91.1011221130251.12980B-100000@pcnet1.pcnet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 21-Dec-01 Daniel Eischen wrote: > On Fri, 21 Dec 2001, Bernd Walter wrote: >> 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. > > OK, but by the same token, making _setjmp/_longjmp account for > libc_r's jmp_buf munging seems wrong too. Playing the devil's > advocate, why should _longjmp stuff the return address into > a temporary register? It seems more general to just save and > restore any necessary register, whether it's temporary or not. > T12 seems like it fits that category. > > What is T12 suppose to contain in a normal function call? Is > it always the return address? Is that dependent on our compiler? According to sys/alpha/include/asm.h, t12 (aka $27) is also known as the 'procedure value' register for the DEC Alpha calling conventions. According to a comment in ERSAVE(), jmp/CALL()'s trash T12, so I assume t12/pv is used for doing something during calls. :) Unfortunately, my Alpha book is packed away at the moment, so I have fewer details than I'd like. -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ 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?XFMail.011221105138.jhb>