StuBS
|
Interface for Multiboot. More...
Classes | |
class | Module |
Boot Module (also known as initrd = initial Ramdisk) More... | |
class | Memory |
Memory Map. More... | |
struct | VBE |
Video mode: Vesa BIOS Extension. More... | |
struct | Framebuffer |
Video mode: Framebuffer. More... | |
Functions | |
Module * | getModule (unsigned i) |
Retrieve a certain boot module. More... | |
unsigned | getModuleCount () |
Get the number of modules. More... | |
Memory * | getMemoryMap () |
Retrieve the first entry of the memory map. | |
char * | getCommandLine () |
Get the kernel command line. More... | |
char * | getBootLoader () |
Get the name of the boot loader. More... | |
VBE * | getVesaBiosExtensionInfo () |
Get pointer to Vesa BIOS Extension information. More... | |
Framebuffer * | getFramebufferInfo () |
Get pointer to framebuffer information. More... | |
Interface for Multiboot.
Due to historical reasons, a normal BIOS allows you to do quite an egg dance until you finally reach the actual kernel (especially with only 512 bytes available in the master boot record...). Fortunately, there are boot loaders that (partly) do this ungrateful job for you: They load your kernel into memory, switch (the bootstrap processor) to protected mode (32 bit) and jump to the entry point of our kernel – saving you a lot of boring (or enlightening?) work: reading ancient systems documentation. One of the most famous representatives is the Grand Unified Bootloader (GRUB), which is also the reference implementation of the [Multiboot Specification]{Multiboot Specification (version 0.6.96)}.
A Multiboot compliant boot loader will prepare the system according to your needs and can hand you a lot of useful information (e.g. references to initial ramdisks).
However, you have to inform the loader that you are also compliant to the specification, and (if required) instruct the loader to adjust specific settings (e.g. the graphics mode).
For this purpose you have to configure the beginning of the kernel (the first 8192 bytes of the kernel binary) accordingly (see compiler/section.ld
) – this is were the boot loader will search for a magic header and parse the subsequent entries containing the desired system configuration. In StuBS these flags are set in boot/multiboot/config.inc
and the header structure is generated in boot/multiboot/header.asm
.
The first step in your kernel entry function is saving the pointer to the struct with the information from the boot loader (transferred via register ebx
) – and Multiboot provides you the interface to comfortably access its contents!
char * Multiboot::getBootLoader | ( | ) |
Get the name of the boot loader.
char * Multiboot::getCommandLine | ( | ) |
Get the kernel command line.
Framebuffer * Multiboot::getFramebufferInfo | ( | ) |
Get pointer to framebuffer information.
MULTIBOOT_VIDEO_MODE
flag was explicitly set in the multiboot header (see boot/multiboot/config.inc
)! Module * Multiboot::getModule | ( | unsigned | i | ) |
Retrieve a certain boot module.
i | boot module number |
unsigned Multiboot::getModuleCount | ( | ) |
Get the number of modules.
VBE * Multiboot::getVesaBiosExtensionInfo | ( | ) |
Get pointer to Vesa BIOS Extension information.
MULTIBOOT_VIDEO_MODE
flag was explicitly set in the multiboot header (see boot/multiboot/config.inc
)!