From 22447647773074fdec1db80a827e475b4058e4d6 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Wed, 3 Feb 2021 17:01:19 -0800 Subject: [PATCH] [kernel] Set process stack pointer correctly The rsp returned by initialize_main_user_stack() needs to be put into the cpu data area, not just put into the stack (the stack only fills in rbp). --- src/kernel/task.s | 1 + 1 file changed, 1 insertion(+) diff --git a/src/kernel/task.s b/src/kernel/task.s index bc2fdfa..be201d2 100644 --- a/src/kernel/task.s +++ b/src/kernel/task.s @@ -63,6 +63,7 @@ initialize_main_thread: ; user rsp is now in rax, put it in the right place for sysret mov [rsp + 0x30], rax + mov [gs:CPU_DATA.rsp3], rax ; the entrypoint should already be on the stack jmp kernel_to_user_trampoline