flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > Will FasmArm ever run native on Arm ?

Goto page 1, 2, 3  Next
Author
Thread Post new topic Reply to topic
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 27 Jan 2013, 21:55
This is the ? "Will FasmArm ever run native on Arm ?" as at the moment you can not run fasmarm on device like the raspberry pi.

Is there any plans to do this ?, as arm is replacing x86 more and more these days.
Post 27 Jan 2013, 21:55
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 27 Jan 2013, 22:02
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 21:50; edited 1 time in total
Post 27 Jan 2013, 22:02
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 27 Jan 2013, 23:35
HaHaAnonymous wrote:
If ARM will replace x86 this is going to take a lot of time (It's hard to replace an OS, imagine an entire hardware) and they must to invade the desktop market (at Intel and AMD level) for that.

Think outside of the box. Dex4u is talking about the RPi and (I guess) has the mobile industry in mind.

Guess what? More and more people are getting mobile devices (95% of which are ARM-based) to communicate and play games (which is what most people have ever done with their PCs).

You can't imagine how many people are using mobile devices exclusively to browse the Internet nowadays.

Just wait a few years and the phablet or something like it will have replaced pretty much all notebooks and a significant part of home desktops.
Post 27 Jan 2013, 23:35
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 28 Jan 2013, 00:19
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 21:50; edited 1 time in total
Post 28 Jan 2013, 00:19
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 28 Jan 2013, 02:31
HaHaAnonymous wrote:
Quote:

This is the ? "Will FasmArm ever run native on Arm ?" as at the moment you can not run fasmarm on device like the raspberry pi.

FASM source code is available, you can try to rewrite it for ARM if you aren't lazy.

lazy Laughing Laughing Laughing Laughing, that does not come into it, but i was asking if anyones porting it or planing on porting it, as if not i will port it.
But i have many projects on go.

@HaHaAnonymous, And if the x86 desktop does die, it would be such a shame to lose coders like you Rolling Eyes .
Post 28 Jan 2013, 02:31
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 841
Location: Jakarta, Indonesia
TmX 28 Jan 2013, 07:59
Dex4u wrote:
but i was asking if anyones porting it or planing on porting it, as if not i will port it.
But i have many projects on go.


AFAIK revolution hasn't announce the plan to rewrite FASMARM in ARM assembly yet.

But if you send him a nick check, probably he will change his mind?
He he... Wink
Post 28 Jan 2013, 07:59
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 28 Jan 2013, 09:28
HaHaAnonymous wrote:
Sorry, but if someone said ARM will replace x86 then said person affirmed that with the desktop industry in mind as it is the main market of x86 (not sure if it is its biggest market).

You're still not thinking outside of the box. What I'm saying is that the desktop/PC is in decline. People (most of them at least) never used it because they needed that product precisely, they used it because they needed something that did what it did.
Most of what they used to do on a desktop (browsing the Internet, chatting, playing, reading, etc.) can now be done on mobile devices.
A few years from now only professionals in the publishing industry, multimedia industry, etc. will be using desktops.

HaHaAnonymous wrote:
Many people... Excluding me, of course. I dislike mobiles.

Maybe not as much as I do. I can't use small devices comfortably so I can't even stand laptops. Smile
As for phones, I was always allergic to them. Most of them (including the latest smartphones) have very bad sound systems and I can't hear the person well. Besides I think body language is very important in conversations.
Post 28 Jan 2013, 09:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20309
Location: In your JS exploiting you and your system
revolution 29 Jan 2013, 06:17
TmX wrote:
AFAIK revolution hasn't announce the plan to rewrite FASMARM in ARM assembly yet.
True, no announcement from me.

But the real problem is not the porting as such, it is more about the execution environment (the OS and the input methods). A touch-screen tablet running a closed Apple or MS OS would be an awful system to try and get something like an assembler running.

As of today I don't see any suitable dev system that is ARM based. If I am wrong about that then please point to a good ARM dev system.
TmX wrote:
But if you send him a nick check, probably he will change his mind?
He he... Wink
I think you mean: "... him or her ..." Wink
Post 29 Jan 2013, 06:17
View user's profile Send private message Visit poster's website Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 841
Location: Jakarta, Indonesia
TmX 29 Jan 2013, 15:32
revolution wrote:
If I am wrong about that then please point to a good ARM dev system.


What about ARM Linux? Raspberry Pi is a good example for that. Plug it to a monitor and keyboard. Now you have a nice tiny ARM desktop. Smile

gcc and the related tools (gdb,objdump, etc) also supports ARM.
I think this is good enough, at least for hobyist.

On the other hand, I think most profesional/commercial ARM tools are X86-based only, though. Confused
Post 29 Jan 2013, 15:32
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 29 Jan 2013, 18:55
I'm in for a team that wants to port fasmarm to the raspberry pi. I'm playing a lot with it and I see it as a suitable development platform. Actually, I have one running 24/7 as a home web server (my personal cloud / git repository) and another one for experimenting purposes.
The most recurring idea is to have a simple fasm styled autoassembler for a native assembly OS, similar to OctaOS but for the raspberry pi.
It is such a lot of work for my limited resources and my illimited laziness, but will gladly participate in any team with similar goals (Hello Dex, I have seen your excellent tutorial for the R-Pi)

I truly believe that the way to go is the way that JohnFound is showing us with FreshLib, but I have lost interest in x86.

p.s. I will make it soon available the gzipped image of my raspbian+nginx+node.js+php+redis+git home server for the rasp.pi -> a lot of fun!
Post 29 Jan 2013, 18:55
View user's profile Send private message Yahoo Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 29 Jan 2013, 20:35
TmX wrote:
revolution wrote:
If I am wrong about that then please point to a good ARM dev system.


What about ARM Linux? Raspberry Pi is a good example for that. Plug it to a monitor and keyboard. Now you have a nice tiny ARM desktop. Smile

gcc and the related tools (gdb,objdump, etc) also supports ARM.
I think this is good enough, at least for hobyist.

On the other hand, I think most profesional/commercial ARM tools are X86-based only, though. Confused

Thanks for the reply, i agree with others the raspberry pi is a great platform for ARM dev (it as many linux distro's), theres over 1000000 out theres and with a cheaper ver coming out soon, there will be many more.
I have coded both bare metal and under linux for the pi, the only problem i have is i have to do the dev work on a x86, which is a shame.
Theres been a big interest in fasmarm on the raspberry pi forum, but not being able to run on the raspberry pi is a down side, also there a lot of OS dev's coding for the PI, with fasmarm being so easy to port this would be a big plus, if it could run native on arm.

In my pi OS port, i have read/write to sd card, usb keyboard, CLI, every thing needed to port fasmarm, other than it's x86.
If you were to rewrite it for arm, i would be more than willing to donate a raspberry pi, if it would help.

@pelaillo, glad you like the tuts.
Post 29 Jan 2013, 20:35
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20309
Location: In your JS exploiting you and your system
revolution 29 Jan 2013, 23:27
If you manually port the x86 version of fasmarm to ARM then you risk either having to manually make changes to keep in sync with the x86 version updates (both from Tomasz to the core or from me for the arm portion), or having a version that is stale and gets no updates.

Another possibility also might make sense here: To use some tool (as yet not in existence AFAIK) to automatically convert x86 to ARM during assembly. You would only then need to manually write the fasmarm.asm and system.inc files and the rest of the sources can be automatic.

Of course this is not really a trivial task because there are considerable differences between the instruction sets, but some form of line-by-line conversion can work. Performance might suffer a bit but probably not so much that it will be too awful (and perhaps equivalent to the HLL tools currently available?).

You could define a register mapping (e.g. eax == r0, ecx == r1 etc.) and use the flags directly. One problem might be the parity flag but I suppose that could be worked around somehow.
Post 29 Jan 2013, 23:27
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: 20309
Location: In your JS exploiting you and your system
revolution 30 Jan 2013, 00:17
I just realised that I was thinking of the console version in the above post. If you want to use the GUI then of course that would be a much bigger undertaking to port that to whatever OS is used on the target system. And I doubt that that could be an automatic process.

Also, to short-circuit the whole thing a VM running the x86 code could solve the issue. Do any of the existing ARM setups have such a VM available?
Post 30 Jan 2013, 00:17
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: 20309
Location: In your JS exploiting you and your system
revolution 30 Jan 2013, 02:33
A selection of x86 instructions converted to ARM:
Code:
;eax ---> r0
;ecx ---> r1
;edx ---> r2
;ebx ---> r3
;esi ---> r4
;edi ---> r5
;ebp ---> r6
;esp ---> r13

;temp1 = r7
;temp2 = r8
;temp3 = r9

        mov eax,ecx
                mov     r0,r1           ;easy!

        mov al,bl
                bfi     r0,r3,0,8       ;easy!

        mov ah,bh
                ror     r7,r3,8         ;shift interesting bits into position
                bfi     r0,r7,8,8

        add ch,dh
                lsl     r7,r1,16        ;mov byte into high position
                and     r7,0xff shl 24  ;clear lower bits
                lsl     r8,r2,16
                and     r8,0xff shl 24  ;clear lower bits
                adds    r7,r8
                ror     r7,24
                bfi     r1,r7,8,8       ;place the result into position

        setc al
                bic     r0,0xff
                orrcs   r0,1

        mov [address],immediate
                movw    r7,immediate and 0xffff
                movt    r7,immediate shr 16
                movw    r8,address and 0xffff
                movt    r8,address shr 16
                str     r7,[r8]

        add eax,immediate
                movw    r7,immediate and 0xffff
                movt    r7,immediate shr 16
                adds    r0,r7

        sub eax,immediate
                movw    r7,immediate and 0xffff
                movt    r7,immediate shr 16
                subs    r0,r7
                mrs     r7,cpsr         ;carry is inverted so we have to adjust it
                eor     r7,1 shl 29
                msr     cpsr_f,r7

        sbb eax,esi
                mrs     r7,cpsr         ;invert the carry flag
                eor     r7,1 shl 29
                msr     cpsr_f,r7
                sbcs    r0,r4
                mrs     r7,cpsr         ;carry is inverted so we have to adjust it
                eor     r7,1 shl 29
                msr     cpsr_f,r7

        and [ecx+edx*8+offset],immediate
                movw    r7,offset and 0xffff
                movt    r7,offset shr 16
                add     r7,r1           ;r7=ecx+offset
                ldr     r9,[r7,r2,lsl 3]
                movw    r8,immediate and 0xffff
                movt    r8,immediate shr 16
                ands    r9,r8
                str     r9,[r7,r2,lsl 3]    
For obvious reasons not tested and some of the finer details might need to be worked out. But basically it might give some ideas. The conversion could be done by replacing the x86_64.inc file with a custom version.


Last edited by revolution on 30 Jan 2013, 21:25; edited 6 times in total
Post 30 Jan 2013, 02:33
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: 20309
Location: In your JS exploiting you and your system
revolution 30 Jan 2013, 02:39
Hehe, that above conversions sure make the ARM look bad. But I think if we were to go the other way it would make the x86 look bad. The ISAs are not equatable so this causes a large inefficiency when we do a naive one-to-one translation.
Post 30 Jan 2013, 02:39
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 30 Jan 2013, 04:28
I was thinking in a new native port. Starting with a simple set and build upon it later on, like the way fasm was written by Tomasz. With an advantage: we have Tomasz work as a guide.
And of course, abandoning all legacy x86 particularities and complications.
Post 30 Jan 2013, 04:28
View user's profile Send private message Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20309
Location: In your JS exploiting you and your system
revolution 30 Jan 2013, 07:42
pelaillo wrote:
I was thinking in a new native port. Starting with a simple set and build upon it later on, like the way fasm was written by Tomasz. With an advantage: we have Tomasz work as a guide.
And of course, abandoning all legacy x86 particularities and complications.
Doing that means you can't leverage new updates or fixes automatically. Basically you are suggesting starting a new independent project.
Post 30 Jan 2013, 07:42
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 30 Jan 2013, 11:32
revolution wrote:
pelaillo wrote:
I was thinking in a new native port. Starting with a simple set and build upon it later on, like the way fasm was written by Tomasz. With an advantage: we have Tomasz work as a guide.
And of course, abandoning all legacy x86 particularities and complications.
Doing that means you can't leverage new updates or fixes automatically. Basically you are suggesting starting a new independent project.
This is a difficult choice. A direct conversion of sources may seem to a be simpler project, but it has its drawbacks - like keeping fasm's memory allocation schemes. The memory management in current architecture is a press-like mechanism, which is a legacy from single-tasking DOS, where one could simply take all the available memory to himself at once. This made the "-m" switch necessary when porting to multi-tasking operating systems. I think that any rewrite of fasm should dispose of this legacy (fasm 2 certainly would).

This also gives me another idea for fasm 2 (though it will probably push it further into an undetermined future) - that it should be written in such a way, that even conversion for an ARM architecture would be a simple task (perhaps using fasm 2 macros). But that's just my dreaming right now, please ignore it. Wink
Post 30 Jan 2013, 11:32
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: 20309
Location: In your JS exploiting you and your system
revolution 30 Jan 2013, 13:05
Tomasz Grysztar wrote:
I think that any rewrite of fasm should dispose of this legacy (fasm 2 certainly would).
But that sort of auto-translation could also automatically leverage any new version (if fasm 2 ever happens).
Tomasz Grysztar wrote:
This also gives me another idea for fasm 2 (though it will probably push it further into an undetermined future) - that it should be written in such a way, that even conversion for an ARM architecture would be a simple task (perhaps using fasm 2 macros). But that's just my dreaming right now, please ignore it. Wink
Sorry, I can't ignore that so easily. Macros ... hmm, well, perhaps. I've never really been keen on macros to do such things, but I do understand the idea behind it. Essentially making an HLL like ARM assembler which ports no matter what underlying architecture fasm 2 is running upon. Not sure if that works well or not. Maybe I'll have to see it running to know for sure if it is a good thing. But it still requires fasm itself to be ported first so maybe not such a saving after all.
Post 30 Jan 2013, 13:05
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode 30 Jan 2013, 14:28
hello people,
first of all thanks to Dex4u for this thread. i waited for it.
Quote:
Essentially making an HLL like ARM assembler which ports no matter what underlying architecture...
this would be always x86-native i presume ! in this case we have lot of options.

fasm is for/on x86 archtecture. ARM is another architecture.
because ARM is hardware, assembly is already HLL there.

about the proof-code posted above by revolution, it resemble just like when managing different human language and trying to translate a concept: different mental architectures ergo, one should live among
those people in that culture to understand and use that language and the
meaning of it. if not in this way, inefficacy. because of the fact
instructions are just like words and terms,
they do not map 100% on different ISAs.

dont go this way Smile please, even if tempted.
the effort is huge and the output clumsy, granted a-priori
without needing the proof-code.

the ARM-tool should live on ARM and compile ARM stuff.
also native, native, native. 3x native.
ARM compiles ARM natively on ARM.
at the cost to free the tool from the fasm engine
bitter truth but truth. full-stop.
dont ignore it.

i had this thread in mind since reading armv7.inc
one week ago.

one should start again on ARM reinventing the weel with
a simple data-packer, to manage the memory scheme and ISA etc,
eventually on RasPi. this way is worth.

you say RasPi is a good dev-system for that ?
what OS ?
why is it good ?
what the difference with other OS on RasPi ?
the question is already above from revolution
revolution wrote:
...point to a good ARM dev system...
huge worthless effort, without answering that question.

Cheers,
Very Happy

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 30 Jan 2013, 14:28
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:  
Goto page 1, 2, 3  Next

< 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.