flat assembler
Message board for the users of flat assembler.

Index > Main > port import64.inc to fasmg

Author
Thread Post new topic Reply to topic
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 06 May 2018, 16:23
I can't port this macro to famsg syntax, in order to make dynamically linked elf executable s Wink

Glad if someone helps.
Post 06 May 2018, 16:23
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 May 2018, 18:01
The conversion is quite straightforward - see the attachment.


Description: Dynamically linked ELF executables - converted to fasmg
Download
Filename: dynelf.zip
Filesize: 3.8 KB
Downloaded: 768 Time(s)

Post 06 May 2018, 18:01
View user's profile Send private message Visit poster's website Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 06 May 2018, 18:29
Thanks, it works!

one thing there is no rdtscp and movsd instruciton reports error extra characters.
Post 06 May 2018, 18:29
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 May 2018, 18:40
Melissa wrote:
one thing there is no rdtscp and movsd instruciton reports error extra characters.
Does the problem with MOVSD occur in 32-bit case? You need to include "sse2.inc" then to have SSE2 instructions enabled. For 64-bit "sse2.inc" is already included automatically, since x64 implies it.

As for the RDTSCP, it is actually missing, I'm going to add it.
Post 06 May 2018, 18:40
View user's profile Send private message Visit poster's website Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 06 May 2018, 18:45
I use 64 bit, seems that definition in x64.inc intersects with definition in sse2.inc as without
arguments, movsd compilation passes.
Post 06 May 2018, 18:45
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 May 2018, 18:49
This might happen of you include SSE extensions before x64.inc gets included (and x64.inc gets included automatically by "format" macro). I'm going to modify it so that it is more resistant to such reordering.
Post 06 May 2018, 18:49
View user's profile Send private message Visit poster's website Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 06 May 2018, 18:53
Nope, I tried to include before / after format.inc it's all the same. If I comment out movsd definition from x64.inc, it works alright.
Post 06 May 2018, 18:53
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 May 2018, 18:58
I'm not able to reproduce the problem then, can you show the minimal source that causes it?
Post 06 May 2018, 18:58
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 06 May 2018, 19:18
In the mean time I have update the official packages with the corrected macros, reordering includes should now not cause this problem.

I added "rdtscp" as a separate file in "ext" directory, because it is a separate instruction set extension - it has its own CPUID flag.
Post 06 May 2018, 19:18
View user's profile Send private message Visit poster's website Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 06 May 2018, 19:18
Code:
include 'format/format.inc'
include 'ext/avx2.inc'
format elf64 executable
segment executable
entry $
    movsd xmm0,[clock]
    mov eax, 60
    syscall
segment readable
clock dq 3800.0
    


That is if I include avx2, if I don't compilation passes.
Post 06 May 2018, 19:18
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 May 2018, 19:20
As I said above, it is the "format" macro that includes basic instruction sets, not the inclusion of "format.inc". So to avoid the problem you should have included AVX2 after the "format elf64 executable" line.

Now as I think of it, since the "format" macro is there to provide some level of fasm 1 compatibility, I should perhaps make it include all the instruction set extensions anyway?
Post 06 May 2018, 19:20
View user's profile Send private message Visit poster's website Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 06 May 2018, 19:31
Yeah, it would be fine, or perhaps not if someone want's compilation errors if accidentally uses non intened instruction.
BTW I haven't figured out that I need to include after invoking of format macro;p
I understood after including format.inc Wink
Post 06 May 2018, 19:31
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 May 2018, 19:36
To be honest, everything should work better if you drop the "format" macro and set up all the required includes directly. This also brings more format customization options into view.
Post 06 May 2018, 19:36
View user's profile Send private message Visit poster's website Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 06 May 2018, 19:44
Heh, I just started with fasmg yesterday Wink
I am all in fasm1 thinking.
Post 06 May 2018, 19:44
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.