I’ve Finally Started!
Tuesday, July 7th, 2009At last! I’ve finally started doing some work on my major project. I’ve spent a brief amount of time yesterday getting my new Trac installation working. You can get to the Trac install here, and unlike last time everything is restricted to read-only for various reasons:
- It’s supposed to all be my own work!
- Last time I put a link to a Trac install I got thousands of tickets which suggested I buy Viagra.
Anyway, having installed Trac I then set about creating some components, milestones, versions etc. I also started writing some documentation about the OS, the coding standards to be used, the goals, and all that sort of stuff. As I figure out more completely the requirements of the project the Wiki will be improved with more information and documentation. My hope is that when it comes to the final report I’ll be able to grab a lot of the stuff off the Wiki.
You may be thinking to yourself - this is all well and good, but this isn’t actually a start - it’s just a “time wasting exercise to make you think you’ve started.” But this is where you’d be wrong. In addition to all the above I created the first ticket - the boot loader task, and then promptly proceeded to write the boot loader. Although I’ve not tested it yet, it’s so simple stuff I don’t have any concerns. Obviously that won’t do when it comes to writing my report and all that palava - so I will have to come up with a way of testing a boot loader, but for the moment I’m just assuming it will work - it compiles.
As with MouthOS, the boot loader for my project uses GRUB, but this time it makes much more effort to use the features provided, such as GRUB’s own memory map etc. This is actually a very simple task:
kernel:
extern main
; Push the address of the GRUB memory info onto the stack so that
; the kernel can get to them.
push eax;
push ebx;
; Call the main kernel. Notice that we should NEVER EVER return
; from main, but if we do we end up in an infinite loop. At
; some point (once system calls are working) that should change
; to panic!
call main
jmp $
Easy eh? Well, there is actually a little more code than that in order to setup a basic 8K stack, BSS etc. However, that is the gist of the boot loader! You’ve gotta love GRUB. Obviously there are a number of things that still need doing such as enabling interrupts, setting up the Global Descriptor Table and Local Descriptor Tables etc. These are things that GRUB does, but only to a very simple extent - for example, as my comments in the code say:
; cs = A read/execute segment, offset: 0, limit: 0xFFFFFFFF (32 bit)
;
; ds, es, fs, gs, ss
; A read/write segment, offset 0, limit: 0xFFFFFFFF (32 bit)
You can very quickly see that the entire of the memory is read/write/execute - no matter if it is a stack, code segment, data segment etc. In other words GRUB would seem to be pretty lazy in this regard. But I suppose that is because no matter what you’re going to want to change it anyway. So my next task really is to write the rest of the boot loader including the code to sort out the GDT and LDTs. Oh, and I’ve added about 25 tickets now of things that I need to do for the first release of the project. Looks like I’ve got a lot of work to be doing.
So, apart from my progress with the major project, what else have I been doing? I’ve started going swimming and last Thursday I managed to do 90 lengths (approximately two a half Km) - perhaps not fantastic for some, and a real shame that it’s not 100, but for me that is pretty good going. Today I also managed to re-create this achievement. Hopefully next time I’ll manage the 100 - but by 90 I’m exhausted!
So right now I’m off to get a cup of coffee and then I’m going to watch the latest episode of Tourchwood on iplayer, and then tomorrow I’ve got guitar lesson ![]()