flat assembler
Message board for the users of flat assembler.

Index > Main > 0x80000000: "value out of range" in 64-bit mode.

Author
Thread Post new topic Reply to topic
magicSqr



Joined: 27 Aug 2011
Posts: 105
magicSqr
I'm using the following

Code:
format PE64 console
entry start

include '%fasminc%\win64ax.inc'

section '.text' code readable executable

    start:
        add     rax, 0x080000000
        invoke  ExitProcess

;*************************************
section '.idata' import data readable writeable

library kernel32, 'kernel32.dll'
include '%fasminc%\api\Kernel32.inc'    


and get a 'value out of range' error.
Post 09 Aug 2012, 22:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
Indeed. 0x800000000 is 2^35. The x86 encoding mechanism for immediate values only allows 32-bit signed values with ADD in 64-bit mode.
Post 09 Aug 2012, 22:45
View user's profile Send private message Visit poster's website Reply with quote
magicSqr



Joined: 27 Aug 2011
Posts: 105
magicSqr
Thanks revolution.

I actually put too many zeroes in my OP, it's

add rax, 0x080000000

i.e. a 32-bit number, although as a signed it is negative.

I'll just use

add rax, 0x7FFFFFFF
inc rax

or else place the value in memory and add it from there
Post 09 Aug 2012, 22:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
Or you can use MOV.
Code:
mov rcx,0x123456789abcdef0
add rax,rcx    
Post 10 Aug 2012, 00:54
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Code:
sub     rax, -0x080000000    
Post 10 Aug 2012, 15:32
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.