Crate multiboot2_header
source ·Expand description
Rust library with type definitions and parsing functions for Multiboot2
headers, as well as a builder to build them at runtime. This library is
no_std and can be used in bootloaders.
§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.70.0 stable.
Structs§
- This information does not need to be provided if the kernel image is in ELF format, but it must be provided if the image is in a.out format or in some other format. Required for legacy boot (BIOS). Determines load addresses.
- Builder for a Multiboot2 header information.
- Tells that a console must be available in MBI. Only relevant for legacy BIOS.
- This tag indicates that payload supports starting without terminating UEFI boot services. Or in other words: The payload wants to use UEFI boot services.
- Terminates a list of optional tags in a Multiboot2 header.
- Specifies the physical address to which the boot loader should jump in order to start running the operating system. Not needed for ELF files.
- This tag is taken into account only on EFI i386 platforms when Multiboot2 image header contains EFI boot services tag. Then entry point specified in ELF header and the entry address tag of Multiboot2 header are ignored.
- This tag is taken into account only on EFI amd64 platforms when Multiboot2 image header contains EFI boot services tag. Then entry point specified in ELF header and the entry address tag of Multiboot2 header are ignored.
- 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.
- The common header that all header tags share. Specific tags may have additional fields that depend on the
typand thesizefield. - Specifies what specific tag types the bootloader should provide inside the mbi.
- Re-export of
multiboot2::TagTypefrommultiboot2-crate. Serialized form ofTagTypethat matches the binary representation (u32). The abstraction corresponds to thetyp/typefield of a Multiboot2TagHeader. This type can easily be created from or converted toTagType. - If this tag is present, provided boot modules must be page aligned.
- 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.
- Wrapper type around a pointer to the Multiboot2 header. The Multiboot2 header is the
Multiboot2BasicHeaderfollowed by all tags (seecrate::tags::HeaderTagType). Use this if you get a pointer to the header and just want to parse it. If you want to construct the type by yourself, please look atHeaderBuilder(requires thebuilderfeature). - This tag indicates that the image is relocatable.
Enums§
- Possible flags for
ConsoleHeaderTag. - Flags for Multiboot2 header tags.
- ISA/ARCH in Multiboot2 header.
- Possible types for header tags of a Multiboot2 header. The names and values are taken from the example C code at the bottom of the Multiboot2 specification. This value stands in the
typproperty ofHeaderTagHeader. - Errors that occur when a chunk of memory can’t be parsed as
Multiboot2Header. - Re-export of
multiboot2::TagTypefrommultiboot2-crate. Higher level abstraction forTagTypeIdthat assigns each possible value to a specific semantic according to the specification. Additionally, it allows to use theTagType::Customvariant. It is not binary compatible withTagTypeId. - It contains load address placement suggestion for boot loader. Boot loader should follow it. ‘0’ means none, ‘1’ means load image at lowest possible address but not lower than min addr and ‘2’ means load image at highest possible address but not higher than max addr.
Constants§
- Magic value for a
Multiboot2Header, as defined by the spec.
Traits§
- A trait to abstract sized and unsized structures (DSTs). It enables casting a
DynSizedStructureto sized or unsized structures usingDynSizedStructure::cast. - Extension of
MaybeDynSizedfor Tags.
Type Aliases§
- Iterator over the tags of a Multiboot2 boot information.