acadia/zion/memory/kernel_stack_manager.h

29 lines
634 B
C
Raw Normal View History

#pragma once
#include <stdint.h>
// KernelStackManager doles out kernel stacks.
//
// KernelStacks are in the region:
// 0xFFFFFFFF 90000000 - 0xFFFFFFFF 9FFFFFFF
//
// Each kernel stack is 12 KiB with a 4 Kib page boundary.
//
// It is global object that is only exposed via internal linkage
// to the VirtualMemory class. All kernel stacks should be created through that
// class.
class KernelStackManager {
public:
KernelStackManager();
void SetupInterruptStack();
uint64_t AllocateKernelStack();
void FreeKernelStack(uint64_t stack_base);
private:
uint64_t next_stack_addr_;
uint64_t freed_stack_cnt_ = 0;
};