Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ pub struct BootInfo {
pub kernel_len: u64,
/// Virtual address of the loaded kernel image.
pub kernel_image_offset: u64,
/// Virtual address of the start of the kernel stack
pub kernel_stack_addr: u64,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"start" can be a bit confusing because the stack grows down. Let's be clear that this is the lowest address of the stack, also sometimes referred to as the bottom of the stack.

/// Size of the kernel stack
pub kernel_stack_len: u64,

#[doc(hidden)]
pub _test_sentinel: u64,
Expand All @@ -85,6 +89,8 @@ impl BootInfo {
kernel_addr: 0,
kernel_len: 0,
kernel_image_offset: 0,
kernel_stack_addr: 0,
kernel_stack_len: 0,
_test_sentinel: 0,
}
}
Expand Down
4 changes: 4 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ where
Mappings {
framebuffer: framebuffer_virt_addr,
entry_point,
stack_start: stack_start.start_address(),
// Use the configured stack size, even if it's not page-aligned. However, we
// need to align it down to the next 16-byte boundary because the System V
// ABI requires a 16-byte stack alignment.
Expand All @@ -438,6 +439,7 @@ where
pub struct Mappings {
/// The entry point address of the kernel.
pub entry_point: VirtAddr,
pub stack_start: VirtAddr,
/// The (exclusive) end address of the kernel stack.
pub stack_top: VirtAddr,
/// Keeps track of used entries in the level 4 page table, useful for finding a free
Expand Down Expand Up @@ -579,6 +581,8 @@ where
info.kernel_addr = mappings.kernel_slice_start.as_u64();
info.kernel_len = mappings.kernel_slice_len as _;
info.kernel_image_offset = mappings.kernel_image_offset.as_u64();
info.kernel_stack_addr = mappings.stack_start.as_u64();
info.kernel_stack_len = config.kernel_stack_size;
info._test_sentinel = boot_config._test_sentinel;
info
});
Expand Down
Loading