1

I am writing the instruction below.

movq      $TARGET_CIA, %rcx

TARGET_CIA is an undefined variable so is treated as zero. This instruction's disassembly looks like

 0:   48 c7 c1 00 00 00 00    mov    $0x0,%rcx

At run time, I want to replace this $TARGET_CIA with a 64-bit value by copying the 64-bit value to the offset of TARGET_CIA symbol. Please let me know how this can this be done.

phuclv
  • 32,499
  • 12
  • 130
  • 417
user403219
  • 101
  • 1
  • 8

1 Answers1

1

In fasm you would achieve that with "mov [qword 0], rax". Note that AL, AX, EAX, RAX are the only registers allowed to be the source or destination of an instruction with 64-bit absolute addressing so you won't be able to use RCX here (copy the value to RAX)

If your assembler has no means to force full addressing, then use:

db 0x48, 0xA3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
LocoDelAssembly
  • 768
  • 7
  • 10