我有一个函数 fn() 在堆栈上分配一个 64 字节的缓冲区,然后调用gets 函数。 注:我正在使用 get 来覆盖堆栈上的返回地址。
void fn() {
char buf[64];
gets(buf);
}
代码已使用针对 Native Client 的修改后的 gcc 编译器进行编译。如果我们查看地址 20243,我们将栈顶弹出到寄存器 r11。然后,在下一行,我们将这个寄存器的内容移动到 %ebp 中。
但是,我不明白 是什么意思d 末
%r11d
指。我在 x86 指令集中找不到引用(也许我错过了)所以它可能是 GAS 语法吗?有人可以解释一下吗?0000000000020220 <fn>:
20220: 55 push %rbp
20221: 48 89 e5 mov %rsp,%rbp
20224: 83 ec 40 sub $0x40,%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 $0xffffffe0,%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
关于assembly - 在此 x86 指令中, %r11d 中的 d 指的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31609501/