【问题标题】:instruction's argument order指令的参数顺序
【发布时间】:2012-09-23 12:55:58
【问题描述】:

函数 main 的汇编代码转储:

0x0000000100000de6 <main+0>:    push   %rbp
0x0000000100000de7 <main+1>:    mov    %rsp,%rbp
0x0000000100000dea <main+4>:    sub    $0x30,%rsp
0x0000000100000dee <main+8>:    mov    %edi,-0x14(%rbp)

我了解到mov %rsp,%rbp 的意思是move the value of rsp to rbp
但我知道在英特尔架构中,这意味着move the value of rbp to rsp 根据 Intel 手册(Intel Architecture Software Developer's Manual. Volume 2. 3-104 MOV instructions),mov a, b 应该表示move b to a

接下来的sub 指令是一样的。 我知道sub a,b 的意思是a = a-b。但这里sub $0x30, %rsp 表示rsp = rsp - 0x30

我怎么了?

【问题讨论】:

  • % 无处不在,无意义的内存语法和本应不可能的指令。全部指向 AT&T 语法。

标签: assembly gdb x86-64 att


【解决方案1】:

你没事。您在这里展示的是 AT&T 语法中的汇编代码(google it up),其中操作数的顺序与您在英特尔手册中看到的相反。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-04
相关资源
最近更新 更多