Sparc assembly: In 64 bit sparc assembly we use 2047 byte as BIAS space in every stack creation, What is the use of having it?
-
In sparc 64 bit architecture, whenever there is a stack creation for a function, Stack pointer is moved as (size of stack + 2047) of course these many bytes are subtracted from stack pointer as stack moves downward in the memory . What is the use of adding this BIAS (2047) to the stack size. I was reading about this, some comments were like it is beneficial for the dynamic linker or OS to check whether the binary is 32 bit or 64 bit compiled. I don't think this is the valid justification for the above. Any comments ?
-
Answer:
Probably a good place to look is the "SPARC Assembly Language Reference Manual". There is a section that talks about the 32/64-bit BIAS slots that are used for function arguments: http://docs.oracle.com/cd/E26502_01/html/E28387/gentextid-2734.html Also if you look in the SPARC v9 API reference document, there is a description that gives a little more insight on page 25: "Every stack frame must have a 16-extended-word save area for the in and local registers, in case of window overflow or underflow. This save area always must exist at %sp plus a BIAS of 2047 (0x7ff)." The link to that document is here: http://www.sparc.com/standards/64.psabi.1.34.ps.Z
Octave Orgeron at Quora Visit the source
Other answers
The BIAS serves two purposes. One you noted, to distinguish between a 32 bit and 64 bit binary, since the stack pointer and the frame pointer will always be even on a 32 bit binary and will always be odd on a 64 bit binary. The other is to increase the range of the stack directly accessible via immediate addressing. One address mode on SPARC is to address relative to a register (in this case either %sp or %fp) plus a signed 13 bit signed constant embedded in the instruction itself. Since it is signed, that means that we are talking about a 12 bit magnitude range. The stack pointer %sp is constantly moving as we add and remove things from the stack, so it is not very useful for addressing local storage on the stack. That leaves the frame pointer %fp, which remains constant. But half of the range of the %fp plus a 13bit signed constant is outside of the current stack frame, since the frame pointer points to one end. By adding in the BIAS, we move the frame pointer to pointing somewhere in the middle of the frame instead of at one end, so now it has a larger range that is accessible with immediate addressing.
Brian Utterback
Related Q & A:
- Where And What Is The Use Of A Hyphen?Best solution by English Language and Usage
- In Visual Studio 2012 or 2013, how can I register a DLL file on Windows 7 64-bit computer using a Custom Action command?Best solution by Stack Overflow
- What printers are compatible with Windows 7 64 Bit?Best solution by amazon.com
- What's a good webcam compatible with windows 7 64-bit?Best solution by tomshardware.com
- Do I have a 32 bit or a 64 bit CPU?Best solution by computerhope.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.