diff --git a/kernel/kernel/Syscall.cpp b/kernel/kernel/Syscall.cpp index ab979b68b6..9ae400ced4 100644 --- a/kernel/kernel/Syscall.cpp +++ b/kernel/kernel/Syscall.cpp @@ -7,6 +7,8 @@ #include +#define DUMP_ALL_SYSCALLS 0 + namespace Kernel { @@ -28,6 +30,12 @@ namespace Kernel #undef O }; + static constexpr const char* s_syscall_names[] { +#define O(enum, name) #enum, + __SYSCALL_LIST(O) +#undef O + }; + extern "C" long cpp_syscall_handler(int syscall, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, InterruptStack* interrupt_stack) { ASSERT(GDT::is_user_segment(interrupt_stack->cs)); @@ -46,7 +54,13 @@ namespace Kernel asm volatile("cli"); if (ret.is_error() && ret.error().get_error_code() == ENOTSUP) - dprintln("ENOTSUP {}", syscall); + dprintln("{}: ENOTSUP", s_syscall_names[syscall]); +#if DUMP_ALL_SYSCALLS + else if (ret.is_error()) + dprintln("{}: {}", s_syscall_names[syscall], ret.error()); + else + dprintln("{}: {}", s_syscall_names[syscall], ret.value()); +#endif if (ret.is_error() && ret.error().is_kernel_error()) Kernel::panic("Kernel error while returning to userspace {}", ret.error());