Expand description
Convenient and safe parsing of Multiboot2 Header structures and the
contained header tags. Usable in no_std
environments, such as a
bootloader. An optional builder feature also allows the construction of
the corresponding structures.
§Design
For every Multiboot2 header 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: Parsing a Header
use multiboot2_header::Multiboot2Header;
let ptr = 0x1337_0000 as *const u8 /* use real ptr here */;
let mb2_hdr = unsafe { Multiboot2Header::load(ptr.cast()) }.unwrap();
for _tag in mb2_hdr.iter() {
//
}
§MSRV
The MSRV is 1.75.0 stable.
Structs§
- Address
Header Tag - Binary address information for non-ELF images.
- Builder
- Builder for a Multiboot2 header information.
- Console
Header Tag - Tells that a console must be available in MBI. Only relevant for legacy BIOS.
- DynSized
Structure - An C ABI-compatible dynamically sized type with a common sized
Header
and a dynamic amount of bytes. - EfiBoot
Service Header Tag - This tag indicates that payload supports starting without terminating UEFI boot services. Or in other words: The payload wants to use UEFI boot services.
- EndHeader
Tag - Terminates a list of optional tags in a Multiboot2 header.
- Entry
Address Header Tag - Specifies the physical address to which the boot loader should jump in order to start running the operating system. Not needed for ELF files.
- Entry
Efi32 Header Tag - Contains the entry address for EFI i386 machine state.
- Entry
Efi64 Header Tag - Contains the entry address for EFI amd64 machine state.
- Framebuffer
Header Tag - Specifies the preferred graphics mode. If this tag is present the bootloader assumes that the payload has framebuffer support. Note: This is only a recommended mode. Only relevant on legacy BIOS.
- Header
TagHeader - The common header that all header tags share. Specific tags may have
additional fields that depend on the
typ
and thesize
field. - Information
Request Header Tag - Specifies what specific tag types the bootloader should provide inside the mbi.
- MbiTag
Type Id - Re-export of
multiboot2::TagType
frommultiboot2
-crate. Serialized form ofTagType
that matches the binary representation (u32
). - Module
Align Header Tag - If this tag is present, provided boot modules must be page aligned.
- Multiboot2
Basic Header - The “basic” Multiboot2 header. This means only the properties, that are known during compile time. All other information are derived during runtime from the size property.
- Multiboot2
Header - Wrapper type around a pointer to the Multiboot2 header.
- Relocatable
Header Tag - This tag indicates that the image is relocatable.
Enums§
- Console
Header TagFlags - Possible flags for
ConsoleHeaderTag
. - Header
TagFlag - Flags for Multiboot2 header tags.
- Header
TagISA - ISA/ARCH in Multiboot2 header.
- Header
TagType - Possible types for header tags of a Multiboot2 header.
- Load
Error - Errors that occur when a chunk of memory can’t be parsed as
Multiboot2Header
. - MbiTag
Type - Re-export of
multiboot2::TagType
frommultiboot2
-crate. Higher level abstraction forTagTypeId
that assigns each possible value to a specific semantic according to the specification. - Relocatable
Header TagPreference - It contains load address placement suggestion for bootloader.
Constants§
- MAGIC
- Magic value for a
Multiboot2Header
, as defined by the spec.
Traits§
- Maybe
DynSized - A trait to abstract sized and unsized structures (DSTs). It enables
casting a
DynSizedStructure
to sized or unsized structures usingDynSizedStructure::cast
. - Tag
- Extension of
MaybeDynSized
for Tags.
Type Aliases§
- TagIter
- Iterator over the tags of a Multiboot2 boot information.