程序栈的增长方向究竟是什么? [英] what exactly is program stack's growth direction?

查看:26
本文介绍了程序栈的增长方向究竟是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 Richard Blum 的Professional Assembly Language,我对书中的不一致感到困惑,我想知道程序堆栈的增长方向到底是什么?这是第312页的图片,这表明程序堆栈长大了.

I'm reading Professional Assembly Language by Richard Blum,and I am confusing about a Inconsistency in the book and I wondering what exactly is program stack's growth direction? This is the picture from page 312, which is suggesting that program stack grows up.

但是当我到达第 322 页时,我看到另一个版本,这表明程序堆栈变小了.

But when I reached page 322,I see another version, which suggesting that program stack grows down.

还有这个

推荐答案

书不矛盾;每张图都在顶部显示更高的地址.

The book is not inconsistent; each drawing shows higher addresses at the top.

第一张图展示了一个向下增长的堆栈.调用者将参数压入堆栈,然后调用新函数.调用的行为将返回地址压入堆栈.然后被调用者将基指针的当前值压入堆栈,将堆栈指针复制到基指针中,并递减堆栈指针以为被调用者的局部变量腾出空间.

The first drawing illustrates a stack that grows downward. The caller pushes parameters onto the stack, then calls the new function. The act of calling pushes the return address onto the stack. The callee then pushes the current value of the base pointer onto the stack, copies the stack pointer into the base pointer, and decrements the stack pointer to make room for the callee's local variables.

这篇关于程序栈的增长方向究竟是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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