Expand description
Convenient and safe parsing of Multiboot2 Boot Information (MBI) structures
and the contained information tags. Usable in no_std
environments, such as
a kernel. An optional builder feature also allows the construction of
the corresponding structures.
§Design
For every Multiboot2 structure, there is an ABI-compatible rusty type. This enables a zero-copying parsing design while also enabling the creation of these structures via convenient constructors on the corresponding types.
§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.75.0 stable.
Structs§
- ApmTag
- The Advanced Power Management (APM) tag.
- Basic
Memory Info Tag - Basic memory info tag.
- Boot
Information - A Multiboot 2 Boot Information (MBI) accessor.
- Boot
Information Header - The basic header of a
BootInformation
as sized Rust type. - Boot
Loader Name Tag - The bootloader name tag.
- Bootdev
Tag - The end tag ends the information struct.
- Builder
- Builder for a Multiboot2 header information.
- Command
Line Tag - This tag contains the command line string.
- DynSized
Structure - An C ABI-compatible dynamically sized type with a common sized
Header
and a dynamic amount of bytes without hidden implicit padding. - EFIBoot
Services NotExited Tag - EFI ExitBootServices was not called tag. This tag has no payload and is just a marker.
- EFIImage
Handle32 Tag - Tag that contains the pointer to the boot loader’s UEFI image handle (32-bit).
- EFIImage
Handle64 Tag - Tag that contains the pointer to the boot loader’s UEFI image handle (64-bit).
- EFIMemory
Area Type - The type of a memory range.
- EFIMemory
Attribute - Flags describing the capabilities of a memory range.
- EFIMemory
Desc - A structure describing a region of memory. This type corresponds to version of this struct in the UEFI spec and is always bound to a corresponding UEFI memory map.
- EFIMemory
MapTag - EFI memory map tag. The embedded
EFIMemoryDesc
s follows the EFI specification. - EFISdt32
Tag - EFI system table in 32 bit mode tag.
- EFISdt64
Tag - EFI system table in 64 bit mode tag.
- ElfSection
- A single generic ELF Section.
- ElfSection
Flags - ELF Section bitflags.
- ElfSection
Iter - An iterator over
ElfSection
s. - ElfSections
Tag - This tag contains the section header table from an ELF binary.
- EndTag
- The end tag ends the information struct.
- Framebuffer
Color - A framebuffer color descriptor in the palette.
- Framebuffer
Field - An RGB color type field.
- Framebuffer
Tag - The VBE Framebuffer information tag.
- Image
Load Phys Addr 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.
- Memory
Area - A descriptor for an available or taken area of physical memory.
- Memory
Area Type Id - ABI-friendly version of
MemoryAreaType
. - Memory
MapTag - This tag provides an initial host memory map (legacy boot, not UEFI).
- Module
Iter - An iterator over all module tags.
- Module
Tag - 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.
- Network
Tag - The end tag ends the information struct.
- Rsdp
V1Tag - This tag contains a copy of RSDP as defined per ACPI 1.0 specification.
- Rsdp
V2Tag - This tag contains a copy of RSDP as defined per ACPI 2.0 or later specification.
- Smbios
Tag - This tag contains a copy of SMBIOS tables as well as their version.
- TagHeader
- The common header that all tags have in common. This type is ABI compatible.
- TagType
Id - Serialized form of
TagType
that matches the binary representation (u32
). - VBECapabilities
- The Capabilities field indicates the support of specific features in the graphics environment.
- VBEControl
Info - VBE controller information.
- VBEDirect
Color Attributes - The DirectColorModeInfo field describes important characteristics of direct color modes.
- VBEField
- A VBE colour field.
- VBEInfo
Tag - This tag contains VBE metadata, VBE controller information returned by the VBE Function 00h and VBE mode information returned by the VBE Function 01h.
- VBEMode
Attributes - A Mode attributes bitfield.
- VBEMode
Info - Extended information about a specific VBE display mode from the
mode list returned by
VBEControlInfo
(VBE Function00h
). - VBEWindow
Attributes - The WindowAttributes describe the characteristics of the CPU windowing scheme such as whether the windows exist and are read/writeable, as follows:
Enums§
- ElfSection
Type - An enum abstraction over raw ELF section types.
- Framebuffer
Type - Structured accessory to the provided framebuffer type that is not ABI compatible.
- Load
Error - Errors that occur when a chunk of memory can’t be parsed as
BootInformation
. - Memory
Area Type - 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.
- String
Error - Error type describing failures when parsing the string from a tag.
- TagType
- Higher level abstraction for
TagTypeId
that assigns each possible value to a specific semantic according to the specification. - VBEMemory
Model - The MemoryModel field specifies the general type of memory organization used in modes.
Constants§
- MAGIC
- 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§
- Maybe
DynSized - A trait to abstract sized and unsized structures (DSTs). It enables
casting a
DynSizedStructure
to sized or unsized structures usingDynSizedStructure::cast
. - Pointee
- Provides the pointer metadata type of any pointed-to type.
- Tag
- Extension of
MaybeDynSized
for Tags.
Functions§
- parse_
slice_ as_ string - Parses the provided byte sequence as Multiboot string, which maps to a
str
.
Type Aliases§
- TagIter
- Iterator over the tags of a Multiboot2 boot information.
Derive Macros§
- Pointee
- Generates an implementation of
Pointee
for structs with a DST as its last field.