user403219
user403219

Reputation: 131

x86 64 assembly

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?

Upvotes: 2

Views: 2133

Answers (2)

Gunther Piez
Gunther Piez

Reputation: 30449

You need

movabs $0x1234567890abcdef, 0x550(%rax)

The movabs instruction is required for 64 bit immediates.

Upvotes: 12

Luke Peterson
Luke Peterson

Reputation: 8871

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

Upvotes: 0

Related Questions