Talk:Stack

From OSDev Wiki
Jump to: navigation, search

The page says using ebp for a stack frame is part of the cdecl calling convention. That's not true. Ebp is not "special" in cdecl. It should be treated as any other non-volatile register (ebx, esi, edi, etc...).

EBP pointer is incorrect

I'm pretty new to assembly so bare with me: I think all of the references to EBP are incorrect on this page. On x86, the push instruction steps the value of ESP and then stores the value, so that ESP always points to the last value pushed onto the stack, not the next free position.

Therefore in the prologue of a routine, when you PUSH EBP and then MOV EBP, ESP, the resulting value of EBP should point to the saved EBP value (the last thing that was pushed), where as all the diagrams on this page show it pointing to the next position after the saved EBP. This also means that all the offsets used to access local variables and especially parameters are incorrect.

I'm happy to update the page, but since I want to make sure I'm not missing something before I do. Can anyone comment on this before I edit?

I agree that diagram needs to be updated. I also find it a bit ambiguous for it to have both a "First caller" and a "Routine 1" so perhaps you will use better notation for that, while you're at it. It would be particularly nice to have an actual figure, like some of the other articles do---but only if you have the time. --Love4boobies 07:12, 28 March 2013 (CDT)
Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox