StuBS
Multiboot Namespace Reference

Interface for Multiboot. More...

Classes

struct  Framebuffer
 Video mode: Framebuffer. More...
 
class  Memory
 Memory Map. More...
 
class  Module
 Boot Module (also known as initrd = initial Ramdisk) More...
 
struct  VBE
 Video mode: Vesa BIOS Extension. More...
 

Functions

ModulegetModule (unsigned i)
 Retrieve a certain boot module.
 
unsigned getModuleCount ()
 Get the number of modules.
 
MemorygetMemoryMap ()
 Retrieve the first entry of the memory map.
 
char * getCommandLine ()
 Get the kernel command line.
 
char * getBootLoader ()
 Get the name of the boot loader.
 
VBEgetVesaBiosExtensionInfo ()
 Get pointer to Vesa BIOS Extension information.
 
FramebuffergetFramebufferInfo ()
 Get pointer to framebuffer information.
 

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]{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!

Function Documentation

◆ getBootLoader()

char * Multiboot::getBootLoader ( )

Get the name of the boot loader.

Returns
pointer to zero terminated string

◆ getCommandLine()

char * Multiboot::getCommandLine ( )

Get the kernel command line.

Returns
pointer to zero terminated string

◆ getFramebufferInfo()

Framebuffer * Multiboot::getFramebufferInfo ( )

Get pointer to framebuffer information.

Note
Only available if the MULTIBOOT_VIDEO_MODE flag was explicitly set in the multiboot header (see boot/multiboot/config.inc)!

◆ getModule()

Module * Multiboot::getModule ( unsigned  i)

Retrieve a certain boot module.

Parameters
iboot module number
Returns
Pointer to structure with boot module information

◆ getModuleCount()

unsigned Multiboot::getModuleCount ( )

Get the number of modules.

Returns
Pointer to structure with boot module information

◆ getVesaBiosExtensionInfo()

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 (see boot/multiboot/config.inc)!