File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,10 @@ pub struct BootloaderConfig {
2020 /// The size of the stack that the bootloader should allocate for the kernel (in bytes).
2121 ///
2222 /// The bootloader starts the kernel with a valid stack pointer. This setting defines
23- /// the stack size that the bootloader should allocate and map. The stack is created
24- /// with a guard page, so a stack overflow will lead to a page fault.
23+ /// the stack size that the bootloader should allocate and map.
24+ ///
25+ /// The stack is created with a additional guard page, so a stack overflow will lead to
26+ /// a page fault.
2527 pub kernel_stack_size : u64 ,
2628
2729 /// Configuration for the frame buffer that can be used by the kernel to display pixels
@@ -413,6 +415,14 @@ impl Default for ApiVersion {
413415#[ non_exhaustive]
414416pub struct Mappings {
415417 /// Configures how the kernel stack should be mapped.
418+ ///
419+ /// If a fixed address is set, it must be page aligned.
420+ ///
421+ /// Note that the first page of the kernel stack is intentionally left unmapped
422+ /// to act as a guard page. This ensures that a page fault occurs on a stack
423+ /// overflow. For example, setting the kernel stack address to
424+ /// `FixedAddress(0xf_0000_0000)` will result in a guard page at address
425+ /// `0xf_0000_0000` and the kernel stack starting at address `0xf_0000_1000`.
416426 pub kernel_stack : Mapping ,
417427 /// Specifies where the [`crate::BootInfo`] struct should be placed in virtual memory.
418428 pub boot_info : Mapping ,
You can’t perform that action at this time.
0 commit comments