curious_jp ([info]curious_jp) wrote,
@ 2007-07-11 11:16:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
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.
  1. Pushes the value of the stack frame pointer (EBP) onto the stack.
  2. Sets the stack frame pointer to the value of the stack pointer (ESP).
  3. Pushes the values of the registers that must be preserved (EDI, ESI, and EBX) onto the stack.
  4. Allocates space in the stack frame for local storage.
However, an example prolog for a function with 12 bytes of locals looks like this:
pushl   %ebp
movl    %esp, %ebp
subl    $24, %esp
As 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.


Advertisement


(Read 1 comment)

Post a comment in response:

From:
Help
Identity URL: 
Username:
Password:
Don't have an account? Create one now.
Subject:
No HTML allowed in subject
   Help
Message:
 
Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…