Crate multiboot2
source ·Expand description
Library that assists parsing the Multiboot2 Information Structure (MBI) from
Multiboot2-compliant bootloaders, such as GRUB. It supports all tags from the
specification including full support for the sections of ELF files. This library
is no_std
and can be used in a Multiboot2-kernel.
The GNU Multiboot(2) specification aims to provide a standardised method of sharing commonly used information about the host machine at boot time and give the payload, i.e. a kernel, a well defined machine state.
Example
use multiboot2::{BootInformation, BootInformationHeader};
fn kernel_entry(mb_magic: u32, mbi_ptr: u32) {
if mb_magic == multiboot2::MAGIC {
let boot_info = unsafe { BootInformation::load(mbi_ptr as *const BootInformationHeader).unwrap() };
let _cmd = boot_info.command_line_tag();
} else { /* Panic or use multiboot1 flow. */ }
}
MSRV
The MSRV is 1.69.0 stable.
Modules
- Module for the builder-feature.
Structs
- Basic memory info tag.
- A Multiboot 2 Boot Information (MBI) accessor.
- The basic header of a boot information.
- The bootloader name tag.
- This tag contains the command line string.
- EFI ExitBootServices was not called tag.
- Tag that contains the pointer to the boot loader’s UEFI image handle (32-bit).
- Tag that contains the pointer to the boot loader’s UEFI image handle (64-bit).
- The type of a memory range.
- A structure describing a region of memory.
- EFI memory map tag. The
EFIMemoryDesc
follows the EFI specification. - EFI system table in 32 bit mode tag.
- EFI system table in 64 bit mode tag.
- A single generic ELF Section.
- ELF Section bitflags.
- An iterator over some ELF sections.
- This tag contains the section header table from an ELF binary.
- The end tag ends the information struct.
- A framebuffer color descriptor in the palette.
- An RGB color type field.
- The VBE Framebuffer information tag.
- The physical load address tag. Typically, this is only available if the binary was relocated, for example if the relocatable header tag was specified.
- A memory area entry descriptor.
- ABI-friendly version of
MemoryAreaType
. - This tag provides an initial host memory map (legacy boot, not UEFI).
- An iterator over all module tags.
- The module tag can occur multiple times and specifies passed boot modules (blobs in memory). The tag itself doesn’t include the blog, but references its location.
- This tag contains a copy of RSDP as defined per ACPI 1.0 specification.
- This tag contains a copy of RSDP as defined per ACPI 2.0 or later specification.
- This tag contains a copy of SMBIOS tables as well as their version.
- Common base structure for all tags that can be passed via the Multiboot2 Information Structure (MBI) to a Multiboot2 payload/program/kernel.
- The Capabilities field indicates the support of specific features in the graphics environment.
- VBE controller information.
- The DirectColorModeInfo field describes important characteristics of direct color modes.
- A VBE colour field.
- This tag contains VBE metadata, VBE controller information returned by the VBE Function 00h and VBE mode information returned by the VBE Function 01h.
- A Mode attributes bitfield.
- Extended information about a specific VBE display mode from the mode list returned by
VBEControlInfo
(VBE Function00h
). - The WindowAttributes describe the characteristics of the CPU windowing scheme such as whether the windows exist and are read/writeable, as follows:
Enums
- An enum abstraction over raw ELF section types.
- The type of framebuffer.
- Error type that describes errors while loading/parsing a multiboot2 information structure from a given address.
- Abstraction over defined memory types for the memory map as well as custom ones. Types 1 to 5 are defined in the Multiboot2 spec and correspond to the entry types of e820 memory maps.
- Error type describing failures when parsing the string from a tag.
- Higher level abstraction for
TagTypeId
that assigns each possible value to a specific semantic according to the specification. Additionally, it allows to use theTagType::Custom
variant. It is not binary compatible withTagTypeId
. - The MemoryModel field specifies the general type of memory organization used in modes.
Constants
- Magic number that a Multiboot2-compliant boot loader will use to identify the handoff. The location depends on the architecture and the targeted machine state.
Traits
- Provides the pointer metadata type of any pointed-to type.
- A trait to abstract over all sized and unsized tags (DSTs). For sized tags, this trait does not much. For DSTs, a
TagTrait::dst_size
implementation must me provided, which returns the right size hint for the dynamically sized portion of the struct.
Derive Macros
- Generates an implementation of
Pointee
for structs with a DST as its last field.