该问题与 Assembly x86-32 RET n 指令有关 [英] The question is related to Assembly x86-32 RET n instruction
问题描述
我知道 Ret n 的含义,但我无法弄清楚它在维护程序运行时堆栈方面的作用?我有点困惑.ret 与堆栈有关吗?
I know the meaning of Ret n but I can't figure out its role to maintaining program's runtime stack? I'm kind of confuse there. Do ret have somethig to do with stack?
推荐答案
ret n
就像 ret
+ add esp, n
.您将其用于 caller-pops 调用约定.
ret n
is like ret
+ add esp, n
. You use it for caller-pops calling conventions.
Plain ret
就像 pop eip
.(pop eip
不是有效的指令,但它很好地表达了 ret
的作用).是的,它使用堆栈;阅读文档.http://felixcloutier.com/x86/RET.html(特别是接近回报"部分.)
Plain ret
is like pop eip
. (pop eip
isn't a valid instruction, but it nicely expresses what ret
does). Yes it uses the stack; read the documentation. http://felixcloutier.com/x86/RET.html (specifically the "near return" part.)
far ret"更复杂,但不用于具有平面内存模型的 32 位或 64 位代码.即在正常代码中根本不使用.
"far ret" is more complicated, but not used in 32 or 64-bit code with a flat memory model. i.e. not used at all in normal code.
这篇关于该问题与 Assembly x86-32 RET n 指令有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!