From ba8c7b300fbbf062453ef8858fac0f84dd25a518 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 20 Sep 2022 15:59:25 +0300 Subject: add notify syscall skeleton + Now to actually start implementing shit. :) --- common/uapi/ipc.c | 18 ++++++++++++++++++ common/uapi/proc.c | 14 -------------- include/apos/syscalls.h | 3 +++ include/apos/uapi.h | 24 ++++++++++++------------ 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/common/uapi/ipc.c b/common/uapi/ipc.c index ecfced5..fa0376a 100644 --- a/common/uapi/ipc.c +++ b/common/uapi/ipc.c @@ -76,3 +76,21 @@ SYSCALL_DEFINE4(ipc_resp)(sys_arg_t d0, sys_arg_t d1, sys_arg_t d2, /* something like return_from_callback(t, r) */ return (struct sys_ret){ OK, t->tid, d0, d1, d2, d3 }; } + +/** + * Notify syscall handler. + * + * \todo Implement. + * + * @param tid Thread ID to notify. + * @param swap Whether to swap immediately if possible. + * @param a0 Argument 0. + * @param a1 Argument 1. + * @return \ref OK and 0. + */ +SYSCALL_DEFINE4(ipc_notify)(sys_arg_t tid, sys_arg_t swap, + sys_arg_t a0, sys_arg_t a1){ + /** \todo masquerade as kernel call, set from to 0 and set us as + * notify type, with arguments a0 and a1 as user-configurable data. */ + return (struct sys_ret){ OK, 0, 0 /* type */, 0 /* from */, a0, a1 }; +} diff --git a/common/uapi/proc.c b/common/uapi/proc.c index ba9fb76..67fe141 100644 --- a/common/uapi/proc.c +++ b/common/uapi/proc.c @@ -94,20 +94,6 @@ SYSCALL_DEFINE0(kill)() return (struct sys_ret){ OK, 0, 0, 0, 0, 0}; } -/** - * Signal syscall handler. - * - * \todo Implement. - * - * @param tid Thread ID to signal. - * @param signal Signal to send to \c tid. - * @param swap Whether to immediately swap to thread. - * @return \ref OK and 0. - */ -SYSCALL_DEFINE3(signal)(sys_arg_t tid, sys_arg_t signal, sys_arg_t swap){ - return (struct sys_ret){ OK, 0, 0, 0, 0, 0 }; -} - /** * Swap syscall handler. * diff --git a/include/apos/syscalls.h b/include/apos/syscalls.h index 0a6f0c7..1746255 100644 --- a/include/apos/syscalls.h +++ b/include/apos/syscalls.h @@ -79,6 +79,9 @@ enum { /** IPC response from server. */ SYS_IPC_RESP, + + /** IPC notify thread, essentially interrupt or signal. */ + SYS_IPC_NOTIFY /** @} */ /** @name Process management. */ diff --git a/include/apos/uapi.h b/include/apos/uapi.h index d0ce350..4fab0ec 100644 --- a/include/apos/uapi.h +++ b/include/apos/uapi.h @@ -474,6 +474,18 @@ SYSCALL_DECLARE5(ipc_fwd, pid, d0, d1, d2, d3); * @return \c d0 and \c d1. */ SYSCALL_DECLARE4(ipc_resp, d0, d1, d2, d3); + +/** + * Notify thread syscall. + * + * @param tid Thread ID to notify. + * @param swap Whether to immediately swap. + * @param a0 Argument 0. + * @param a1 Argument 1. + * @param e Unused. + * @return \ref OK and 0. + */ +SYSCALL_DECLARE4(notify, tid, swap, a0, a1); /** @} */ /** @name Process handling syscalls. */ @@ -534,18 +546,6 @@ SYSCALL_DECLARE2(exec, bin, interp); */ SYSCALL_DECLARE1(kill, tid); -/** - * Signal process syscall. - * - * @param tid Thread ID to signal. - * @param signal Signal to send. - * @param swap Whether to immediately swap. - * @param d Unused. - * @param e Unused. - * @return \ref OK and 0. - */ -SYSCALL_DECLARE3(signal, tid, signal, swap); - /** * Swap syscall. * -- cgit v1.3