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.
ConsoleHeaderTagFlagsRaw
ABI compatible representation of the console flags of the ConsoleHeaderTag.
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.
HeaderTagFlagRaw
ABI compatible representation of the flags of a Multiboot2 header tag.
HeaderTagHeader
The common header that all header tags share. Specific tags may have additional fields that depend on the typ and the size field.
HeaderTagISARaw
ABI compatible representation of the ISA/ARCH of a Multiboot2 header.
HeaderTagTypeRaw
ABI compatible representation of the type of a Multiboot2 header tag.
InformationRequestHeaderTag
Specifies which tag types the bootloader should provide inside the mbi.
MbiTagTypeRaw
Re-export of multiboot2::TagType from multiboot2-crate. ABI compatible representation of the type of a boot information tag.
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.
RelocatableHeaderTagPreferenceRaw
ABI compatible representation of the placement preference of the relocatable header tag.

Enums§

ConsoleHeaderTagFlags
The console flags of the ConsoleHeaderTag.
HeaderTagFlag
Flags of a Multiboot2 header tag.
HeaderTagISA
The ISA/ARCH a Multiboot2 image targets.
HeaderTagType
The type of a Multiboot2 header tag.
LoadError
Errors that occur when a chunk of memory can’t be parsed as Header.
MbiTagType
Re-export of multiboot2::TagType from multiboot2-crate. The type of a boot information tag.
RelocatableHeaderTagPreference
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.