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

@ -16,7 +16,7 @@ SharedPtr<Process> Process::RootProcess() {
uint64_t pml4_addr = 0;
asm volatile("mov %%cr3, %0;" : "=r"(pml4_addr));
SharedPtr<Process> proc(new Process(0, pml4_addr));
proc->threads_.PushBack(Thread::RootThread(proc.ptr()));
proc->threads_.PushBack(Thread::RootThread(*proc));
proc->next_thread_id_ = 1;
return proc;
@ -28,7 +28,7 @@ Process::Process() : id_(gNextId++), state_(RUNNING) {
}
void Process::CreateThread(uint64_t entry) {
Thread* thread = new Thread(this, next_thread_id_++, entry);
Thread* thread = new Thread(*this, next_thread_id_++, entry);
threads_.PushBack(thread);
gScheduler->Enqueue(thread);
}