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>

Multiboot structure.

source

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 the MemoryManagement 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.

source

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 a MultibootInfo struct.
  • memory_management - Translation of the physical addresses into kernel addresses, allocation and deallocation of memory. See the MemoryManagement description for more details.
§Safety

The user must ensure that the memory management can allocate memory.

source

pub fn has_memory_bounds(&self) -> bool

If true, then the mem_upper and mem_lower fields are valid.

source

pub fn set_has_memory_bounds(&mut self, flag: bool)

If true, then the mem_upper and mem_lower fields are valid.

source

pub fn has_boot_device(&self) -> bool

If true, then the boot_device field is valid.

source

pub fn set_has_boot_device(&mut self, flag: bool)

If true, then the boot_device field is valid.

source

pub fn has_cmdline(&self) -> bool

If true, then the cmdline field is valid.

source

pub fn set_has_cmdline(&mut self, flag: bool)

If true, then the cmdline field is valid.

source

pub fn has_modules(&self) -> bool

If true, then the mods_addr and mods_count fields are valid.

source

pub fn set_has_modules(&mut self, flag: bool)

If true, then the mods_addr and mods_count fields are valid.

source

pub fn has_aout_symbols(&self) -> bool

If true, then the syms field is valid and contains AOut symbols.

source

pub fn set_has_aout_symbols(&mut self, flag: bool)

If true, then the syms field is valid and contains AOut symbols.

source

pub fn has_elf_symbols(&self) -> bool

If true, then the syms field is valid and containts ELF symbols.

source

pub fn set_has_elf_symbols(&mut self, flag: bool)

If true, then the syms field is valid and containts ELF symbols.

source

pub fn has_memory_map(&self) -> bool

If true, then the mmap_addr and mmap_length fields are valid.

source

pub fn set_has_memory_map(&mut self, flag: bool)

If true, then the mmap_addr and mmap_length fields are valid.

source

pub fn has_drives(&self) -> bool

If true, then the drives_addr and drives_length fields are valid.

source

pub fn set_has_drives(&mut self, flag: bool)

If true, then the drives_addr and drives_length fields are valid.

source

pub fn has_config_table(&self) -> bool

If true, then the config_table field is valid.

source

pub fn set_has_config_table(&mut self, flag: bool)

If true, then the config_table field is valid.

source

pub fn has_boot_loader_name(&self) -> bool

If true, then the boot_loader_name field is valid.

source

pub fn set_has_boot_loader_name(&mut self, flag: bool)

If true, then the boot_loader_name field is valid.

source

pub fn has_apm_table(&self) -> bool

If true, then the apm_table field is valid.

source

pub fn set_has_apm_table(&mut self, flag: bool)

If true, then the apm_table field is valid.

source

pub fn has_vbe(&self) -> bool

If true, then the vbe_* fields are valid.

source

pub fn set_has_vbe(&mut self, flag: bool)

If true, then the vbe_* fields are valid.

source

pub fn has_framebuffer_table(&self) -> bool

If true, then the framebuffer table is valid.

source

pub fn set_has_framebuffer_table(&mut self, flag: bool)

If true, then the framebuffer table is valid.

source

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.

source

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.

source

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.

source

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.

source

pub fn command_line(&self) -> Option<&'a str>

Command line passed to the kernel.

source

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.

source

pub fn boot_loader_name(&self) -> Option<&'a str>

Get the name of the bootloader.

source

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.

source

pub fn modules(&'a self) -> Option<ModuleIter<'a, 'b>>

Discover all additional modules in multiboot.

source

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.

source

pub fn symbols(&self) -> Option<SymbolType>

Get the symbols.

source

pub fn set_symbols(&mut self, symbols: Option<SymbolType>)

Set the symbols.

Note that the address in either AOutSymbols or ElfSymbols must stay valid.

source

pub fn memory_regions(&'a self) -> Option<MemoryMapIter<'a, 'b>>

Discover all memory regions in the multiboot memory map.

source

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 MemoryEntrys.

Note that the underlying memory has to stay intact.

source

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.

source

pub fn framebuffer_table(&self) -> Option<&FramebufferTable>

Return the framebuffer table, if it exists.

source

pub fn set_framebuffer_table(&mut self, table: Option<FramebufferTable>)

Set the framebuffer table, if it exists.

Auto Trait Implementations§

§

impl<'a, 'b> !RefUnwindSafe for Multiboot<'a, 'b>

§

impl<'a, 'b> !Send for Multiboot<'a, 'b>

§

impl<'a, 'b> !Sync for Multiboot<'a, 'b>

§

impl<'a, 'b> Unpin for Multiboot<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for Multiboot<'a, 'b>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

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

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.