[Zion] Add a way to unwind the stack and recover from user-space faults.

This commit is contained in:
Drew Galbraith 2023-11-22 18:25:08 -08:00
parent 8ceab2ad23
commit 941d7c8d59
6 changed files with 63 additions and 0 deletions

View file

@ -1,6 +1,7 @@
#include "object/thread.h"
#include "common/gdt.h"
#include "common/stack_unwind.h"
#include "debug/debug.h"
#include "memory/kernel_vmm.h"
#include "memory/paging_util.h"
@ -71,6 +72,7 @@ void Thread::Init() {
// will emit movaps calls to non-16-bit-aligned stack
// addresses.
rsp -= 0x8;
*reinterpret_cast<uint64_t*>(rsp) = kStackBaseSentinel;
SetRsp0(rsp0_start_);
jump_user_space(rip_, rsp, arg1_, arg2_);
}