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, 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


Home | Main Index | Thread Index | Old Index