From a65db5c6cb6c1da90429d8800e4ac074bec7cb2e Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Wed, 6 Nov 2019 15:38:47 +0900 Subject: [PATCH] Add dummy process_suspend() function --- kernel/core/process.c | 26 ++++++++++++++++++++++++++ kernel/include/process.h | 1 + 2 files changed, 27 insertions(+) diff --git a/kernel/core/process.c b/kernel/core/process.c index 4e7f8c9..58890c3 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -653,7 +653,12 @@ int process_detach(process_t *proc) int process_kill(process_t pid, int signal) { + int ret_val; + + /* FIXME: Implement sending of signals to processes */ + ret_val = -ENOSYS; + return(ret_val); } int process_signal_deliver(process_t *proc, int signal) @@ -669,6 +674,7 @@ int process_signal_deliver(process_t *proc, int signal) task_t *task; /* FIXME: Need to suspend the process in order to deliver the signal safely */ + process_suspend(proc); /* * Elect a task to handle the signal - right now, this is simple since the @@ -698,6 +704,15 @@ int process_signal_deliver(process_t *proc, int signal) * pesp3, pesp3 - 1, and pesp3 - 2 may not be on the same page, which would * be an atrociously hard-to-find bug. */ + + /* + * TODO: Take mixed page sizes into account + * + * It's no harm to do the lookup, but it might be more efficient if we + * take into account that page sizes might be larger than PAGE_SIZE. For + * example, the kernel is almost certainly using 4M pages, so this will + * result in more expensive lookups than is necessary. + */ #define PAGE_BASE(__addr) ((u32_t)__addr & ~(PAGE_SIZE - 1)) #define SAME_PAGE(__x,__y) (PAGE_BASE(__x) == PAGE_BASE(__y)) @@ -808,3 +823,14 @@ static void _sig_cont(int sig) */ return; } + +int process_suspend(process_t *proc) +{ + int ret_val; + + ret_val = -ENOSYS; + + /* FIXME: Send IPIs to all processors executing tasks from proc */ + + return(ret_val); +} diff --git a/kernel/include/process.h b/kernel/include/process.h index 4ac66d2..03067e1 100644 --- a/kernel/include/process.h +++ b/kernel/include/process.h @@ -52,5 +52,6 @@ pid_t process_get_id(process_t*); int process_exit(process_t*, int); int process_fork(int); int process_detach(process_t*); +int process_suspend(process_t*); #endif /* __PROCESS_H */ -- 2.47.3