I am a beginner of C and assembly code who currently working on an assembly project. However, I meet some problem with the indirect jump instruction.
The jmp instruction line is:
4006a6: ff 24 c5 50 08 40 00 jmpq *0x400850(,%rax,8)
When I go to 400850, the line is:
400850: ad lods %ds:(%rsi),%eax
400851: 06 (bad)
400852: 40 00 00 add %al,(%rax)
400855: 00 00 add %al,(%rax)
400857: 00 b3 06 40 00 00 add %dh,0x4006(%rbx)
40085d: 00 00 add %al,(%rax)
40085f: 00 bc 06 40 00 00 00 add %bh,0x40(%rsi,%rax,1)
Based on what I've learned, I should look at the address that stored in 400850 + 8 * rax, and jumps to that address to see instruction and do the specific operation. For example, if rax = 1, I should look at the address stored in 400858, but I cannot find 400858, and I also don't know what are the value such as "ab" mean, is it an address?
By the way, I believe this indirect jump represents an switch condition in the C code.
b3 06 40 00
, i.e. 004006b3 as a 32-bit little-endian (least significant first) word. It's often easier to look at a hex dump than disassembly when looking at data not code. – Rup0x400858
either. – Peter Cordes