Struct multiboot2::BootInformation
source · pub struct BootInformation { /* private fields */ }
Expand description
A Multiboot 2 Boot Information struct.
Implementations§
source§impl BootInformation
impl BootInformation
sourcepub fn start_address(&self) -> usize
pub fn start_address(&self) -> usize
Get the start address of the boot info.
sourcepub fn end_address(&self) -> usize
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();
sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Get the total size of the boot info struct.
sourcepub fn elf_sections_tag(&self) -> Option<ElfSectionsTag>
pub fn elf_sections_tag(&self) -> Option<ElfSectionsTag>
Search for the ELF Sections tag.
sourcepub fn memory_map_tag(&self) -> Option<&MemoryMapTag>
pub fn memory_map_tag(&self) -> Option<&MemoryMapTag>
Search for the Memory map tag.
Get an iterator of all module tags.
sourcepub fn boot_loader_name_tag(&self) -> Option<&BootLoaderNameTag>
pub fn boot_loader_name_tag(&self) -> Option<&BootLoaderNameTag>
Search for the BootLoader name tag.
sourcepub fn command_line_tag(&self) -> Option<&CommandLineTag>
pub fn command_line_tag(&self) -> Option<&CommandLineTag>
Search for the Command line tag.
sourcepub fn framebuffer_tag(
&self
) -> Option<Result<FramebufferTag<'_>, UnknownFramebufferType>>
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.
sourcepub fn efi_sdt_32_tag(&self) -> Option<&EFISdt32>
pub fn efi_sdt_32_tag(&self) -> Option<&EFISdt32>
Search for the EFI 32-bit SDT tag.
sourcepub fn efi_sdt_64_tag(&self) -> Option<&EFISdt64>
pub fn efi_sdt_64_tag(&self) -> Option<&EFISdt64>
Search for the EFI 64-bit SDT tag.
sourcepub fn rsdp_v1_tag(&self) -> Option<&RsdpV1Tag>
pub fn rsdp_v1_tag(&self) -> Option<&RsdpV1Tag>
Search for the (ACPI 1.0) RSDP tag.
sourcepub fn rsdp_v2_tag(&self) -> Option<&RsdpV2Tag>
pub fn rsdp_v2_tag(&self) -> Option<&RsdpV2Tag>
Search for the (ACPI 2.0 or later) RSDP tag.
sourcepub fn efi_memory_map_tag(&self) -> Option<&EFIMemoryMapTag>
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.
sourcepub fn efi_32_ih(&self) -> Option<&EFIImageHandle32>
pub fn efi_32_ih(&self) -> Option<&EFIImageHandle32>
Search for the EFI 32-bit image handle pointer.
sourcepub fn efi_64_ih(&self) -> Option<&EFIImageHandle64>
pub fn efi_64_ih(&self) -> Option<&EFIImageHandle64>
Search for the EFI 64-bit image handle pointer.
sourcepub fn load_base_addr(&self) -> Option<&ImageLoadPhysAddr>
pub fn load_base_addr(&self) -> Option<&ImageLoadPhysAddr>
Search for the Image Load Base Physical Address.
sourcepub fn vbe_info_tag(&self) -> Option<&VBEInfoTag>
pub fn vbe_info_tag(&self) -> Option<&VBEInfoTag>
Search for the VBE information tag.
sourcepub fn get_tag<Tag, TagType: Into<TagTypeId>>(
&self,
typ: TagType
) -> Option<&Tag>
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");