I've started learning the Reverse Engineering and when I read the Stack Operations and function invocation, there are an issue that I'm confused. -What is the address of ESP after "pop ebp" and "retn" instruction??
C
int __cdecl addme(short a, short b)
{
return a+b;
}
Assembly
01: push ebp
02: mov ebp , esp
03:...
04:movsx eax ,word ptr [ebp+8]
05:movsx ecx ,word ptr [ebp+0Ch]
06:add eax ,ecx
07:...
08:mov esp , ebp
09:pop ebp
10:retn
As I though , esp is set to ebp in step 08 so the ESP address is right after the the first address comes inside the stack.But the step 09 makes it wrong. Help me understand this.