diff options
Diffstat (limited to 'syscall/handler.c')
-rw-r--r-- | syscall/handler.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/syscall/handler.c b/syscall/handler.c new file mode 100644 index 0000000..5cafdc6 --- /dev/null +++ b/syscall/handler.c @@ -0,0 +1,23 @@ +#include "handler.h" +#include "print.h" +#include "umode_vma.h" +#include "api/errno.h" + +static void *s_handlers[] = { + (void*)_handler_dbg_log, + (void*)_handler_exit +}; +static size_t s_handlers_size = sizeof(s_handlers); + +int +_syscall_handler(void *data) +{ + uintmax_t req_id = 0; + if(user_vma_read(&req_id, data, sizeof(uintmax_t)) != 0) + return -EFAIL; + + if(req_id >= s_handlers_size) return -1; + int (*handle)(void*) = (int (*)(void*))s_handlers[req_id]; + kdbgf("syscall id %i handle %p\n", req_id, handle); + return handle(data); +} |