Crate multiboot2
source ·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§
- The Advanced Power Management (APM) tag.
- Basic memory info tag.
- A Multiboot 2 Boot Information (MBI) accessor.
- The basic header of a
BootInformation
as sized Rust type. - The bootloader name tag.
- The end tag ends the information struct.
- Builder for a Multiboot2 header information.
- This tag contains the command line string.
- An C ABI-compatible dynamically sized type with a common sized
Header
and a dynamic amount of bytes. - EFI ExitBootServices was not called tag. This tag has no payload and is just a marker.
- 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.
- Flags describing the capabilities of a memory range.
- 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.
- EFI memory map tag. The embedded
EFIMemoryDesc
s 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 descriptor for an available or taken area of physical memory.
- 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.
- The end tag ends the information struct.
- 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.
- The common header that all tags have in common. This type is ABI compatible.
- Serialized form of
TagType
that matches the binary representation (u32
). - 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.
- Structured accessory to the provided framebuffer type that is not ABI compatible.
- Errors that occur when a chunk of memory can’t be parsed as
BootInformation
. - 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. - 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§
- A trait to abstract sized and unsized structures (DSTs). It enables casting a
DynSizedStructure
to sized or unsized structures usingDynSizedStructure::cast
. - Provides the pointer metadata type of any pointed-to type.
- Extension of
MaybeDynSized
for Tags.
Functions§
- Parses the provided byte sequence as Multiboot string, which maps to a
str
.
Type Aliases§
- Iterator over the tags of a Multiboot2 boot information.
Derive Macros§
- Generates an implementation of
Pointee
for structs with a DST as its last field.