I'm trying to teach myself x86, and I've run across the need to return an immediate, negative number:
.text
.align 4,0x90
.globl _scheme_entry
_scheme_entry:
movl $-42, %eax
ret
When I print the return-value of this function (printf("%" PRIdPTR "\n", scheme_entry())
, I get a nonsense number:
$ ./neg
4294967254
I'm guessing this is because it's a 32-bit negative, 00000000FFFFFFFF, instead of a 64-bit negative, FFFFFFFFFFFFFFFF.
How can I store a constant 64-bit value directly in an assembler function? Do I have to encode it as two separate instructions?