Technical Information about the Boot Loader

a supplemental section in the first chapter in our series on How to Write an Operating System


What the bootloader does for you:

When calling the _start function in the first file, the boot loader passes as parameters the amount of memory it counted, the parameter string, a pointer to the SBBB/Directory.

Segment Selectors in the GDT

All of the segments defined by the boot loader allow use of the entire 32-bit address space from 0-4GB. In the following descriptions, kernel means ring 0 and user means ring 3. These are just some recommended segments, the uBoot loader is not garenteed to setup these segments for you. Remember, one of the first things you should do in your booting proccess is to construct the GDT that you will use.

Returning to DOS

To return cleanly to DOS, you need to make sure that:

You don't need to worry about the last two items, unless you've changed the GDT or the PIC registers (you can't do this without some serious effort). However, staying out of the lower 1MB of memory is a bit tougher, even with NULL references taken care of.

The Executable and Linking Format (ELF)

You can get a copy of the Executable and Linking Format (ELF) specification here.

Source Code

Check out the assembly source code for the boot loader. (Note: this is older source code for the boot.com that is not compatible with the new uBoot system. that source code should be up shortly, we apologize for any inconvenience.)