Search code examples
assemblyx86machine-instruction

What are the Absolute Far Jump Operands in X86


What are the operands to perform an absolute Far Jmp?

I think it should look something like below:

EA XX XX XX XX

I tried making XX XX XX XX a 4 byte address to which I wanted to jump, but it didn't work as intended.


Solution

  • This will be an absolute far jump.

    For example, for 16-bit code the bytes 0xEA, 0x12, 0x34, 0x56, 0x78 wll be the instruction jmp far 0x7856:0x3412 (where CPU will try to set CS to 0x6745 and set IP to 0x3412).

    For 32-bit code the size needs to be larger. E.g. the bytes 0xEA, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC will be the instruction jmp far 0xBC9A:0x78563412 (where CPU will try to set CS to 0xBC9A and set EIP to 0x78563412).

    In other words, the operands are the target 16-bit IP (or 32-bit EIP) followed by the target code segment; with both pieces in little-endian order.