From 8e268df60bde6b5548b849cc9b83a224a74b3e43 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 17 Sep 2025 19:21:57 -0400 Subject: kern: Add syscall entry and SYS_exit syscall Signed-off-by: Ian Moffett --- src/sys/arch/amd64/cpu/trap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/sys/arch/amd64/cpu/trap.c') diff --git a/src/sys/arch/amd64/cpu/trap.c b/src/sys/arch/amd64/cpu/trap.c index 046263b..6ddc079 100644 --- a/src/sys/arch/amd64/cpu/trap.c +++ b/src/sys/arch/amd64/cpu/trap.c @@ -36,6 +36,7 @@ #include #include #include +#include #include /* @@ -145,6 +146,24 @@ trapframe_dump(struct trapframe *tf) tf->rbp, tf->rsp, tf->rip); } +void +trap_syscall(struct trapframe *tf) +{ + struct syscall_args scargs = { + .arg[0] = tf->rdi, + .arg[1] = tf->rsi, + .arg[2] = tf->rdx, + .arg[3] = tf->r10, + .arg[4] = tf->r9, + .arg[5] = tf->r8, + .tf = tf + }; + + if (tf->rax < MAX_SYSCALLS && tf->rax > 0) { + tf->rax = g_sctab[tf->rax](&scargs); + } +} + void trap_handler(struct trapframe *tf) { -- cgit v1.2.3