Friday 6 January 2012

Long time, no write!

Short update, mostly for me really.  A lot has happened, I have not forgotten about this project but in the meantime I have emigrated and married; much of the time since I last wrote on here and now has been taken up by getting ready to fly over from the UK, filing paperwork for the visa, attending visa interviews, etc, etc.

Wednesday 6 October 2010

Well, I have been doing a fair bit of reading and quite a lot of chatting, having discovered OSDev a couple of days ago.  The site is dedicated to helping developers who aspire to writing their own OS or at least their own kernel.  Many of these projects are pure vanity (as mine essentially is, at least for now) and, of course, many of them fall by the wayside (as with a lot of hobby projects, especially hobby software) but there is a core of dedicated, talented, programmers - some of whom are professionals working on major software projects as a day job and playing with their OS at weekends.

I've been offered a great deal of useful assistance, already, including the code for a partially finished project which the owner has mostly lost interest in.  Clearly I shall still be writing my own but the opportunity to see how someone else has approached issues that I, too, will have to solve is very welcome indeed.  There are other well-known, open source, solutions but this is a case where seeing multiple solutions to the same problems can only be helpful.

Anyway, there is really nothing else to add here.  I shall be doing rather a lot of reading and thinking before I seriously attempt to write any code, even the code for the very basic 16 bit bootloader and Real Mode toy OS.  In fact, I shall probably work my way through the Fasm tutorial, again, before I do that, too.

Sunday 3 October 2010

Well, after a day or two where I've been able to do a little reading between getting everything else done, I have made a few initial decisions;  my first target is going to be little more than a bootloader and a small binary to produce a 'you have booted me' message.  I shall probably write these both entirely in 16 bit assembler and might not even bother to switch out of 'real mode' since I do not wish, at that point, to do more than demonstrate to myself that I can correctly bootstrap the system into an operating system kernel.

My longer term goal, I have decided, is something known as an 'exo-kernel' - pretty much the very minimalist idea of what a kernel should comprise - which I shall write in native 64 bit (long mode with full 64 bit instructions on the AMD 64 platform).  In a similar manner to Linus, I have chosen this because I wish to fully master the AMD 64 architecture, not worry about compatibility and complications of other architectures (especially earlier 'x86' ones) and I have ready and easy access to the architecture (this very laptop, somewhat old as it is and despite running a 32 bit Windows, is a Turion 64 X2 based PC - AMD 64 platform with the additional 'fun' of being multicore ;¬) ).

It probably helps that I have the full set of platform reference books, though they are from 2005, courtesy of AMD - they sent to me completely free, actually - which is a lot more convenient than an online database or PDF references, most of the time.  Microsoft, take note:  I'd actually pay for a proper reference to your OS APIs.  We know you like to keep the NT native API somewhat hidden (also note that obscurity is not security) but an honest-to-god paper book detailing the function calls in Win32 and Win64 would be nice.  Personally, I'd even be interested in the original 16 bit API, actually, to which I do have some reference material courtesy of an old Borland compiler purchase.

Anyway, that's where I am right now.  I have FASM set up and I'm refreshing my knowledge of writing basic (FASM dialect) assembler and building binaries from it, soon I intend to start on a bootloader.  Incidentally, FASM isn't just for the bootloader, the entire project (at least that is my intention for now) will be in assembler;  it's just easier that way, to be honest.

Saturday 2 October 2010


"I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since April, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things).
I've currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I'll get something practical within a few months [...] Yes - it's free of any minix code, and it has a multi-threaded fs. It is NOT portable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
[...] It's mostly in C, but most people wouldn't call what I write C. It uses every conceivable feature of the 386 I could find, as it was also a project to teach me about the 386. As already mentioned, it uses a MMU, for both paging (not to disk yet) and segmentation. It's the segmentation that makes it REALLY 386 dependent (every task has a 64Mb segment for code & data - max 64 tasks in 4Gb. Anybody who needs more than 64Mb/task - tough cookies). [...] Some of my "C"-files (specifically mm.c) are almost as much assembler as C. [...] Unlike minix, I also happen to LIKE interrupts, so interrupts are handled without trying to hide the reason behind them."


With these words posted to a newsgroup, Linus Torvalds started what would go on to become 'Linux' usually described as a free operating system (though perhaps more accurately a kernel).  My intention's a lot more modest and very similar to Linus's original intent;  as an exercize in practicing my programming skills I intend to build a basic operating system for a modern PC.  I shall be starting with the very modest aim of writing something that can boot any PC with a 8086 CPU or later.

This blog is going to be mostly to detail my experiences and chart what should be the path to my eventual success.