First page Back Continue Last page Overview Graphics
How setup() Works
The setup() function is loaded at offset 0x200 of the kernel image file
Initializes hardware devices and sets up the kernel execution environment
- But Linux sometimes relies on BIOS for initialization
Major operations
- Invokes a BIOS procedure to determine the amount of RAM
- Initializes keyboard
- Initializes the graphics adapter
- Reinitializes the disk controller
- Checks for buses, bus mice, APM, etc
- If needed, moves the kernel image to make space for decompression
- Sets up the Interrupt Descriptor Table (IDT) and a Global Descriptor Table (GDT)
- Remaps the interrupts (BIOS maps hardware interrupts to the CPU exception range)
- Switches to protected mode
- Jumps to startup_32(), which starts the kernel proper