| curious_jp ( @ 2007-07-11 11:16:00 |
Hold! What you are doing to us is wrong! Why do you do this thing?
Apple, I don't understand the function prolog as documented in the IA32 Calling Conventions ABI Reference Document.
Apple, I don't understand the function prolog as documented in the IA32 Calling Conventions ABI Reference Document.
However, an example prolog for a function with 12 bytes of locals looks like this:
- Pushes the value of the stack frame pointer (EBP) onto the stack.
- Sets the stack frame pointer to the value of the stack pointer (ESP).
- Pushes the values of the registers that must be preserved (EDI, ESI, and EBX) onto the stack.
- Allocates space in the stack frame for local storage.
pushl %ebp movl %esp, %ebp subl $24, %espAs you can see, none of the so-called non-volatile registers were pushed, nor were they pushed by the call statement that led to this function as far as I can tell - they're certainly not where the ABI implies they should be. Despite this, a great deal more stack ( an additional twelve bytes ) was reserved than is necessary. I guess space was reserved for pushes of edi, esi and ebx, but as these registers weren't used by the function, they never got pushed, despite compiling without optimisations. Weird.