mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
Kernel/riscv64: Don't use the memory before .text as the initial stack
This new stack has the same size as the x86_64 prekernel stack (32K).
This commit is contained in:
parent
3b6a300ed7
commit
227818de9b
3 changed files with 8 additions and 10 deletions
|
@ -150,20 +150,12 @@ static UNMAP_AFTER_INIT void build_mappings(PageBumpAllocator& allocator, u64* r
|
|||
auto start_of_kernel_range = VirtualAddress { bit_cast<FlatPtr>(+start_of_kernel_image) };
|
||||
auto end_of_kernel_range = VirtualAddress { bit_cast<FlatPtr>(+end_of_kernel_image) };
|
||||
|
||||
// FIXME: don't use the memory before `start` as the stack
|
||||
auto start_of_stack_range = VirtualAddress { bit_cast<FlatPtr>(+start_of_kernel_image) }.offset(-64 * KiB);
|
||||
auto end_of_stack_range = VirtualAddress { bit_cast<FlatPtr>(+start_of_kernel_image) };
|
||||
|
||||
auto start_of_physical_kernel_range = PhysicalAddress { start_of_kernel_range.get() }.offset(-calculate_physical_to_link_time_address_offset());
|
||||
auto start_of_physical_stack_range = PhysicalAddress { start_of_stack_range.get() }.offset(-calculate_physical_to_link_time_address_offset());
|
||||
|
||||
// FIXME: dont map everything RWX
|
||||
|
||||
// Map kernel into high virtual memory
|
||||
insert_entries_for_memory_range(allocator, root_table, start_of_kernel_range, end_of_kernel_range, start_of_physical_kernel_range, PageTableEntryBits::Readable | PageTableEntryBits::Writeable | PageTableEntryBits::Executable);
|
||||
|
||||
// Map the stack
|
||||
insert_entries_for_memory_range(allocator, root_table, start_of_stack_range, end_of_stack_range, start_of_physical_stack_range, PageTableEntryBits::Readable | PageTableEntryBits::Writeable);
|
||||
}
|
||||
|
||||
static UNMAP_AFTER_INIT void setup_kernel_page_directory(u64* root_table)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue