From a82ab8ad6d277ededc128678aebabf5fbdb01c45 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sun, 28 Dec 2025 00:48:24 +0800 Subject: feat(syscall): Implement syscall dispatch and process lifecycle (exit/wait/sleep) --- include/kernel/proc.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/kernel/proc.h') diff --git a/include/kernel/proc.h b/include/kernel/proc.h index 559b137..b557267 100644 --- a/include/kernel/proc.h +++ b/include/kernel/proc.h @@ -1,6 +1,7 @@ #pragma once #include "common/types.h" #include "kernel/trap.h" +#include "kernel/spinlock.h" struct Context { @@ -44,7 +45,9 @@ struct Proc char name[16]; uint64 sz; - // + struct Proc *parent; + void *chan; + int xstate; }; @@ -57,8 +60,13 @@ namespace ProcManager void create_kernel_thread(void (*func)(), const char *name); void user_init(); + void exit(int status); + int wait(uint64 addr); + void sleep(void *chan, struct spinlock *lk); + void wakeup(void *chan); } void forkret(); struct Proc *myproc(); -void usertrapret(); \ No newline at end of file +void usertrapret(); +int fork(); \ No newline at end of file -- cgit v1.2.3