这条 x86 指令中的 %r11d 中的 d 指的是什么?
What does d refer to in %r11d in this x86 instruction?
我有一个函数 fn(),它在堆栈上分配一个 64 字节的缓冲区,然后调用 gets 函数。 注意:我正在使用 gets 来覆盖堆栈上的 return 地址。
void fn() {
char buf[64];
gets(buf);
}
代码已使用修改后的本地客户端 gcc 编译器编译。如果我们查看地址 20243,我们会将栈顶弹出到寄存器 r11 中。然后,在下一行,我们将这个寄存器的内容移动到 %ebp.
但是,我不明白%r11d
最后的d指的是什么。我在 x86 指令集中找不到参考(也许我错过了)所以它可能是 GAS 语法吗?有人可以解释一下吗?
0000000000020220 <fn>:
20220: 55 push %rbp
20221: 48 89 e5 mov %rsp,%rbp
20224: 83 ec 40 sub [=11=]x40,%esp
20227: 4c 01 fc add %r15,%rsp
2022a: 8d 45 c0 lea -0x40(%rbp),%eax
2022d: 89 c7 mov %eax,%edi
2022f: 66 66 66 2e 0f 1f 84 data32 data32 nopw %cs:0x0(%rax,%rax,1)
20236: 00 00 00 00 00
2023b: e8 a0 12 00 00 callq 214e0 <gets>
20240: 48 89 ec mov %rbp,%rsp
20243: 41 5b pop %r11
20245: 44 89 dd mov %r11d,%ebp
20248: 4c 01 fd add %r15,%rbp
2024b: 41 5b pop %r11
2024d: 41 83 e3 e0 and [=11=]xffffffe0,%r11d
20251: 4d 01 fb add %r15,%r11
20254: 41 ff e3 jmpq *%r11
20257: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
引用自Gentle Introduction to x86-64 Assembly:
Register set extensions
X86-64 defines eight new integer registers named r8-r15. These registers are encoded using special REX prefix and so using them in non-64-bit instruction implies instruction length growth by 1 byte. They are named as follows:
rXb for 8 bit register (containing the lowest byte of the 64-bit value)
rXw for 16 bits
rXd for 32 bits
rX for 64 bits
我有一个函数 fn(),它在堆栈上分配一个 64 字节的缓冲区,然后调用 gets 函数。 注意:我正在使用 gets 来覆盖堆栈上的 return 地址。
void fn() {
char buf[64];
gets(buf);
}
代码已使用修改后的本地客户端 gcc 编译器编译。如果我们查看地址 20243,我们会将栈顶弹出到寄存器 r11 中。然后,在下一行,我们将这个寄存器的内容移动到 %ebp.
但是,我不明白%r11d
最后的d指的是什么。我在 x86 指令集中找不到参考(也许我错过了)所以它可能是 GAS 语法吗?有人可以解释一下吗?
0000000000020220 <fn>:
20220: 55 push %rbp
20221: 48 89 e5 mov %rsp,%rbp
20224: 83 ec 40 sub [=11=]x40,%esp
20227: 4c 01 fc add %r15,%rsp
2022a: 8d 45 c0 lea -0x40(%rbp),%eax
2022d: 89 c7 mov %eax,%edi
2022f: 66 66 66 2e 0f 1f 84 data32 data32 nopw %cs:0x0(%rax,%rax,1)
20236: 00 00 00 00 00
2023b: e8 a0 12 00 00 callq 214e0 <gets>
20240: 48 89 ec mov %rbp,%rsp
20243: 41 5b pop %r11
20245: 44 89 dd mov %r11d,%ebp
20248: 4c 01 fd add %r15,%rbp
2024b: 41 5b pop %r11
2024d: 41 83 e3 e0 and [=11=]xffffffe0,%r11d
20251: 4d 01 fb add %r15,%r11
20254: 41 ff e3 jmpq *%r11
20257: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
引用自Gentle Introduction to x86-64 Assembly:
Register set extensions
X86-64 defines eight new integer registers named r8-r15. These registers are encoded using special REX prefix and so using them in non-64-bit instruction implies instruction length growth by 1 byte. They are named as follows:rXb for 8 bit register (containing the lowest byte of the 64-bit value)
rXw for 16 bits
rXd for 32 bits
rX for 64 bits