为什么AT&T jmp * bar汇编到带有SIB字节的机器代码?指令中没有使用寄存器

问题描述 投票:2回答:1

我在x86机器上有这个绝对的间接跳转指令:

ff 24 25 30 10 60 00

这是由:

jmp *bar

但我解码它的第二个和第三个字节时遇到了麻烦。

第二个应该是Mod R / M字段。所以它转化为:

00 100 100

含义:

00 - 没有位移的记忆(但是它有恒定的地址,不是这个“位移”吗?)

100(dec.4) - 扩展操作。代码(FF / 4 => JMP r / m32)

100 - ?? SIB?但是该指令中没有使用寄存器


附:一些背景:

Breakpoint 4, test () at test.s:13
13              jmp     *bar
(gdb) disassemble /r
Dump of assembler code for function test:
   0x000000000040051b <+0>:     c7 04 25 30 10 60 00 2f 05 40 00        movl   $0x40052f,0x601030
=> 0x0000000000400526 <+11>:    ff 24 25 30 10 60 00    jmpq   *0x601030
   0x000000000040052d <+18>:    87 c0   xchg   %eax,%eax
   0x000000000040052f <+20>:    c3      retq   
End of assembler dump.
(gdb) list
8               bar: .word 0x0
9       .text
10      test:
11      .LFB0:
12              movl    $label1, bar
13              jmp     *bar
14              xchg    %eax, %eax
15              label1:
16              ret
17      .LFE0:
(gdb) 
assembly x86-64 gas att
1个回答
5
投票

操作数字节24 25表示具有32位位移的绝对寻址模式,即没有基址寄存器而没有索引寄存器。在64位模式下,这与相对寻址模式不同,32位位移由modr / m字节25表示(但在32位模式下则不是)。如果您想要后一种寻址模式,请在AT&T语法中编写jmp *bar(%rip)

© www.soinside.com 2019 - 2024. All rights reserved.