[kernel] Move kernel stacks out of the heap

We were previously allocating kernel stacks as large objects on the
heap. Now keep track of areas of the kernel stack area that are in use,
and allocate them from there. Also required actually implementing
vm_space::commit(). This still needs more work.
This commit is contained in:
2020-08-02 18:15:28 -07:00
parent b98334db28
commit 579eaaf4a0
9 changed files with 123 additions and 33 deletions

View File

@@ -16,8 +16,8 @@ namespace memory {
/// Offset from physical where page tables are mapped.
constexpr uintptr_t page_offset = 0xffffc00000000000;
/// Initial process thread's stack size, in pages
constexpr unsigned initial_stack_pages = 1;
/// Number of pages for a kernel stack
constexpr unsigned kernel_stack_pages = 1;
/// Max size of the kernel heap
constexpr size_t kernel_max_heap = 0x8000000000; // 512GiB
@@ -25,6 +25,12 @@ namespace memory {
/// Start of the kernel heap
constexpr uintptr_t heap_start = page_offset - kernel_max_heap;
/// Start of the kernel stacks
constexpr uintptr_t stacks_start = heap_start - kernel_max_heap;
/// Max size of the kernel stacks area
constexpr size_t kernel_max_stacks = 0x8000000000; // 512GiB
/// First kernel space PML4 entry
constexpr unsigned pml4e_kernel = 256;