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

@ -15,14 +15,14 @@ class Thread {
RUNNABLE,
FINISHED,
};
static SharedPtr<Thread> RootThread(Process* root_proc);
static SharedPtr<Thread> RootThread(Process& root_proc);
explicit Thread(const SharedPtr<Process>& proc, uint64_t tid, uint64_t entry);
Thread(Process& proc, uint64_t tid, uint64_t entry);
uint64_t tid() { return id_; };
uint64_t pid();
uint64_t tid() const { return id_; };
uint64_t pid() const;
Process& process() { return *process_; }
Process& process() { return process_; }
uint64_t* Rsp0Ptr() { return &rsp0_; }
uint64_t Rsp0Start() { return rsp0_start_; }
@ -37,8 +37,8 @@ class Thread {
private:
// Special constructor for the root thread only.
Thread(Process* proc) : process_(proc), id_(0) {}
SharedPtr<Process> process_;
Thread(Process& proc) : process_(proc), id_(0) {}
Process& process_;
uint64_t id_;
State state_ = RUNNABLE;