This section is specific to the x86 processor family, described in [6], [7] and [8].
Bootstrapping: In the PC architecture, bootstrapping begins after the BIOS loads the first 512-byte sector of the boot drive to offset 0x7c00, and executes it in real mode. The boot sector uses BIOS function 0x13 to load the kernel image and the init task image to memory. Then it jumps to the kernel initialization routines. In order to run the kernel, the boot sector must also enable the 20'th address line in the bus, which is done through the keyboard controller and change the processor executing mode to protected mode. Temporary IDT and GDT tables are set up before the switch to protected mode.
Global Descriptor Table: The GDT contains the descriptors that are shared among all the tasks in the system. Some descriptors, in particular the LDT descriptors used to implement tasks and the TSS descriptors used for multi-threading, must reside in the GDT. Some other descriptors that are shared among all the tasks are also in the GDT. The variables MAX_SCA, MAX_TSK and MAX_THR are used to statically reserve entries in the GDT for the maximum possible amount of system calls, tasks and threads. The descriptor layout in the GDT is:
descriptor group | how many? | details |
---|---|---|
system descriptors | 4 | dummy, kernel code, |
kernel data, high memory area | ||
syscalls | MAX_SCA | call gates for the system calls |
LDT descriptors | MAX_TSK | descriptors for task's |
Local Descriptor Tables | ||
TSS descriptors | MAX_THR | descriptors for thread's |
Task State Segments |
Interrupt Descriptor Table: The IDT contains the descriptors that define the processor's reaction to exceptions and external or software generated interrupts. The first 32 entries are reserved for the processor's exceptions, while the rest may be used to handle external interrupts or operating system services invoked through an int instruction.
Local Descriptor Tables: Each LDT must be contained in a special system segment in the GDT. Every task has it's own linear address defined by two descriptors in it's Local Descriptor Table: an execute-read type descriptor for it's code and a read-write descriptor for it's data and stacks.