assembly - 指令的参数顺序

标签 assembly gdb x86-64 att

函数 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意味着将rsp的值移动到rbp
但我知道在英特尔架构中,这意味着将 rbp 的值移至 rsp 根据Intel手册(Intel Architecture Software Developer's Manual. Volume 2. 3-104 MOV instructions),mov a, b应该表示将b移动到a

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

我这是怎么了?

最佳答案

你没有什么问题。您在这里提供的是 AT&T 语法中的汇编代码(google 一下),其中操作数顺序与您在英特尔手册中看到的相反。

关于assembly - 指令的参数顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12552517/

相关文章:

c - 为什么会发生字节溢出以及它们的作用是什么?

c++ - 在没有源代码的情况下使用 gdb 进行调试

c - 获取C 中函数的地址?

c - 遍历堆栈

assembly - 来自 asm/C 的 LLVM StackMap 链接错误

c - 在嵌入式系统中从汇编语言切换到 C 语言

assembly - 使引导加载程序和内核成为iso?

c++ - Mac OS X Yosemite C++ Eclipse 错误 : "Error while launching command: gdb --version"

c - 使用 math.h 函数时 gdb 给出奇怪的输出

x86-64 : when are structs/classes passed and returned in registers? 上的 C++