diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-04-18 21:10:57 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-04-21 12:12:38 +0300 |
| commit | 7967a9ab13214543041e4408086668b4db8d3e62 (patch) | |
| tree | 4dab7b89bd9d5b5b8280877f9d8eb23a1edf1230 /common/uapi/dispatch.c | |
| parent | 1ceed7525272b82c1028ebd353e65c3a63bd2714 (diff) | |
| download | kmi-7967a9ab13214543041e4408086668b4db8d3e62.tar.gz kmi-7967a9ab13214543041e4408086668b4db8d3e62.zip | |
start working on timer subsys
Diffstat (limited to 'common/uapi/dispatch.c')
| -rw-r--r-- | common/uapi/dispatch.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/common/uapi/dispatch.c b/common/uapi/dispatch.c new file mode 100644 index 0000000..3b03c43 --- /dev/null +++ b/common/uapi/dispatch.c @@ -0,0 +1,38 @@ +#include <apos/uapi.h> + +static const sys_t syscall_table[] = { + /* mem */ + [SYS_REQ_MEM] = sys_req_mem, + [SYS_REQ_PMEM] = sys_req_pmem, + [SYS_REQ_FIXMEM] = sys_req_fixmem, + [SYS_FREE_MEM] = sys_free_mem, + + /* timers */ + [SYS_REQ_TIMER] = sys_req_timer, + [SYS_FREE_TIMER] = sys_free_timer, + + /* ipc */ + [SYS_IPC_SERVER] = sys_ipc_server, + [SYS_IPC_REQ] = sys_ipc_req, + [SYS_IPC_RESP] = sys_ipc_resp, + + /* proc */ + [SYS_FORK] = sys_fork, + [SYS_EXEC] = sys_exec, + [SYS_SIGNAL] = sys_signal, + [SYS_SWITCH] = sys_switch, + [SYS_SYNC] = sys_sync, + + /* conf */ + [SYS_CONF] = sys_conf, + [SYS_POWEROFF] = sys_poweroff, +}; + +vm_t syscall_dispatch(vm_t syscall, vm_t a, vm_t b, vm_t c, vm_t d) +{ + sys_t call = syscall_table[syscall]; + if (!call) + return ERR_INVAL; + + return call(a, b, c, d); +} |
