From 8d87791fa23fb355826e8782957e5360fa1933f4 Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Mon, 29 May 2023 13:06:43 -0700 Subject: [PATCH] Differentiate syscall handler by number. This causes us to panic on the unhandled exit syscall. --- zion/syscall/syscall.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zion/syscall/syscall.cpp b/zion/syscall/syscall.cpp index 9576450..4b78e88 100644 --- a/zion/syscall/syscall.cpp +++ b/zion/syscall/syscall.cpp @@ -3,6 +3,7 @@ #include #include "debug/debug.h" +#include "include/zcall.h" #include "scheduler/scheduler.h" #define EFER 0xC0000080 @@ -53,5 +54,12 @@ void InitSyscall() { } extern "C" void SyscallHandler(uint64_t call_id, char* message) { - dbgln(message); + Thread& thread = sched::CurrentThread(); + switch (call_id) { + case Z_DEBUG_PRINT: + dbgln("[%u.%u] %s", thread.pid(), thread.tid(), message); + break; + default: + panic("Unhandled syscall number: %u", call_id); + } }