Rolling your own OS

Posted by Astryl on Aug. 16, 2012, 11:09 a.m.

I mentioned in my last blog that I was coding my own OS from scratch; so I decided I'd create a running series on the progress made with it.

First things first: One person creating an actually useful OS is very rare; I'm just doing this as a hobby-project.

Secondly, I'll explain bits of what I'm doing, so if you are an Assembly-phobe, run for dear life.

Let me introduce you to Alix

Fault page. I firmly believe that an OS must make sure to make the programmer feel like as much of a douchebag as possible for making stupid mistakes, not the Win8 'Something broke ;(' message.

Yes, that's the name of the kernel.

Why Alix? Because something in the back of my mind tells me that Unix->Alix makes logical progressive sense; and yes, I'm basing some of my design off the OpenBSD systems.

Anyway, here are the tools I'm using to do this:

> Any OS will do (Windows, Linux, DOS)

> DJGPP/GCC

> LD.EXE (Old 32-bit from the DJGPP package, or it's equivalent)

> Winimage (To easily create floppy images)

> VirtualBox

> Notepad++

> A ton of offline references for the x86 architecture and the standard BIOS calls.

The languages used are, by choice, Assembly (AT&T syntax, NASM), and C/C++ (C++ support will only exist when I feel like writing the new and delete operators).

Basic knowledge required for this exercise includes a deep understanding of the languages you're working with (Want printf()? Write it yourself. Need malloc()? Well if you can't write your own, give up now.), at least some knowledge of the basic layout of the Von Neumann architecture, the way the CPU communicates with the hardware, and of course reference guides for any hardware you wish to access, as drivers need to be made for each thing you want to support.

What I've done so far

Very little visibly. I've essentially got the PC into 32-bit protected mode, but I can't take credit for that. GRUB takes care of that minor annoyance.

Otherwise, I have my GDT (Global Descriptor Table, used for setting up Code and Data memory segments), and my IDT/IVT (Interrupt Descriptor/Vector Table).

I also have a nifty Blue Screen fault handler.

Otherwise, my focus tonight involves creating an easy to use interface to the System Clock, and a Keyboard driver.

Oh yes, I have the foundations for my memory management scheme layed out already; I'm using paged memory, because segmentation is a waste of time these days.

Some interesting links

If you're interested in these sorts of things yourself, take a look at these links.

Assembly is a must when it comes to OS development, but other languages can be anything that produces intermediate Object files; thus, D, Pascal and Basic are legitimate choices.

http://wiki.osdev.org/Main_Page

http://www.osdever.net/

http://en.wikipedia.org/wiki/Hobbyist_operating_system_development

Free E-Book

http://www.scribd.com/doc/15200312/MMURTL-V10

Comments

Rob 12 years, 1 month ago

Quote: Cyrus

By then, my twin brother and I already knew HTML. :P

To be fair, when I was 13 and finally had internet (dial-up), I learned GML/some HTML/JS.

Rob 12 years, 1 month ago

dem dorfs, man.