flat assembler
Message board for the users of flat assembler.
Index
> MenuetOS > Porting Menuet from x86 to ARM... Possible? |
Author |
|
S0urcerr0r 10 Jan 2011, 19:07
Atm i know almost no assembler - im progressing very slowly.
However, Im considering an attempt to port Menuet to ARMEL, as a step in learning ASM Instructions. Ive bought a Beagle Board: http://beagleboard.org/ And it would be a nice project to undertake ...AND it will not be a serious project (at least not in the beginning). It will only be a learning project for making small manipulations to instructions to get it compatible. Im not gonna attempt a full conversion of the full menuet, but i want to use the Menuet source as a reference on how to efficiently code Asm. Ill rather learn Asm by looking at other peoples work than by SLOWLY progressing with a trial and error approach. So the questions is: 1.) Would it be possible to convert "Menuet x86 asm" to "Menuet ARMEL asm"? Would it even be possible to do a full working conversion? 2.) Are there any sneaky traps that could ruin the project? Like CPU cache limitations on the 1GHz ARM Cortex-A8 of the beagle board, or maybe other "Memory addressing issues"... or maybe other missing features... i remember reading the following on a forum about comparing x86 and ARM: "These are very different architectures. ARMs can only do integer maths, can't divide, but have good power saving capabilities." ...would that become a serious problem or is it just that it will require more instructions to do Divides and Floating point math? 3.) What do u think of this approach to learn Asm? ...That is - to learn Assembler by converting x86 asm to ARMEL asm? The pro-side should be that i will get to practice translating by looking up all instructions as i go along in the code, while getting used to "reading" efficiently coded Asm along the way? And the con-side should be that it may feel overwhelming as i may not understand such complex branches of code in "one go"? ...that is, if ive understood this learning approach correctly... |
|||
10 Jan 2011, 19:07 |
|
Dex4u 11 Jan 2011, 00:43
It would be a rewrite, rather than a port, as Tyler pointed out.
This may give you some pointers http://dex.7.forumer.com/viewforum.php?f=17 |
|||
11 Jan 2011, 00:43 |
|
S0urcerr0r 11 Jan 2011, 06:54
Thanks very much, you both!
As you both say maybe i should write an os of my own for the Beagle Board. i will definitly take a look at DexOS This is were Menuet will be very helpful, as i can use its code as a reference whenever i bump into a deadend. Porting Menuet is only a step to become more self-sufficient in understanding how Assembler code is composed. The REAL goal is to become self-sufficent and write a OS for mi N900 cellphone. Im not gonna attempt making a multi-tasking OS, but rather make a single-tasking realtime OS, as its simpler. It will have one sole function. for example "dumping raw data from a camera and writting it to an unpartioned storage drive". still it will be very difficult even making the simplest OS, and also controlling the camera, AND even accessing the storage drive - and this is where i think menuets source will be able to teach how to access hardware properly. Tyler wrote: It's a little unclear on what you want to learn. Are you interested in learning ARM assembly or x86 assembly? Atm i dont wanna specialize in a certain architecture as im still struggling to understand the basic principles of Asm. There are so many questions i have about the pure basics of Asm and the easiest way to get answers, is by studying other peoples work... i dont have a mentor to ask, when i reach deadends... these basics are essential to even consider coding in Asm. The thing is that, in given time, i can learn all x86 or all arm instructions. What i cant seem to learn though, is how to use these Instructions properly - and this is the big problem. For example, i cant seem to understand: * How i can make the CPU communicate with other hardware (PCI, sound, graphics) ...i THINK Interrupts have something to do with it, but i have NO IDEA AT ALL on how its done. Im limited to the knowledge of "INT 21h". * How to PROPERLY use variables. * How to properly manage Memory addressing (data/code segments, and periphal addressed shared memory) * How to write efficient code - short and effective By reading MenuetOS source while doing the translation process, i will not only learn all the instructions - i will ALSO learn how efficient code looks. My mind will develop by looking at the code, as i will understand why its written the way it is. A metaphore: So far i feel that learning Asm have been very confusing, and can be compared to trying to learn Chinese by only studying a dictionary. i know neither chinese (=x86) or japanese (=arm) - but the approach i NOW want to take is to learn the Grammatics and Efficient communication by studying some "excellently written" texts in Chinese and using the dictionary to translate it step-by-step into Japanese. While doing so i will learn how properly written texts in Chinese should look, while still stimulating the mind, by challenging it with the difficult training of translation. The japanese (=ARM code) i'll write, will not be super efficient but it will still be stimulating since i get the chance to study the Chinese (x86 code) texts and manipulate it as i go along. Ive found no Asm book that feels like much more than a Dictionary. No books seems to teach me how to code Asm - but only the meaning of the instructions. |
|||
11 Jan 2011, 06:54 |
|
Tyler 11 Jan 2011, 11:40
There's no x86 OS that's going to teach you anything about accessing components of an embedded-like device(such as a cellphone).
There aren't any universal basic principles of assembly. That's the thing with assembly, it's unique to every architecture, and even differs between processors of the same architecture. Quote:
INT 21 is DOS related. On x86, the CPU communicates with most modern devices through shared memory. Older stuff is accessed through IO ports. Quote:
Here's where the fun "translating" happens. ARM is a different architecture than x86, and has a different way of providing a virtual address space. I don't know the specifics, but they're different. |
|||
11 Jan 2011, 11:40 |
|
Mac2004 14 Jan 2011, 20:29
S0urcerr0r wrote:
Have you tried the Art of Assembly by Randall Hyde? http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/www.artofasm.com/index.html regards Mac2004 |
|||
14 Jan 2011, 20:29 |
|
vid 14 Jan 2011, 20:48
Quote: Have you tried the Art of Assembly by Randall Hyde? But rather get some (older?) non-HLA version |
|||
14 Jan 2011, 20:48 |
|
Mac2004 15 Jan 2011, 07:57
Quote:
Agreed, I would recommend the 16bit dos version for S0urcerr0r. Regards Mac2004 |
|||
15 Jan 2011, 07:57 |
|
redrum88 31 Mar 2016, 11:05
I have a RPi and I would love to run menuetOS on it.
Does any body know about any port/rewritting? |
|||
31 Mar 2016, 11:05 |
|
Ville 01 Apr 2016, 13:02
X86 and ARM command-sets are similar, so most of the commands can be directly translated. There are some small differences, like the lack of divide instruction in some arm-models. Also the interrupt handling routines needs to be rewritten and some mathematical functions don't necessarily have an arm counterpart. Overall, I'd estimate that over 90% of the code is translatable.
Another interesting is the Odroid-C2, which has four 64bit cpus, running at 2.0Ghz. http://www.phoronix.com/scan.php?page=article&item=raspberry-pi3-odroid2&num=1 |
|||
01 Apr 2016, 13:02 |
|
revolution 01 Apr 2016, 13:34
Ville wrote: X86 and ARM command-sets are similar, so most of the commands can be directly translated. There are some small differences, like the lack of divide instruction in some arm-models. Also the interrupt handling routines needs to be rewritten and some mathematical functions don't necessarily have an arm counterpart. Overall, I'd estimate that over 90% of the code is translatable. |
|||
01 Apr 2016, 13:34 |
|
Ville 01 Apr 2016, 14:12
Quote: From 64bit ARM developer quide: So for example, memory addressing and other operations have been simplified with the new 64bit ARMv8. http://infocenter.arm.com/help/topic/com.arm.doc.den0024a/DEN0024A_v8_architecture_PG.pdf |
|||
01 Apr 2016, 14:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.