Struct multiboot::information::Multiboot
source · pub struct Multiboot<'a, 'b> { /* private fields */ }
Expand description
Multiboot struct clients mainly interact with
To create this use Multiboot::from_ptr
or Multiboot::from_ref
.
Implementations§
source§impl<'a, 'b> Multiboot<'a, 'b>
impl<'a, 'b> Multiboot<'a, 'b>
Multiboot structure.
sourcepub unsafe fn from_ptr(
mboot_ptr: PAddr,
memory_management: &'b mut dyn MemoryManagement
) -> Option<Multiboot<'a, 'b>>
pub unsafe fn from_ptr( mboot_ptr: PAddr, memory_management: &'b mut dyn MemoryManagement ) -> Option<Multiboot<'a, 'b>>
Initializes the multiboot structure from a passed address.
This is the way to go, if you’re writing a kernel.
§Arguments
mboot_ptr
- The physical address of the multiboot header. On qemu for example this is typically at 0x9500.memory_management
- Translation of the physical addresses into kernel addresses, allocation and deallocation of memory. See theMemoryManagement
description for more details.
§Safety
The user must ensure that mboot_ptr holds the physical address of a valid Multiboot1 structure and that memory management provides correct translations.
sourcepub fn from_ref(
info: &'a mut MultibootInfo,
memory_management: &'b mut dyn MemoryManagement
) -> Self
pub fn from_ref( info: &'a mut MultibootInfo, memory_management: &'b mut dyn MemoryManagement ) -> Self
Initializes this struct from an already existing MultibootInfo
reference.
In combination with MultibootInfo::default
this is useful for writing a bootloader.
§Arguments
info
- The (mutable) reference to aMultibootInfo
struct.memory_management
- Translation of the physical addresses into kernel addresses, allocation and deallocation of memory. See theMemoryManagement
description for more details.
§Safety
The user must ensure that the memory management can allocate memory.
sourcepub fn has_memory_bounds(&self) -> bool
pub fn has_memory_bounds(&self) -> bool
If true, then the mem_upper
and mem_lower
fields are valid.
sourcepub fn set_has_memory_bounds(&mut self, flag: bool)
pub fn set_has_memory_bounds(&mut self, flag: bool)
If true, then the mem_upper
and mem_lower
fields are valid.
sourcepub fn has_boot_device(&self) -> bool
pub fn has_boot_device(&self) -> bool
If true, then the boot_device
field is valid.
sourcepub fn set_has_boot_device(&mut self, flag: bool)
pub fn set_has_boot_device(&mut self, flag: bool)
If true, then the boot_device
field is valid.
sourcepub fn has_cmdline(&self) -> bool
pub fn has_cmdline(&self) -> bool
If true, then the cmdline
field is valid.
sourcepub fn set_has_cmdline(&mut self, flag: bool)
pub fn set_has_cmdline(&mut self, flag: bool)
If true, then the cmdline
field is valid.
sourcepub fn has_modules(&self) -> bool
pub fn has_modules(&self) -> bool
If true, then the mods_addr
and mods_count
fields are valid.
sourcepub fn set_has_modules(&mut self, flag: bool)
pub fn set_has_modules(&mut self, flag: bool)
If true, then the mods_addr
and mods_count
fields are valid.
sourcepub fn has_aout_symbols(&self) -> bool
pub fn has_aout_symbols(&self) -> bool
If true, then the syms
field is valid and contains AOut symbols.
sourcepub fn set_has_aout_symbols(&mut self, flag: bool)
pub fn set_has_aout_symbols(&mut self, flag: bool)
If true, then the syms
field is valid and contains AOut symbols.
sourcepub fn has_elf_symbols(&self) -> bool
pub fn has_elf_symbols(&self) -> bool
If true, then the syms
field is valid and containts ELF symbols.
sourcepub fn set_has_elf_symbols(&mut self, flag: bool)
pub fn set_has_elf_symbols(&mut self, flag: bool)
If true, then the syms
field is valid and containts ELF symbols.
sourcepub fn has_memory_map(&self) -> bool
pub fn has_memory_map(&self) -> bool
If true, then the mmap_addr
and mmap_length
fields are valid.
sourcepub fn set_has_memory_map(&mut self, flag: bool)
pub fn set_has_memory_map(&mut self, flag: bool)
If true, then the mmap_addr
and mmap_length
fields are valid.
sourcepub fn has_drives(&self) -> bool
pub fn has_drives(&self) -> bool
If true, then the drives_addr
and drives_length
fields are valid.
sourcepub fn set_has_drives(&mut self, flag: bool)
pub fn set_has_drives(&mut self, flag: bool)
If true, then the drives_addr
and drives_length
fields are valid.
sourcepub fn has_config_table(&self) -> bool
pub fn has_config_table(&self) -> bool
If true, then the config_table
field is valid.
sourcepub fn set_has_config_table(&mut self, flag: bool)
pub fn set_has_config_table(&mut self, flag: bool)
If true, then the config_table
field is valid.
sourcepub fn has_boot_loader_name(&self) -> bool
pub fn has_boot_loader_name(&self) -> bool
If true, then the boot_loader_name
field is valid.
sourcepub fn set_has_boot_loader_name(&mut self, flag: bool)
pub fn set_has_boot_loader_name(&mut self, flag: bool)
If true, then the boot_loader_name
field is valid.
sourcepub fn has_apm_table(&self) -> bool
pub fn has_apm_table(&self) -> bool
If true, then the apm_table
field is valid.
sourcepub fn set_has_apm_table(&mut self, flag: bool)
pub fn set_has_apm_table(&mut self, flag: bool)
If true, then the apm_table
field is valid.
sourcepub fn set_has_vbe(&mut self, flag: bool)
pub fn set_has_vbe(&mut self, flag: bool)
If true, then the vbe_*
fields are valid.
sourcepub fn has_framebuffer_table(&self) -> bool
pub fn has_framebuffer_table(&self) -> bool
If true, then the framebuffer table is valid.
sourcepub fn set_has_framebuffer_table(&mut self, flag: bool)
pub fn set_has_framebuffer_table(&mut self, flag: bool)
If true, then the framebuffer table is valid.
sourcepub fn lower_memory_bound(&self) -> Option<u32>
pub fn lower_memory_bound(&self) -> Option<u32>
Indicate the amount of lower memory in kilobytes.
Lower memory starts at address 0. The maximum possible value for lower memory is 640 kilobytes.
sourcepub fn upper_memory_bound(&self) -> Option<u32>
pub fn upper_memory_bound(&self) -> Option<u32>
Indicate the amount of upper memory in kilobytes.
Upper memory starts at address 1 megabyte. The value returned for upper memory is maximally the address of the first upper memory hole minus 1 megabyte. It is not guaranteed to be this value.
sourcepub fn set_memory_bounds(&mut self, bounds: Option<(u32, u32)>)
pub fn set_memory_bounds(&mut self, bounds: Option<(u32, u32)>)
Sets the memory bounds (lower, upper).
This is one call because Multiboot requires both or none to be set.
sourcepub fn boot_device(&self) -> Option<BootDevice>
pub fn boot_device(&self) -> Option<BootDevice>
Indicates which bios disk device the boot loader loaded the OS image from.
If the OS image was not loaded from a bios disk, then this returns None. The operating system may use this field as a hint for determining its own root device, but is not required to.
sourcepub fn command_line(&self) -> Option<&'a str>
pub fn command_line(&self) -> Option<&'a str>
Command line passed to the kernel.
sourcepub fn set_command_line(&mut self, cmdline: Option<&str>)
pub fn set_command_line(&mut self, cmdline: Option<&str>)
Command line to be passed to the kernel.
The given string will be copied to newly allocated memory.
sourcepub fn boot_loader_name(&self) -> Option<&'a str>
pub fn boot_loader_name(&self) -> Option<&'a str>
Get the name of the bootloader.
sourcepub fn set_boot_loader_name(&mut self, name: Option<&str>)
pub fn set_boot_loader_name(&mut self, name: Option<&str>)
Set the name of the bootloader.
The given string will be copied to newly allocated memory.
sourcepub fn modules(&'a self) -> Option<ModuleIter<'a, 'b>>
pub fn modules(&'a self) -> Option<ModuleIter<'a, 'b>>
Discover all additional modules in multiboot.
sourcepub fn set_modules(&mut self, modules: Option<&[Module<'_>]>)
pub fn set_modules(&mut self, modules: Option<&[Module<'_>]>)
Publish modules to the kernel.
This copies the given metadata into newly allocated memory.
Note that the addresses in each Module
must be and stay valid.
sourcepub fn symbols(&self) -> Option<SymbolType>
pub fn symbols(&self) -> Option<SymbolType>
Get the symbols.
sourcepub fn set_symbols(&mut self, symbols: Option<SymbolType>)
pub fn set_symbols(&mut self, symbols: Option<SymbolType>)
Set the symbols.
Note that the address in either AOutSymbols
or ElfSymbols
must stay valid.
sourcepub fn memory_regions(&'a self) -> Option<MemoryMapIter<'a, 'b>>
pub fn memory_regions(&'a self) -> Option<MemoryMapIter<'a, 'b>>
Discover all memory regions in the multiboot memory map.
sourcepub fn set_memory_regions(&mut self, regions: Option<(PAddr, usize)>)
pub fn set_memory_regions(&mut self, regions: Option<(PAddr, usize)>)
Publish the memory regions to the kernel.
The parameter is a pair of address and number of MemoryEntry
s.
Note that the underlying memory has to stay intact.
sourcepub fn find_highest_address(&self) -> PAddr
pub fn find_highest_address(&self) -> PAddr
Return end address of multiboot image.
This function can be used to figure out a (hopefully) safe offset in the first region of memory to start using as free memory.
sourcepub fn framebuffer_table(&self) -> Option<&FramebufferTable>
pub fn framebuffer_table(&self) -> Option<&FramebufferTable>
Return the framebuffer table, if it exists.
sourcepub fn set_framebuffer_table(&mut self, table: Option<FramebufferTable>)
pub fn set_framebuffer_table(&mut self, table: Option<FramebufferTable>)
Set the framebuffer table, if it exists.