proc_quit () and proc_test () syscalls
All checks were successful
Build documentation / build-and-deploy (push) Successful in 43s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 43s
This commit is contained in:
34
kernel/syscall/syscall.c
Normal file
34
kernel/syscall/syscall.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <aux/compiler.h>
|
||||
#include <libk/std.h>
|
||||
#include <proc/proc.h>
|
||||
#include <sys/debug.h>
|
||||
#include <syscall/defs.h>
|
||||
#include <syscall/syscall.h>
|
||||
|
||||
#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];
|
||||
}
|
||||
Reference in New Issue
Block a user