flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > fs add word[$],$ != add word[fs:$],$

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


Joined: 24 Aug 2004
Posts: 20124
Location: In your JS exploiting you and your system
revolution 18 Mar 2023, 01:18
Code:
fs add word[$],$ ; <-- what is the value of $ here?    
The expected output is:
Code:
64 83 06 00 00 00    
But the fs prefix is processed then ignored and the actual output is:
Code:
64 83 06 01 00 01    
The same goes for any prefixes, lock included.

This can be partly overcome by moving fs inside the brackets
Code:
add word[fs:$],$    
But that trick can't be used for lock.
Code:
lock add byte[$],$ ; <-- not the address expected    
Post 18 Mar 2023, 01:18
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8344
Location: Kraków, Poland
Tomasz Grysztar 18 Mar 2023, 07:32
Yes, explicit prefixes were implemented in fasm in a very simplistic way. And apparently I did not consider it an issue, because when implementing fasm-compatible x86 encoders for fasmg, I did reproduce this exact behavior. Well, at least they are consistent.
Post 18 Mar 2023, 07:32
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.