I am new to Assembly and reading about calling convention in x86 .
In one of the example below .
cdecl int MyFunction1(int a, int b)
{
return a + b;
}
x = MyFunction1(2, 3);
_MyFunction1:
push ebp
mov ebp, esp
mov eax, [ebp + 8]
mov edx, [ebp + 12]
add eax, edx
pop ebp
ret
push 3
push 2
call _MyFunction1
add esp, 8
I am able to understand most part of the given code but have doubt on one line where pop ebp has been done.
I think right call will be "pop [ebp+4]" because after push ebp , mov ebp ,esp is performed which cause ebp pointer to decremented by 4 and hence to reach to original position have to add 4 bytes to ebp.