Struct bootloader_api::config::BootloaderConfig
source · #[non_exhaustive]pub struct BootloaderConfig {
pub mappings: Mappings,
pub kernel_stack_size: u64,
pub frame_buffer: FrameBuffer,
/* private fields */
}Expand description
Allows configuring the bootloader behavior.
TODO: describe use together with entry_point macro
TODO: example
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.mappings: MappingsConfiguration for (optional) page table mappings created by the bootloader.
kernel_stack_size: u64The size of the stack that the bootloader should allocate for the kernel (in bytes).
The bootloader starts the kernel with a valid stack pointer. This setting defines the stack size that the bootloader should allocate and map.
The stack is created with a additional guard page, so a stack overflow will lead to a page fault.
frame_buffer: FrameBufferConfiguration for the frame buffer that can be used by the kernel to display pixels on the screen.
Implementations§
source§impl BootloaderConfig
impl BootloaderConfig
sourcepub const fn new_default() -> Self
pub const fn new_default() -> Self
Creates a new default configuration with the following values:
kernel_stack_size: 80kiBmappings: SeeMappings::new_default()
sourcepub const fn serialize(&self) -> [u8; 124]
pub const fn serialize(&self) -> [u8; 124]
Serializes the configuration to a byte array.
This is used by the crate::entry_point macro to store the configuration in a
dedicated section in the resulting ELF file.
sourcepub fn deserialize(serialized: &[u8]) -> Result<Self, &'static str>
pub fn deserialize(serialized: &[u8]) -> Result<Self, &'static str>
Tries to deserialize a config byte array that was created using Self::serialize.
This is used by the bootloader to deserialize the configuration given in the kernel’s ELF file.
TODO: return error enum
Trait Implementations§
source§impl Clone for BootloaderConfig
impl Clone for BootloaderConfig
source§fn clone(&self) -> BootloaderConfig
fn clone(&self) -> BootloaderConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for BootloaderConfig
impl Debug for BootloaderConfig
source§impl Default for BootloaderConfig
impl Default for BootloaderConfig
source§impl PartialEq<BootloaderConfig> for BootloaderConfig
impl PartialEq<BootloaderConfig> for BootloaderConfig
source§fn eq(&self, other: &BootloaderConfig) -> bool
fn eq(&self, other: &BootloaderConfig) -> bool
self and other values to be equal, and is used
by ==.