pub struct BootInformation { /* private fields */ }
Expand description

A Multiboot 2 Boot Information struct.

Implementations§

source§

impl BootInformation

source

pub fn start_address(&self) -> usize

Get the start address of the boot info.

source

pub fn end_address(&self) -> usize

Get the end address of the boot info.

This is the same as doing:

let end_addr = boot_info.start_address() + boot_info.total_size();
source

pub fn total_size(&self) -> usize

Get the total size of the boot info struct.

source

pub fn elf_sections_tag(&self) -> Option<ElfSectionsTag>

Search for the ELF Sections tag.

source

pub fn memory_map_tag(&self) -> Option<&MemoryMapTag>

Search for the Memory map tag.

source

pub fn module_tags(&self) -> ModuleIter<'_>

Get an iterator of all module tags.

source

pub fn boot_loader_name_tag(&self) -> Option<&BootLoaderNameTag>

Search for the BootLoader name tag.

source

pub fn command_line_tag(&self) -> Option<&CommandLineTag>

Search for the Command line tag.

source

pub fn framebuffer_tag( &self ) -> Option<Result<FramebufferTag<'_>, UnknownFramebufferType>>

Search for the VBE framebuffer tag. The result is Some(Err(e)), if the framebuffer type is unknown, while the framebuffer tag is present.

source

pub fn efi_sdt_32_tag(&self) -> Option<&EFISdt32>

Search for the EFI 32-bit SDT tag.

source

pub fn efi_sdt_64_tag(&self) -> Option<&EFISdt64>

Search for the EFI 64-bit SDT tag.

source

pub fn rsdp_v1_tag(&self) -> Option<&RsdpV1Tag>

Search for the (ACPI 1.0) RSDP tag.

source

pub fn rsdp_v2_tag(&self) -> Option<&RsdpV2Tag>

Search for the (ACPI 2.0 or later) RSDP tag.

source

pub fn efi_memory_map_tag(&self) -> Option<&EFIMemoryMapTag>

Search for the EFI Memory map tag, if the boot services were exited. Otherwise, if the TagType::EfiBs tag is present, this returns None as it is strictly recommended to get the memory map from the uefi services.

source

pub fn efi_32_ih(&self) -> Option<&EFIImageHandle32>

Search for the EFI 32-bit image handle pointer.

source

pub fn efi_64_ih(&self) -> Option<&EFIImageHandle64>

Search for the EFI 64-bit image handle pointer.

source

pub fn load_base_addr(&self) -> Option<&ImageLoadPhysAddr>

Search for the Image Load Base Physical Address.

source

pub fn vbe_info_tag(&self) -> Option<&VBEInfoTag>

Search for the VBE information tag.

source

pub fn get_tag<Tag, TagType: Into<TagTypeId>>( &self, typ: TagType ) -> Option<&Tag>

Public getter to find any Multiboot tag by its type, including specified and custom ones.

The parameter can be of type u32, TagType, or TagTypeId.

Specified or Custom Tags

The Multiboot2 specification specifies a list of tags, see TagType. However, it doesn’t forbid to use custom tags. Because of this, there exists the TagType abstraction. It is recommended to use this getter only for custom tags. For specified tags, use getters, such as Self::efi_64_ih.

Use Custom Tags

The following example shows how you may use this interface to parse custom tags from the MBI. Custom tags must be Sized. Hence, they are not allowed to contain a field such as name: [u8].

Belows example needs Rust 1.64 or newer because of std::ffi imports!

use std::ffi::{c_char, CStr};
use multiboot2::TagTypeId;

#[repr(C, align(8))]
    struct CustomTag {
    // new type from the lib: has repr(u32)
    tag: TagTypeId,
    size: u32,
    // begin of inline string
    name: u8,
}

let mbi = unsafe { multiboot2::load(0xdeadbeef).unwrap() };

let tag = mbi
    // type definition from end user; must be `Sized`!
    .get_tag::<CustomTag, _>(0x1337)
    .unwrap();
let name = &tag.name as *const u8 as *const c_char;
let str = unsafe { CStr::from_ptr(name).to_str().unwrap() };
assert_eq!(str, "name");

Trait Implementations§

source§

impl Debug for BootInformation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Send for BootInformation

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.