From owner-freebsd-alpha Fri Dec 21 10:59:42 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by hub.freebsd.org (Postfix) with ESMTP id 6B7A537B41E for ; Fri, 21 Dec 2001 10:59:37 -0800 (PST) Received: (qmail 18500 invoked from network); 21 Dec 2001 18:51:56 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail6.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 21 Dec 2001 18:51:56 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Fri, 21 Dec 2001 10:51:38 -0800 (PST) From: John Baldwin To: Daniel Eischen Subject: Re: Munging jmp_bufs on alpha Cc: freebsd-alpha@FreeBSD.ORG, Andrew Gallatin , Dan Eischen , Bernd Walter Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 <>< 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