flat assembler
Message board for the users of flat assembler.

Index > Main > error: value out of range.

Author
Thread Post new topic Reply to topic
monasguy



Joined: 12 Jan 2021
Posts: 2
monasguy
I am receiving the following error:

flat assembler version 1.73.25 (1048576 kilobytes memory)
afh3eSqr.asm [52]:
cmp r14, 2147483648
processed: cmp r14,2147483648
error: value out of range.


The largest value I can use is 7FFF FFFFh (2,147,483,647)

Wondering why this is so when r14 is a qword ?

Thanks[/i]
Post 29 Jan 2021, 12:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18222
Location: In your JS exploiting you and your system
revolution
In 64-bit mode all immediate encodings are signed 32-bits maximum.

So if you encode 0x8000_0000 as an immediate then it gets sign extended to 0xffff_ffff_8000_000 internally before the cmp is executed.

You can encode all 64-bits with mov.
Code:
mov rcx,0x8000_0000 ; not sign extended
cmp r14,rcx    
Post 29 Jan 2021, 13:03
View user's profile Send private message Visit poster's website Reply with quote
monasguy



Joined: 12 Jan 2021
Posts: 2
monasguy
Thanks Wink
Post 29 Jan 2021, 16:01
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.