From f9bc4ac436dec5f2f1f1db31c4933c80ed40568b Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 5 May 2022 21:41:04 +0200 Subject: kernel: move the COM1 driver to a separate handler --- src/kernel/proc.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'src/kernel/proc.c') diff --git a/src/kernel/proc.c b/src/kernel/proc.c index ed317ec..c9e3aef 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -123,34 +123,18 @@ static _Noreturn void process_switch(struct process *proc) { sysexit(proc->regs); } -/** If there are any processes waiting for IRQs, wait with them. Otherwise, shut down */ -static _Noreturn void process_idle(void) { - // this mess is temporary - - struct process *procs[16]; - size_t len = process_find_multiple(PS_WAITS4IRQ, procs, 16); - - if (len == 0) shutdown(); - - cpu_pause(); - for (size_t i = 0; i < len; i++) { - if (procs[i]->waits4irq.ready()) { - /* if this is entered during the first iteration, it indicates a - * kernel bug. this should be logged. TODO? */ - procs[i]->waits4irq.callback(procs[i]); - } - } - - process_switch_any(); -} - _Noreturn void process_switch_any(void) { if (process_current && process_current->state == PS_RUNNING) process_switch(process_current); struct process *found = process_find(PS_RUNNING); if (found) process_switch(found); - process_idle(); + + if (process_first->state == PS_DEAD || process_first->state == PS_DEADER) + shutdown(); + + cpu_pause(); + process_switch_any(); } struct process *process_next(struct process *p) { -- cgit v1.2.3