What is the use of “push

前端 未结 6 1621
我寻月下人不归
我寻月下人不归 2020-12-23 09:38

What effect these two instructions cause in the assembly code generated by gcc for x86 machines:

push %ebp
movl %esp, %ebp
6条回答
  •  伪装坚强ぢ
    2020-12-23 10:09

    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.

提交回复
热议问题