Skip to content

Commit 56ecfa1

Browse files
committed
add kernel stack address to BootInfo
1 parent 8706e2c commit 56ecfa1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

api/src/info.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ pub struct BootInfo {
6262
pub kernel_len: u64,
6363
/// Virtual address of the loaded kernel image.
6464
pub kernel_image_offset: u64,
65+
/// Virtual address of the start of the kernel stack
66+
pub kernel_stack_addr: u64,
67+
/// Size of the kernel stack
68+
pub kernel_stack_len: u64,
6569

6670
#[doc(hidden)]
6771
pub _test_sentinel: u64,
@@ -85,6 +89,8 @@ impl BootInfo {
8589
kernel_addr: 0,
8690
kernel_len: 0,
8791
kernel_image_offset: 0,
92+
kernel_stack_addr: 0,
93+
kernel_stack_len: 0,
8894
_test_sentinel: 0,
8995
}
9096
}

common/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ where
415415
Mappings {
416416
framebuffer: framebuffer_virt_addr,
417417
entry_point,
418+
stack_start: stack_start.start_address(),
418419
// Use the configured stack size, even if it's not page-aligned. However, we
419420
// need to align it down to the next 16-byte boundary because the System V
420421
// ABI requires a 16-byte stack alignment.
@@ -438,6 +439,7 @@ where
438439
pub struct Mappings {
439440
/// The entry point address of the kernel.
440441
pub entry_point: VirtAddr,
442+
pub stack_start: VirtAddr,
441443
/// The (exclusive) end address of the kernel stack.
442444
pub stack_top: VirtAddr,
443445
/// Keeps track of used entries in the level 4 page table, useful for finding a free
@@ -579,6 +581,8 @@ where
579581
info.kernel_addr = mappings.kernel_slice_start.as_u64();
580582
info.kernel_len = mappings.kernel_slice_len as _;
581583
info.kernel_image_offset = mappings.kernel_image_offset.as_u64();
584+
info.kernel_stack_addr = mappings.stack_start.as_u64();
585+
info.kernel_stack_len = config.kernel_stack_size;
582586
info._test_sentinel = boot_config._test_sentinel;
583587
info
584588
});

0 commit comments

Comments
 (0)