【问题标题】:What is the "-4" for in assembler: movl $1, -4(%rbp) [duplicate]汇编程序中的“-4”是什么: movl $1, -4(%rbp) [重复]
【发布时间】:2021-01-15 05:16:46
【问题描述】:
int x=1;
int y=2;
int z=3;

变成

movl    $1, -4(%rbp)
movl    $2, -8(%rbp)
movl    $3, -12(%rbp)

-4,-8,-12 是什么意思? 为什么是4分? 4 字节 = 32 位?

【问题讨论】:

    标签: assembly x86-64 att addressing-mode


    【解决方案1】:

    -4 / -8 / -12 字节相对于rbp 中保存的地址,即pointer to the top of the stack(向下增长)。 4 字节/32 位,因为这是您机器上 int 的大小。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-31
      • 2017-03-29
      • 1970-01-01
      • 1970-01-01
      • 2017-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多