Port-sparc64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Stack bias



On Mon, 10 Aug 2009 15:57:42 +0000 (UTC)
Eduardo Horvath <eeh%NetBSD.org@localhost> wrote:

> On Mon, 10 Aug 2009, raymond.meyer%rambler.ru@localhost wrote:
> 
> > Hi, I'm reading Sparc V9 ABI document, which talks about stack bias.
> > Could anyone explain why there is a stack bias and what the stack
> > looks like with the bias, i.e. is it something I need to worry
> > about when writing sparc assembly?
> 
> You only need to worry about it if you do loads/stores to the stack
> or something to the stack pointer other than allocating a stack
> frame.  
> 
> The bias is -0x7ff.  It allows the kernel to determine if it needs to
> use 32-bit or 64-bit memory operations when saving or restoring a
> register window.  It also allows you to address more of the stack
> using 13-bit signed constants without having to add extra
> instructions for larger arithmatic.
> 
> If only neet to use window registers in your function, issuing a save
> with the 64-bit stack frame size will work for both 32-bit and 64-bit
> code.  On the other hand, if you ever need to issue a load or store
> to a stack location yourself you need to add in the appropriate stack
> bias or you will get an unaligned access exception (bus error).
> 
> Eduardo

OK, how does bias of 2047 allow to address more stack space, vs. 32-bit
mode with no bias? What's the stack limit in 64 and 32-bit modes?


Home | Main Index | Thread Index | Old Index