flat assembler
Message board for the users of flat assembler.

Index > Main > PUSH multiple immediate trap when using unary negatives

Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 28 Mar 2005, 01:42
Be careful when using unary negatives within the PUSH immediate instruction. I got caught by an unexpexted outcome.

I started with this and all was okay:

Code:
infinity = 07fffffffh
use32
push -infinity   infinity ;this line okay, two PUSH opcodes generated
    


Later I rearranged the code to this:

Code:
infinity = 07fffffffh
use32
push  infinity  -infinity ;this line different, one "PUSH 0" instruction
    


The second push above is assembled as a binary negative.

One solution is this below:

Code:
infinity = 07fffffffh
use32
push  infinity 0-infinity ;this line okay, two PUSH opcodes generated
    
Post 28 Mar 2005, 01:42
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 28 Mar 2005, 07:31
You can just put brackets around it, can't you?
Code:
infinity = 7FFFFFFFh
use32
push infinity (-infinity)
    
Post 28 Mar 2005, 07:31
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 28 Mar 2005, 08:12
Yep, you can also put brackets. Another solution, thanks.
Post 28 Mar 2005, 08:12
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.