2

As far as I know 'jmp' by using a 64bit address as operand is impossible but I believe using a x64 memory location is (from here JMP r/m64). But how can I write this in hex?

Illustration of what instruction I want hex opcode of:

qword memAddress

jmp far qword ptr [memAddress]
1201ProgramAlarm
  • 32,384
  • 7
  • 42
  • 56
AnArrayOfFunctions
  • 3,452
  • 2
  • 29
  • 66

2 Answers2

1
jmp far qword ptr [memAddress]

For what it is worth. My assembler produces this : 48h,FFh,2Ch,25h,00h,00h,00h,00h

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
1

jmp far doesn't take a qword memory operand, it takes an 80-bit m16:64 operand to be loaded into CS:RIP.

I think you want to leave out the far and use an indirect near jump that only modifies RIP, not CS. You say you want JMP r/m64, and that's what this is.

In NASM syntax, qword is the default operand-size for indirect jumps:

default rel
label:
    jmp [rel label]

Assembles + disassembles (objdump -drwC -MIntel) to this:

ff 25 fa ff ff ff jmp QWORD PTR [rip+0xfffffffffffffffa] # 401000 <label>


See also Call an absolute pointer in x86 machine code if you pointer is an assemble-time constant, e.g. for JIT. (e.g. mov rax, 0x123456789ab / jmp rax or call rax is also an option.)

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847