What effect these two instructions cause in the assembly code generated by gcc for x86 machines:
push %ebp
movl %esp, %ebp
I also think that it is important to note that often after
push %ebp
and
movl %esp, %ebp
the assembly will have push %ebx
or push %edx
. These are caller saves of the registers %ebx
and %edx
. At the end of the routine call the registers will be restored with their original values.
Also - %ebx, %esi, %edi
are all callee save registers. So if you want to overwrite them you need to save them first, then restore them.