#include #include #include #include #include #include #define DEFINE_SYSCALL(name) \ int name (struct proc* proc, uintptr_t UNUSED a1, uintptr_t UNUSED a2, uintptr_t UNUSED a3, \ uintptr_t UNUSED a4, uintptr_t UNUSED a5, uintptr_t UNUSED a6) DEFINE_SYSCALL (sys_proc_quit) { proc_kill (proc); proc_sched (); return SR_OK; } DEFINE_SYSCALL (sys_proc_test) { DEBUG ("test syscall message!\n"); return SR_OK; } static syscall_handler_func_t handler_table[] = { [SYS_PROC_QUIT] = &sys_proc_quit, [SYS_PROC_TEST] = &sys_proc_test, }; syscall_handler_func_t syscall_find_handler (int syscall_num) { if (!(syscall_num >= 0 && syscall_num < (sizeof (handler_table) / sizeof (handler_table[0])))) { return NULL; } return handler_table[syscall_num]; }