From 2dad1fa784f88db4512c9a60e7208973c861d4fd Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 21 Mar 2020 18:15:42 +0900 Subject: [PATCH] core/process: Use new scheduler calls, fix compiler warnings --- kernel/core/process.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/kernel/core/process.c b/kernel/core/process.c index 828819a..c21f14e 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "fd.h" #include "sched.h" #include "mailbox.h" @@ -60,7 +62,7 @@ struct process { siginfo_t p_siginfo; int p_sigflags[32]; - sighandler_t p_sighandler[32]; + void* p_sighandler[32]; }; struct proc_list { @@ -427,7 +429,7 @@ int process_create(process_t **dst, pid_t pid, u32_t ppl, void *entry) proc->p_state = PROC_STATE_READY; - if(sched_enqueue(proc->p_tasks[0]) != 0) { + if(sched_schedule(proc->p_tasks[0]) != 0) { PANIC("sched_enqueue() failed for a new task\n"); } } @@ -560,6 +562,7 @@ int process_inbox_get(process_t *proc, struct cxmsg **msg) return(ret_val); } +#if 0 int process_wait(pid_t pid) { process_t *cproc; @@ -571,7 +574,7 @@ int process_wait(pid_t pid) cproc = process_get_current(); if(cproc) { - sched_wait(pid); + sched_sleep(pid); } return(ret_val); @@ -591,12 +594,14 @@ int process_signal(pid_t pid) dbg_printf("[%u] signalling pid %u\n", process_get_id(cproc), pid); + /* FIXME: How do we fix this? */ sched_signal(pid); ret_val = 0; } return(ret_val); } +#endif /* ! 0 */ void* process_get_tasks(process_t *proc) { @@ -639,7 +644,7 @@ int process_exit(process_t *proc, int status) * tasks are neither on the ready queue nor on the wait queue), * so we have to stop the task. */ - if(sched_dequeue(t) < 0) { + if(sched_drop(t) < 0) { /* * However, don't terminate the current task, since we still * need it - we're not done here, after all. @@ -729,9 +734,9 @@ int process_signal_deliver(process_t *proc, int signal) if(proc && signal >= 0 && signal <= SIGUNUSED) { process_t *cproc; +#if 0 stack_frame_t *kstk; - u32_t *vesp3; - u32_t *pesp3; +#endif task_t *task; int i; @@ -770,9 +775,9 @@ int process_signal_deliver(process_t *proc, int signal) } dbg_printf("Should be delivering the irq here\n"); - +#if 0 kstk = (stack_frame_t*)task->t_sp; - +#endif /* * Get usable pointers to the task's stacks. The t_sp member holds the * address of the kernel-mode stack that is valid inside of the kernel, so @@ -933,7 +938,7 @@ int process_suspend(process_t *proc) process_lock(proc); for(i = 0; i < CONFIG_PROC_MAXTASKS; i++) { - ret_val = sched_task_suspend(proc->p_tasks[i]); + ret_val = sched_sleep(proc->p_tasks[i]); } process_unlock(proc); @@ -1052,7 +1057,7 @@ int process_set_sighandler(process_t *proc, int signal, struct sigaction *sa) if(proc && signal >= 0 && signal <= SIGMAX) { proc->p_sigflags[signal] = sa->sa_flags; proc->p_sighandler[signal] = sa->sa_flags & SA_SIGINFO ? - sa->sa_sigaction : sa->sa_handler; + (void*)sa->sa_sigaction : (void*)sa->sa_handler; dbg_printf("process_set_sighandler: %p[%u] -> %p\n", proc, signal, sa->sa_handler); @@ -1117,8 +1122,6 @@ int process_put_signal(process_t *proc, int signal, siginfo_t *si) ret_val = -EINVAL; if(proc && signal >= 0 && signal <= SIGMAX) { - pid_t pid; - ret_val = -EALREADY; process_lock(proc); @@ -1132,7 +1135,6 @@ int process_put_signal(process_t *proc, int signal, siginfo_t *si) memcpy(&(proc->p_siginfo), si, sizeof(proc->p_siginfo)); } - pid = proc->p_id; ret_val = 0; } @@ -1140,7 +1142,9 @@ int process_put_signal(process_t *proc, int signal, siginfo_t *si) if(!ret_val) { /* process needs to be woken up if it was sleeping */ - sched_raise(pid); + + /* FIXME: Which task do we wake up? */ + /* sched_wakeup(task, 1); */ } } -- 2.47.3