Full ASM OS?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.

Is your OS fully programmed in Assembly?

Yes
13
22%
No
45
78%
 
Total votes: 58

User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

My OS is:

Boot sector - 100% ASM (could anyone do it in other language?)
Bootloader (IRQs, INTs,etc) - 100% ASM
Drivers - 100% ASM - under development :)
Kernel - 60% Borland Pascal, 40% ASM

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
ehird
Member
Member
Posts: 214
Joined: Thu Mar 15, 2007 8:48 am

Post by ehird »

niteice wrote:
Alboin wrote:An internal scripting language for use in the OS sounds pretty cool....
My plan was to embed Lua in the kernel. One would be able to modify the entire kernel on-the-fly, uploading new code at any point. Insecure? Quite. It would be awesome to actually pull off though :D
I could start porting emacs to use lua if you wanted ;)

(Actually, after finishing a basic "learning OS" I'm going to try something like that... kernel upgrades without rebooting!)
anon19287473
Member
Member
Posts: 97
Joined: Thu Mar 15, 2007 2:27 pm

Post by anon19287473 »

ehird wrote:
niteice wrote:
Alboin wrote:An internal scripting language for use in the OS sounds pretty cool....
My plan was to embed Lua in the kernel. One would be able to modify the entire kernel on-the-fly, uploading new code at any point. Insecure? Quite. It would be awesome to actually pull off though :D
I could start porting emacs to use lua if you wanted ;)

(Actually, after finishing a basic "learning OS" I'm going to try something like that... kernel upgrades without rebooting!)
Like patches? What if two programs try modify the same stuff.
Insecure? Quite.
It's a hobby OS, and unless you plan for it to become more, it doesnt matter how secure it is. It's likely nobody but you will have any idea how exactly it works.
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

I'll soon be porting to MIPS and Sparc... writting each port in pure asm would have me dead by 30...

--Jeff
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

I am working on a ARM port of my ASM OS, and i must say, that to port something in ASM, is not that hard. The hard part is doing anything the first time.
To get to the stage that taken me 1 year the first time (x86), took me about 1 month to port it to Arm. This is on top of leaning ARM way of doing things.

I remember the days i spend trying to compile simple C code, written for a differant C compiler, the error messages it did not seem too portable between differant C compilers, never mind prosesors :roll:
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

Dex wrote:I am working on a ARM port of my ASM OS, and i must say, that to port something in ASM, is not that hard. The hard part is doing anything the first time.
To get to the stage that taken me 1 year the first time (x86), took me about 1 month to port it to Arm. This is on top of leaning ARM way of doing things.
How is this? Doesn't the ARM architecture have different instructions, and all? Wouldn't you have to rewrite every instruction to fit the ARM set? Hm...
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Full ASM OS?

Post by Brendan »

Hi,
~ wrote:How many people are developing their OSes fully in assembly (or at least the main kernel/drivers), and why?
My (long term) plan is to write the kernels, some device drivers and a few other pieces in 100% assembly until I've got an OS that can handle a development environment on a few of my computer/s (rough GUI, file systems, etc).

When I get to this point I'll want to write a interpretted "intermediate language" - a portable low level language that looks a bit like assembly. Then I'll write a NASM/YASM assembler in this language, followed by a compiler for the language (and then compile the assembler and compiler).

Once I've done this I'll extend the interpretter and compiler to handle a "BASIC like" language. Lastly, I'll write an IDE in this "BASIC like" language (possibly followed by support for other languages - PASCAL, C, etc).

This mostly makes me "100% assembly" for the next 5 years at least... ;)


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Alboin wrote:
Dex wrote:I am working on a ARM port of my ASM OS, and i must say, that to port something in ASM, is not that hard. The hard part is doing anything the first time.
To get to the stage that taken me 1 year the first time (x86), took me about 1 month to port it to Arm. This is on top of leaning ARM way of doing things.
How is this? Doesn't the ARM architecture have different instructions, and all? Wouldn't you have to rewrite every instruction to fit the ARM set? Hm...
Sure, but when you come down to coding your OS, most of the time is spent finding how something works and how you do certain parts of your code, once you have a road map (the OS your porting) and know what parts you need to port your OS, its much easier, has you know how it basically works and the writting the coding bit is only about 5% of the work.
Here is a very easy example, anyone who know x86 asm OS Dev, will see the basic of porting there OS to say ARM

Code: Select all

:****************************************;
; ARM BootLoader.                        ;
;----------------------------------------;
; Prog by Dex.                           ;
; Coded with FasmARM.                    ;
; Part of the the x86 to ARM Dex4u port. ;
; C:\fasmarm ArmBoot.asm ArmBoot.bin     ;
;                                        ;
;  C  Bamford.2006(c)                 ;
;****************************************;
format binary
org	0			      ; code starts at offset 0.
use32				      ; use 32-bit code.

        b     reset                   ; This in x86 is the same as "jmp label"
        b     undefined_instruction  ; jump label.
        b     software_interrupt  ; jump label.
        b     prefetch_abort  ; jump label.
        b     data_abort ; jump label.
        b     not_used ; jump label.
        b     irq ; jump label.
        b     fiq ; jump label.

align 4

;********************************;
; just Loop For Now ;)          ;
;********************************;
reset:  ;label

LetsLoop:  
	b LetsLoop  ;just loop forever

;********************************;
; just Loop For Now ;)           ;
;********************************;
undefined_instruction:  ;label
software_interrupt:  ;label
prefetch_abort:  ;label
data_abort:  ;label
not_used:  ;label
irq:  ;label
fiq:  ;label
LetsLoopForNow:
	b     LetsLoopForNow ;just loop forever

times 20000- ($-0)  db 0 ; just pack the file out with 0
This would work in all arm chips, all a Arm does on booting is load 4k from nand to beginning of ram and jumps to the "b reset ", now you know how long it took you to setup yout IDT in pmode gess were you end up if you do a software interrupt with a ARM chip, that right at the software_interrupt address, same with IRQ etc.
Now with a little work leaning differant instructions, you should be able to set your int up no problem, this is just a example it the same for all the building blocks of the OS.
NOTE: You would put code to deal with int etc at the right label.

DexOS running on GBA/DS http://www.dex4u.com/images/gbademo.jpg

This is cool debugging your ported OS, with your own OS 8)
http://www.dex4u.com/images/gp2x.jpg
Last edited by Dex on Sat Mar 31, 2007 12:32 pm, edited 1 time in total.
anon19287473
Member
Member
Posts: 97
Joined: Thu Mar 15, 2007 2:27 pm

Post by anon19287473 »

Ask the lead dev, personally I don't know the specifics; and even putting aside the (arguable) speed gains, it's a modern, real time, self hosting, GUI operating system (w/ IP stack and all the features you'd expect) written completely in ASM (with the exception of a few ports, namely SDL and Doom, which were compiled with the sphinx compilier, it has REALLY bad optimization). It definitely demonstrates it's possible to write such a big project in ASM, and well.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

Dex wrote:I am working on a ARM port of my ASM OS, and i must say, that to port something in ASM, is not that hard. The hard part is doing anything the first time.
What about ongoing maintenance? What you say may be true for the first time you re-write your OS for another architecture (it's rewriting, not porting, if you literally have to rewrite every line of code). But what happens if you've got 8 different versions of your OS for 8 different architectures, and have to deal with fixing bugs across all of them?

This may not matter to you as a hobbyist, but if your OS is ever to gain wide-spread acceptance, you should expect to spend a lot of time maintaining and enhancing it. What happens when you want to add a new feature to the OS on all of the architectures you support? It would be a pain in the butt, IMO.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Colonel Kernel wrote: This may not matter to you as a hobbyist, but if your OS is ever to gain wide-spread acceptance, you should expect to spend a lot of time maintaining and enhancing it. What happens when you want to add a new feature to the OS on all of the architectures you support? It would be a pain in the butt, IMO.
But that would be the same for say linux, you need to adapted your OS for differant architecture, so you are always going to need, differant team to bug fix and maintain the differant prosesor ver's
ehird
Member
Member
Posts: 214
Joined: Thu Mar 15, 2007 8:48 am

Post by ehird »

No, because C is more portable. You only have to maintain some parts.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

ehird wrote:No, because C is more portable. You only have to maintain some parts.
Exactly, You can keep a lot of code easily maintained that'll compile on a wide range of CPU's.. C is very portable.. :)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Crazed123
Member
Member
Posts: 248
Joined: Thu Oct 21, 2004 11:00 pm

Post by Crazed123 »

At least as portable as any other VAXocentric language, certainly.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

So what this for http://www.dslinux.org/bugs/
Do not get me wrong, i am not saying C is not portable, it's very portable, just like a tent is very portable, but tents make s**t home's :lol: .
Post Reply