x86堆栈指针指向何处? [英] x86 where stack pointer points?

查看:188
本文介绍了x86堆栈指针指向何处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如果我按下斧头,则[SP]指向我的斧头值还是斧头后的单词?从实模式到保护模式是否也有所不同?我之所以这样问,是因为汇编书中的技巧将sp指向并解释为最后推送的数据,并在此页面上 OSDev Wiki -堆栈,它说明了它在最后一次推送数据之后指向空字的情况.

For example if I pushed ax is [SP] points to my value of ax or the word after ax? Also is it differs from real mode to protected mode? I ask this because the Art of assembly book illustrates and explains as the sp points to last pushed data, and on this page OSDev Wiki - Stack it illustrated as it points to empty word after last pushed data.

推荐答案

维基百科说此处:

通过隐式递减(推)和 递增(弹出)堆栈指针.在16位模式下,此隐式堆栈 指针的地址为SS:[SP],在32位模式下为SS:[ESP],在 64位模式为[RSP]. 堆栈指针实际上指向最后一个 假设存储的值是与之匹配的 处理器的操作模式(即16、32或64位) 匹配推送/弹出/调用/退出指令的默认宽度.

The stack is implemented with an implicitly decrementing (push) and incrementing (pop) stack pointer. In 16-bit mode, this implicit stack pointer is addressed as SS:[SP], in 32-bit mode it is SS:[ESP], and in 64-bit mode it is [RSP]. The stack pointer actually points to the last value that was stored, under the assumption that its size will match the operating mode of the processor (i.e., 16, 32, or 64 bits) to match the default width of the push/pop/call/ret instructions.

这也是我的回溯记忆说的方式.

This is the way my way-back memory says it works, too.

这篇关于x86堆栈指针指向何处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆