Crate multiboot2_header

Source
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§

AddressHeaderTag
Binary address information for non-ELF images.
Builder
Builder for a Multiboot2 header information.
ConsoleHeaderTag
Tells that a console must be available in MBI. Only relevant for legacy BIOS.
DynSizedStructure
An C ABI-compatible dynamically sized type with a common sized Header and a dynamic amount of bytes.
EfiBootServiceHeaderTag
This tag indicates that payload supports starting without terminating UEFI boot services. Or in other words: The payload wants to use UEFI boot services.
EndHeaderTag
Terminates a list of optional tags in a Multiboot2 header.
EntryAddressHeaderTag
Specifies the physical address to which the boot loader should jump in order to start running the operating system. Not needed for ELF files.
EntryEfi32HeaderTag
Contains the entry address for EFI i386 machine state.
EntryEfi64HeaderTag
Contains the entry address for EFI amd64 machine state.
FramebufferHeaderTag
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.
HeaderTagHeader
The common header that all header tags share. Specific tags may have additional fields that depend on the typ and the size field.
InformationRequestHeaderTag
Specifies what specific tag types the bootloader should provide inside the mbi.
MbiTagTypeId
Re-export of multiboot2::TagType from multiboot2-crate. Serialized form of TagType that matches the binary representation (u32).
ModuleAlignHeaderTag
If this tag is present, provided boot modules must be page aligned.
Multiboot2BasicHeader
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.
Multiboot2Header
Wrapper type around a pointer to the Multiboot2 header.
RelocatableHeaderTag
This tag indicates that the image is relocatable.

Enums§

ConsoleHeaderTagFlags
Possible flags for ConsoleHeaderTag.
HeaderTagFlag
Flags for Multiboot2 header tags.
HeaderTagISA
ISA/ARCH in Multiboot2 header.
HeaderTagType
Possible types for header tags of a Multiboot2 header.
LoadError
Errors that occur when a chunk of memory can’t be parsed as Multiboot2Header.
MbiTagType
Re-export of multiboot2::TagType from multiboot2-crate. Higher level abstraction for TagTypeId that assigns each possible value to a specific semantic according to the specification.
RelocatableHeaderTagPreference
It contains load address placement suggestion for bootloader.

Constants§

MAGIC
Magic value for a Multiboot2Header, as defined by the spec.

Traits§

MaybeDynSized
A trait to abstract sized and unsized structures (DSTs). It enables casting a DynSizedStructure to sized or unsized structures using DynSizedStructure::cast.
Tag
Extension of MaybeDynSized for Tags.

Type Aliases§

TagIter
Iterator over the tags of a Multiboot2 boot information.