Author Topic: 64bit: JMP near encoding  (Read 18015 times)

nobody

  • Guest
64bit: JMP near encoding
« on: December 15, 2008, 09:27:59 PM »
Hello,

What is the syntax for a 64-bit absolute jump in NASM?

For instance:
[BITS 64]
jmp 0x1234567890ABCDEF

According to the Intel manuals this should be encoded with opcode FF but NASM keeps using opcode E9.

Thanks,
-Ian

nobody

  • Guest
Re: 64bit: JMP near encoding
« Reply #1 on: December 29, 2008, 02:36:05 AM »
There is no 64-bit absolute jump.
This is not a NASM issue.
This is an instruction set issue.

Absolute jumps use EB, E9, or EA.  There is no 64-bit form of these instructions.

Indirect jumps use FF /4 or FF /5.  There are 64-bit forms of these instructions.  The instruction obtains the 64-bit form, near or m64 for FF/4, far or m16:m64 for FF/5, from memory using a (32-bit) offset encoded as part of the instruction.

I.e., to do a jump to 0x1234567890abcdef, you'd need to use one of the indirect jump forms to effect a 64-bit absolute jump.  E.g., (untested) you'd need to do something similar to this:

jmp qword near [my_far_jmp]

my_far_jmp:
 dq 0x1234567890abcdef


Rod Pemberton