2

I am writing a self modifying code.

movq      $TARGET_CIA, 0x550(%rax)

This symbol TARGET_CIA is undefined initially and at run time I try to copy a 64 bit immediate value to this location. But at compile time this instruction takes the value of this undefined immediate value as 32 bit and when i try to copy the 64 bits, I see the signed extended 32 bits at its place. Is there a way to get this undefined symbol treated as 64 bit value?

skaffman
  • 390,936
  • 96
  • 800
  • 764
user403219
  • 101
  • 1
  • 8

2 Answers2

12

You need

movabs $0x1234567890abcdef, 0x550(%rax)

The movabs instruction is required for 64 bit immediates.

Gunther Piez
  • 28,846
  • 6
  • 64
  • 101
0

I'd simply run another instruction to grab the second 32 bits. May not be the best way as I haven't done any ASM for a while, however it WILL work. :)

Good Luck Luke Peterson

Luke Peterson
  • 8,289
  • 8
  • 44
  • 46