summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/usermode.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/usermode.c')
-rw-r--r--arch/x86_64/usermode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86_64/usermode.c b/arch/x86_64/usermode.c
index 68cb45a..99ee128 100644
--- a/arch/x86_64/usermode.c
+++ b/arch/x86_64/usermode.c
@@ -7,6 +7,7 @@
#include "string.h"
#include "device/processor.h"
#include "arch/x86_64/page.h"
+#include "print.h"
static tcb_t s_init_tcb;
@@ -99,7 +100,7 @@ init_load(void)
_initDirectory.entries[INIT_OBJECT_TCB] = (objdir_entry_t) {
.type = KO_TCB,
- .data = (uintptr_t)&s_init_tcb
+ .data = vmem_tophys_koff((uintptr_t)&s_init_tcb)
};
objdir_t *untyped_dir = (objdir_t*)_initDirectory.entries[INIT_OBJECT_UNTYPED_DIR].data;
@@ -123,11 +124,12 @@ init_load(void)
uintptr_t sp = stack_base + 0xFF0;
//Create a kernel stack for the init TCB
- uintptr_t ksp_base = (uintptr_t)s_init_tcb.kstack;
+ uintptr_t ksp_base = (uintptr_t)&s_init_tcb.kstack;
s_init_tcb.ksp = ksp_base + 0xFF0;
processor_t *proc = (processor_t*)processor_current();
- proc->tss.rsp[0] = ksp_base;
+ proc->tss.rsp0 = s_init_tcb.ksp;
+ klogf("RSP0 %p\n", s_init_tcb.ksp);
//Create a message object for init
uintptr_t message_base = init_base + (init_pages << 12);
@@ -145,6 +147,5 @@ init_load(void)
//Setup usermode and jump
proc->tcb = &s_init_tcb;
- proc->tss.rsp[0] = s_init_tcb.ksp;
s_enter_usermode((void*)init_base, (void*)sp);
}