#[non_exhaustive]pub struct BootloaderConfig {
pub version: ApiVersion,
pub mappings: Mappings,
pub kernel_stack_size: u64,
pub frame_buffer: FrameBuffer,
}
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.version: ApiVersion
The version of the bootloader API.
Automatically generated from the crate version. Checked on deserialization to ensure that the kernel and bootloader use the same API version, i.e. the same config and boot info format.
mappings: Mappings
Configuration for (optional) page table mappings created by the bootloader.
kernel_stack_size: u64
The 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: FrameBuffer
BootConfig
struct when creating the bootable disk imageConfiguration 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 more