Search code examples
assemblyx86-64machine-codeinstructionsopcode

Opcodes:hexadecimal assembly instructions


The page at http://ref.x86asm.net/coder64.html#xF0 gives various hexadecimal opcodes.

In my Visual studio dissambly, i have

FF E0 jmp rax

I just found pasting 'jmp rax' and assembling in https://defuse.ca/online-x86-assembler.htm#disassembly gives the corresponding hex opcode ( FF E0 in this case).

But is there any manual or documentation showing how can we find out the hex equavalent of jump instructions.( eg. i want to find out equivalent of jmp rbx ) Thanks


Solution

  • Yes, the Intel SDM, volume 2, has complete information on encoding instructions.

    Felix Cloutier’s site contains the same information in a web-friendly format.

    This page of that site covers the jmp instruction. It shows that jmp rm32 is encoded as ff /4. The /4 represents three bits of the rmmod byte (bits 5:3) that serve as an extension to the instruction. The other bits encode the source. Bits 7:6 are 11 to indicate a register. Bits 2:0 identify which register. In ff e0, bits 2:0 are 000 indicating rax. To use rbx, bits 2:0 would be 011, giving ff e3.