关于堆栈指针的简单汇编问题

发布于 2024-10-20 10:55:42 字数 105 浏览 9 评论 0原文

我目前正在学习汇编程序并在实模式下编写一些程序。我在理解堆栈方面遇到了一些麻烦。如果 SS 不为零且 SP = 0,是否可以将值推送到堆栈中。(如果可能,那么 cpu 在推送后如何更改寄存器的值)

I'm currently learning assembler and writing some program in real mode. I have some troubles with stack understanding. Is it possible to push value in the stack if SS is not zero and SP = 0.(and if it's possible then how cpu changes the values of the registers after the push)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰雪梦之恋 2024-10-27 10:55:42

是的,这是可能的,但您通常不希望这样做。如果你这样做,SP 将从 0 到 65536 环绕,像往常一样与 SS 组合,你将写入任何有效的地址。在典型情况下,它会覆盖堆栈底部的某些内容,当您返回依赖于先前内容的代码时,行为将是不可预测的(快速崩溃是您所能期望的最好结果)那个点)。

Yes, it's possible but you'd generally prefer not to. If you do it, the SP will wrap around from 0 to 65536, be combined as usual with SS, and you'll write to whatever address that works out to. In a typical case, it'll overwrite something that was at the base of the stack, and when you return to code that depends on the previous content, the behavior will be unpredictable (a quick crash is about the best you can hope for at that point).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文