0

I'm trying to understand x86-64 assembly and today I came across the following:

I can do something like this:

mov $0x74786574656d6f73, %rax #compiles to movabs
push %rax

While i can't do the following:

push $0x74786574656d6f73 #8-byte

I'm getting Error: operand type mismatch for push I checked, and I can see, that there is no problem with doing:

push $0x74786574 #4-byte, compiles to pushq 

Does it mean that I cannot push 8-byte immediate values on stack?

agienka
  • 396
  • 1
  • 2
  • 11
  • Default operand size in 64-bit mode is still 32-bit and 64-bit immediates are allowed only with `mov` instruction. See https://software.intel.com/sites/default/files/managed/a4/60/325383-sdm-vol-2abcd.pdf paragraph 2.2.1.5 Immediates – Alexander Zhak May 02 '17 at 11:25
  • `movabs` is just AT&T syntax for a `mov` with a 64-bit immediate operand. It's not really different from `mov`, your disassembler just uses AT&T syntax, so it shows it with a different mnemonic. Speaking of which, assembly code doesn't "compile", it just assembles. And, in answer to your question, no, there is no instruction to push a QWORD (64-bit) immediate value onto the stack. – Cody Gray - on strike May 02 '17 at 11:28
  • Thank you guys, that explains a lot. – agienka May 02 '17 at 11:31

0 Answers0