From b26098268eb443f1ed3dc50d902b2beee40c8342 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 16 Jul 2022 19:35:05 +0200 Subject: amd64: seemingly working syscalls (SYSCALL/SYSRET) --- src/kernel/proc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/kernel/proc.c') diff --git a/src/kernel/proc.c b/src/kernel/proc.c index 1cb6eb0..a202549 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -23,8 +23,10 @@ struct process *process_seed(struct kmain_info *info) { process_first->id = next_pid++; // map the stack to the last page in memory - pagedir_map(process_first->pages, (userptr_t)~PAGE_MASK, page_alloc(1), true, true); - process_first->regs.esp = (userptr_t) ~0xF; + kprintf("0x%x\n", (userptr_t)~PAGE_MASK); + pagedir_map(process_first->pages, (userptr_t)~PAGE_MASK, page_zalloc(1), true, true); + process_first->regs.rsp = (userptr_t) ~0xF; + kprintf("post stack\n"); // map .shared extern char _shared_len; @@ -36,7 +38,7 @@ struct process *process_seed(struct kmain_info *info) { for (uintptr_t off = 0; off < info->init.size; off += PAGE_SIZE) pagedir_map(process_first->pages, init_base + off, info->init.at + off, true, true); - process_first->regs.eip = init_base; + process_first->regs.rcx = init_base; // SYSRET jumps to %rcx return process_first; } -- cgit v1.2.3