C++ Crashkurs
Interface for Multiboot. More...
Classes | |
union | Framebuffer.__unnamed__ |
class | Memory |
Memory Map. More... | |
class | Module |
Boot Module (also known as initrd = initial Ramdisk) More... | |
Structs | |
struct | Framebuffer |
Video mode: Framebuffer. More... | |
struct | Framebuffer.__unnamed__.__unnamed__ |
For INDEXED type. More... | |
struct | VBE |
Video mode: Vesa BIOS Extension. 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... | |
assert_size (Module, 16) | |
assert_size (Memory, 24) | |
assert_size (VBE, 16) | |
assert_size (Framebuffer, 28) | |
Detailed Description
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.
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!
Class Documentation
union Multiboot::Framebuffer.__unnamed__ |
Class Members | ||
---|---|---|
__unnamed__ | __unnamed__ | For INDEXED type. |
__unnamed__ | __unnamed__ | For RGB type. |
Function Documentation
Module * Multiboot::getModule | ( | unsigned | i | ) |
Retrieve a certain boot module.
- Parameters
-
i boot module number
- Returns
- Pointer to structure with boot module information
unsigned Multiboot::getModuleCount | ( | ) |
Get the number of modules.
- Returns
- Pointer to structure with boot module information
char * Multiboot::getCommandLine | ( | ) |
Get the kernel command line.
- Returns
- pointer to zero terminated string
char * Multiboot::getBootLoader | ( | ) |
Get the name of the boot loader.
- Returns
- pointer to zero terminated string
VBE * Multiboot::getVesaBiosExtensionInfo | ( | ) |
Get pointer to Vesa BIOS Extension information.
- Note
- Only available if the
MULTIBOOT_VIDEO_MODE
flag was explicitly set in the multiboot header (seeboot/multiboot/config.inc
)!
Framebuffer * Multiboot::getFramebufferInfo | ( | ) |
Get pointer to framebuffer information.
- Note
- Only available if the
MULTIBOOT_VIDEO_MODE
flag was explicitly set in the multiboot header (seeboot/multiboot/config.inc
)!