Wireframe for syscalls in place

This commit is contained in:
Drew Galbraith 2023-05-18 16:03:09 -07:00
parent d3024211a7
commit f86bbe6ea9
7 changed files with 130 additions and 0 deletions

View file

@ -28,6 +28,7 @@ Thread::Thread(Process* proc, uint64_t tid) : process_(proc), id_(tid) {
// 16: cr3
*(stack_ptr - 16) = proc->cr3();
rsp0_ = reinterpret_cast<uint64_t>(stack_ptr - 16);
rsp0_start_ = reinterpret_cast<uint64_t>(stack_ptr);
}
uint64_t Thread::pid() { return process_->id(); }

View file

@ -17,6 +17,7 @@ class Thread {
Process& process() { return *process_; }
uint64_t* Rsp0Ptr() { return &rsp0_; }
uint64_t Rsp0Start() { return rsp0_start_; }
// Called the first time the thread starts up.
void Init();
@ -33,4 +34,7 @@ class Thread {
// Stack pointer to take on resume.
// Stack will contain the full thread context.
uint64_t rsp0_;
// Stack pointer to take when returning from userspace.
// I don't think me mind clobbering the stack here.
uint64_t rsp0_start_;
};