Skip to main content

Crate multiboot2_header

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. The default 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.

§Features and no_std Compatibility

This library is always no_std. The default builder feature enables alloc; using it requires an #[global_allocator]. Remove that feature if you do not need to construct headers.

§Example: Parsing a Header

use multiboot2_header::Header;

let ptr = 0x1337_0000 as *const u8 /* use real ptr here */;
let mb2_hdr = unsafe { Header::load(ptr.cast()) }.unwrap();
for _tag in mb2_hdr.iter() {
    //
}

§MSRV

The MSRV is 1.85.1 stable.

Structs§

AddressHeaderTag
Binary address information for non-ELF images.
Builder
Builder for a Multiboot2 header.
ConsoleHeaderTag
Tells that a console must be available in MBI. Only relevant for legacy BIOS.
DynSizedStructure
A C ABI-compatible dynamically sized type with a common sized Header and a dynamic amount of bytes without hidden implicit padding.
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 bootloader 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.
Header
A parsed complete Multiboot2 header.
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 which 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 fixed prefix of a 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 Header.
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
Specifies the bootloader’s preferred placement for a relocatable image.

Constants§

HEADER_SEARCH_LIMIT
Range from the beginning of an image in which bootloaders will search for a multiboot2 header.
MAGIC
Magic value for a Header, 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 header.