Okay so I am wondering how EBP (Extended Base Pointer) works? I know it has something to do with stack frames, but what exactly is that?
Okay so I am wondering how EBP (Extended Base Pointer) works? I know it has something to do with stack frames, but what exactly is that?
It's 32bit register pointing to the current stack frame. You'll find it mainly in the cdecl calling convention (function parameters are pushed on the stack in a right-to-left order). If you don't know what the stack is, I'm well wondering why you're even asking about EBP.
I know what the stack is, I now know a little more about how it works, I am looking at something else and wondering about this...
push ebp
mov ebp, esp
So EBP points to the return address of the caller that EBP, EBP+4 equals a paramater and ebp-4 would be like a local variable, correct if wrong...
Why would you want to move ESP to ebp?? Why not just use ESP, i am confused.
it pushes ebp onto the stack so it can be retrieved after the operation has been completed (somewhere following it should pop ebp from the stack) otherwise they should have just set ebp to esp and ignored, I'm sure iret works the same as pop ebp ret although my asm is a little rusty