flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Named addressing spaces. Suggestion.

Author
Thread Post new topic Reply to topic
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 06 Apr 2010, 23:15
Hi there. I'd like to ask, if it's possible to make a following improvement in fasm. If one needs to do any sophisticated code encryption (not a very simple like the one described in the documentation), he possibly will confront a problem to get a code outside of a fasm virtual addressing space.
AFAIK the only one way to achieve this is to declare many symbolic constants loaded with parts (bytes, words, dwords...) of a code located in a virtual-block by means of a rept-block. Well... Except for one little problem this solution would be acceptable for me.
The "little problem" is that it's impossible to know the size of the code in a virtual-block in a preprocessing stage (rept directive processing stage). And I think, there is no effective solution to overcome this problem.
So my suggestion is to allow an optional name of addressing spaces.
Example of a code, using the suggested improvement (no encryption, just a very simple example of how it would look like):
Code:
org 0 named mainAS
dd 'abc'

virtual at 100h named virtualAS
   dd ?
        load mainCode dword from mainAS:$$
      store dword mainCode at $$
end virtual

org $
dd ?
def dd 'def'

load virtualCode dword from virtualAS:$$
store dword virtualCode at $$

load curCode dword from def
store dword curCode at virtualAS:$$    

This code sends some dwords back and forth. Hereby addressing space names are acting like special labels. As much as I can estimate this improvement would be fully backward compatible. So I see no disadvantages. Is there any reason for making no such improvement?
Post 06 Apr 2010, 23:15
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 07 Apr 2010, 03:58
I like this part Smile
Code:
org $    
Post 07 Apr 2010, 03:58
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20302
Location: In your JS exploiting you and your system
revolution 07 Apr 2010, 06:52
I think this is a good suggestion. I'm sure it could be useful in some places.

Currently fasm does not keep information about previous sections. It would require some not-so-simple changes to implement it. So I guess it comes down to would the time required to add this be outweighed by the benefit gained with this new feature?

l_inc: If you can produce a sample version of fasm with this feature working it might help you towards getting this implemented. No guarantee though. Just a suggestion for you so as to improve the likelihood of having it in official versions.
Post 07 Apr 2010, 06:52
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 07 Apr 2010, 08:33
If you watch the fasm 2 presentation video carefully, you are going to notice, that it has a similar feature with double colon syntax (it's on the fourth "slide"). You may also notice that there is something mentioned about difficulties of implementing it with fasm 1 architecture. Wink
Post 07 Apr 2010, 08:33
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 07 Apr 2010, 12:59
bitshifter
If you think, it does nothing in the real fasm, you're wrong. Wink
revolution
Quote:
Currently fasm does not keep information about previous sections. It would require some not-so-simple changes to implement it.

I understand it. But I think this is an enough useful feature to take a challenge. Smile
Quote:
If you can produce a sample version of fasm with this feature working it might help you towards getting this implemented.

I've never really looked into the fasm's source files. Just a couple of times without any purpose. And as long as the source is as flat as the assembler (I mean there're no text indents there), I considered it unreadable for that time. Smile No offense, but I think the author has much better understanding of fasm than I will ever have. Also I heard, that patches were never accepted.
Tomasz Grysztar
I think the presentation link is dead. At least it doesn't work for me. But thanks. I've never heard about the second version. If you say, there will be such feature in fasm 2, I believe you without watching the presentation video. Is there any hypothetical approximate terms for its first release?
And... As I understood, you have no intention to implement it in the first version, have you?
Post 07 Apr 2010, 12:59
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 15 Jun 2010, 16:10
in theory display as a reserved word could be a load/store operand and an intermediate buffer between address spaces maybe
Code:
load a byte from [display]
;etc
    

double fail i think, there is the only memory and Tomasz is still making the borders, i do not understand, possibly time lack of that man
Post 15 Jun 2010, 16:10
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 21 Jun 2010, 18:18
load RAW ...
store RAW ...
could solve the dilemma
Post 21 Jun 2010, 18:18
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 22 Jun 2010, 20:11
Could anyone show meaningful use of named addressing spaces outside of load context?

Tomasz, end virtual doesn't restore context exactly, was that intended?
Code:
use64
virtual
use16; comment it to compile successfully
end virtual
mov byte [rax], 0    
Post 22 Jun 2010, 20:11
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 22 Jun 2010, 23:02
VIRTUAL only creates an addressing space, it has nothing to do with code generation modes.
Post 22 Jun 2010, 23:02
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20302
Location: In your JS exploiting you and your system
revolution 20 Sep 2012, 23:56
See version 1.71 for the new address space naming feature.

http://board.flatassembler.net/topic.php?t=14608
Post 20 Sep 2012, 23:56
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 21 Sep 2012, 00:47
revolution
Thanks. I know. Downloaded it as soon as it was available. Smile It's getting better and better. I will be missing those tricky and creative solutions with in-place data modification and reordering. Smile
Post 21 Sep 2012, 00:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20302
Location: In your JS exploiting you and your system
revolution 21 Sep 2012, 04:24
l_inc wrote:
I will be missing those tricky and creative solutions with in-place data modification and reordering. Smile
Heh, I don't think I'll be missing them. Mr. Green
Post 21 Sep 2012, 04:24
View user's profile Send private message Visit poster's website Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 26 Sep 2012, 17:52
revolution wrote:
l_inc wrote:
I will be missing those tricky and creative solutions with in-place data modification and reordering. Smile
Heh, I don't think I'll be missing them. Mr. Green
I second this Laughing Debugging hundreds of made-on-the fly variables is not fun. I've already written AES in a fraction of the time and hopefully the larger SHA/WHIRLPOOL will be just as easy now too Cool
Post 26 Sep 2012, 17:52
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.