为什么离开做" MOV ESP,EBP"在x86汇编? [英] Why does leave do "mov esp,ebp" in x86 assembly?
本文介绍了为什么离开做" MOV ESP,EBP"在x86汇编?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人说,在离开
指令是一样的:
It's said that the leave
instruction is the same as :
mov esp,ebp
pop ebp
但是,什么是 MOV ESP,EBP
这里?它似乎没有有效的给我...
But what is mov esp,ebp
here for? It doesn't seem valid to me...
推荐答案
MOV ESP,EBP
设置堆栈指针在底座的地址,有效地释放了整体框架。 (不要忘记,这是英特尔的语法,目标是第一位的。)如果你没有做到这一点,一旦你叫 RET
,你仍然会使用被叫函数的栈帧与你通话功能,具有crashtastic后果。
mov esp,ebp
sets the stack pointer to the base frame address, effectively releasing the whole frame. (Don't forget that this is Intel syntax, the destination comes first.) If you didn't do it, once you call ret
, you would still be using the called function's stack frame with your calling function, with crashtastic consequences.
这篇关于为什么离开做" MOV ESP,EBP"在x86汇编?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文