INIT / KERNEL

Home OS Home

                    Welcome to the Second stage of operating system development. If you are reading this, then you should be having a nice little boot loader working. If not go back to the previous section and come back later when you are done. Now the question today is whether it should be "INIT" file or "KERNEL" that should be loaded next. It doesn't matter. Although I prefer INIT, I say it would not matter. The reason I chose INIT is...well, you will see it.

                    Our aim is to build a Protected Mode OS. Before reading this page, I want you to go and look in the intel386 manual. There it explains everything about Protected Mode in an x86 system. You should read that if you are new to this stuff because I will only explain the at-most necessary steps.

                    Now, if you have done that, you will see that we need to set up several things before we could go into protected mode. Now that is why the question arise if INIT or KERNEL should go next? If you are writing the KERNEL in C (which I will NEVER recommend), you have to set up environments similar to programming environment. If you are writing everything (or 90%) of 'kernel' in Assembly, you actually do not need the INIT. If you are using C, make sure you do not use any C-library functions or functions that uses DOS/Linux interrupts because that would generate unexpected results. For nice organizational design I would do the following in INIT file before going to KERNEL, and I would do most of them in Assembly language. There is one good reason for why I use Assembly instead of C because, C can only do so much of optimization. Even the fastest compiler [VectorC] is not as fast as they say it is because a very good Assembly programmer knows how to make the fastest code. If your OS modules are slow, then the user programs that use these modules will be much slower, like a Windows 3.1 applications and like almost all Linux systems (if you have XWindows, you know what I mean).

[INIT file functions]

bullet

CPU Detect

bullet

Total Memory Detection

bullet

Set up Global Descriptor Table

bullet

Set up some vital descriptors

[KERNEL Functions: See "Advanced Section"]

bullet

Go to the Advanced section

OS Into Home System Theory Choosing Platform Bootstrap INIT or KERNEL