flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > x64 code 'push' bug |
Author |
|
revolution 02 Mar 2008, 12:17
It is a limitation with the X86-64 CPU encoding, not a fasm bug. It is not possible to encode constants that don't fit into a 32bit signed value, with one exception when you load it into a register.
Notice that "mov rbx,[qword 0x123456789ABCDEF1]" also fails with 'Out of range'. There is no way to encode that within the instruction set. To clarify:
Last edited by revolution on 02 Mar 2008, 13:17; edited 3 times in total |
|||
02 Mar 2008, 12:17 |
|
asmfan 02 Mar 2008, 12:44
revolution wrote:
Assembles well with "use64" mov accepts imm64 _________________ Any offers? |
|||
02 Mar 2008, 12:44 |
|
revolution 02 Mar 2008, 12:50
asmfan wrote:
I edited it above so as to any avoid confusion. |
|||
02 Mar 2008, 12:50 |
|
asmfan 02 Mar 2008, 13:05
Seems that fasm have a bug assembling "MOV RAX, moffset64"
|
|||
02 Mar 2008, 13:05 |
|
Tycho 02 Mar 2008, 13:14
Thank you all, I was confused because command push 0xFFFFFFFF and push 0x80000002 do work under 32-bit mode but doesn't under 64-bit mode. Will need to write them to the register first!
|
|||
02 Mar 2008, 13:14 |
|
revolution 02 Mar 2008, 13:15
asmfan wrote: Seems that fasm have a bug assembling "MOV RAX, moffset64" |
|||
02 Mar 2008, 13:15 |
|
asmfan 02 Mar 2008, 13:32
Yes, it works if "qword" specified. But why not without? Can you explain this?
|
|||
02 Mar 2008, 13:32 |
|
vid 02 Mar 2008, 15:55
because in that case it won't use RIP relative addressing, and so code is no longer position independent. If you want absolute address, you must be specific.
|
|||
02 Mar 2008, 15:55 |
|
asmfan 02 Mar 2008, 16:05
I thought relative can be only labels but not immediates, thanks for ansver btw
|
|||
02 Mar 2008, 16:05 |
|
vid 03 Mar 2008, 00:25
in 64bit mode there is RIP-relative addressing which is used in memory addressing by default. search board for "RIP relative addressing" and study
|
|||
03 Mar 2008, 00:25 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.