#include "sys/Syscall.h" #include syscall_func_t syscalls[] = { #undef __enumerate #define __enumerate(name) sys_##name, enumerate_syscalls(__enumerate) #undef __enumerate }; i64 invoke_syscall(Registers* regs, SyscallArgs args, u64 syscall) { if (syscall >= Syscalls::__count) { return -ENOSYS; } auto rc = syscalls[syscall](regs, args); if (rc.has_error()) return -rc.error(); return (i64)rc.value(); }