Current status on the immutable operating system is that I'm working on boot loading with EFI.
About a week ago, I blogged that the whole point of using EFI was to not have to fool around with boot loading, and that I might as well start working on a VM with portability to extracting it into an OS in mind, if I couldn't figure out how to start doing the actual interesting kernel work soon. This is true. The least interesting part of this project, is me learning to do what 100s or 1000s of people have done before me - writing code to boot an x86 platform.
I'm still learning lots of valuable lessions, though, such as various aspects of pointer arithmetic. Apparently, void *p = my_struct; p += 100; my_struct = p;
is completely different from my_struct += 100;
. Or something like that. Still haven't investigated, for now I'm happy with working code, I'll try to fully understand C and the specs later. All I know at this point is that doing the arithmetic on the struct (which is a pointer, MY_STRUCT_TYPE *my_struct
) yields Weird Numbers (tm).
On top of the learning experience, I'm still having lots of fun writing the EFI loader. The next step is to decide on some kind of format, porobably ELF, for my actual kernel, and decide on the assembly API for booting into it. Probably pointing to a well defined data structure in eax
and jump to the kenel code. Thanks to osdev on IRC, a super-awesome community, I'm aware of the various different procedures of loading a kernel. Calling a C function is more tedious, since one has to set up a stack. If my kernel entry point is assembly, it's much easier to jump into it if I decide to also make it boot with multiboot, for example.
So EFI it is, at least for now.