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
  • 37,963
  • 15
  • 156
  • 475
user403219
  • 121
  • 2
  • 8
  • 1
    possible duplicate of [Load from a 64-bit address into other register than rax](http://stackoverflow.com/questions/19415184/load-from-a-64-bit-address-into-other-register-than-rax) The other is newer, but more clear, as this question does not say the error message or compilation comand. Likely the problem of the OP here is the impossible mov to `%rcx`. – Ciro Santilli OurBigBook.com May 25 '15 at 08:37

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
  • 818
  • 8
  • 10