Date: Sun, 12 Jan 2003 15:55:25 -0500 From: Jake Burkholder <jake@locore.ca> To: John Polstra <jdp@polstra.com> Cc: sparc@FreeBSD.ORG Subject: Re: Question about odd stack pointer values on sparc64 Message-ID: <20030112155525.K212@locore.ca> In-Reply-To: <XFMail.20030112124444.jdp@polstra.com>; from jdp@polstra.com on Sun, Jan 12, 2003 at 12:44:44PM -0800 References: <XFMail.20030112124444.jdp@polstra.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Apparently, On Sun, Jan 12, 2003 at 12:44:44PM -0800, John Polstra said words to the effect of; > Still working on getting Modula-3 going on Sparc64. I think I'm > getting close ... > > In GDB I notice that the stack pointer and frame pointer are often > (always?) odd numbers, e.g.: > > (gdb) p/x $sp > $1 = 0x7fdffffdec1 > (gdb) p/x $fp > $2 = 0x7fdffffdfb1 > > What is the reason for that? Are the low-order bits simply ignored? > Surely the stack is more aligned than that. > > I'm pretty sure this is confusing the M3 garbage collector. It just > might be the proverbial Last Bug. :-) Its because the stack is offset by -2047, to get the real stack pointer add 2047. If you look at how gcc addresses stack variables you'll see it adding in the bias. As for reasons why this was done, apparently it allows a larger region of stack to be addressed with 13 bit immediate offsets, also 32 bit sparc code doesn't use a stack bias so it can be distinguished by testing the alignment of the unmodified stack pointer. Jake To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030112155525.K212>