Manage KernelStacks separately rather than just allocing bytes.

Create a global KernelStackManager that will handle the relevant allocs.
This commit is contained in:
Drew Galbraith 2023-05-30 21:27:20 -07:00
parent 3c3341a90f
commit f22dd66c8d
9 changed files with 104 additions and 24 deletions

View file

@ -42,14 +42,10 @@ class VirtualMemory {
VirtualMemory(const VirtualMemory&) = delete;
VirtualMemory(VirtualMemory&&) = delete;
uint64_t GetNextMemMapAddr(uint64_t size) {
uint64_t addr = next_memmap_addr_;
next_memmap_addr_ += size;
if (next_memmap_addr_ >= 0x30'00000000) {
panic("OOM: Memmap");
}
return addr;
}
uint64_t GetNextMemMapAddr(uint64_t size);
// Kernel
uint64_t* AllocateKernelStack();
private:
uint64_t cr3_ = 0;