Contents:
Boot code
The main function of the boot code is to load the boot image while in
real mode and jump to the 16 bit setup code at the start of the image.
Different pieces of boot code are used for different real mode environments
(BIOS bootstrap, DOS, etc). The boot image must be loaded starting at 0x21000.
After it's loaded control is passed to the setup code using "CALL FAR 0x2100:0x20".
If the setup code returns a message has been displayed and the boot has
been aborted.
Setup code
The setup code is split into 2 parts, the 16 bit setup code has these
responsibilities:
Test the cpu to make sure it's at least a 386 with a math co-processor
Make sure the cpu isn't in V86 mode
Sets 80 x 25 x 16 video mode using the BIOS
Fills memory from 0x600 to 0x20FFF with 0
Tries to fill out the BIOS
information block
Sets up the GDT and LDT
Turns the floppy motor off (just in case)
Disables interrupts
Enables the gateA20 line
Initialize the PIC
Load GDT and IDT into appropriate register
Start protected mode
Jumps to the 32 bit setup code in flat protected mode (a32 jmp dword
0x04:0x21010)
32 bit setup code
This code installs the modules that follow it. This process involves
these steps:
Complete protected mode setup
Fill screen with a colour to indicate boot reached 32 bit setup
Copy the rest of the boot image to 0x10000
Copy the first module (memory server) to 0x41000
Create a code segment for it (desriptor 0x220 in the LDT)
Initialize the first module with CALL FAR 0x224:0 while EAX = 0xFFFFFFFF
The memory server is now installed
Use the memory server to install all other modules
Modules
Some modules must be present and in this order:
Any modules following this can be in any order. The functionality of memory,
system and time servers could/should be utilised by the setup code during
boot. As a result of the boot sequence some modules can't rely on other
modules, for eg. the memory server can't use the scheduler, the scheduler
can't use the file server.