summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r--src/kernel/proc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index bdd92ba..e1b650c 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -1,5 +1,6 @@
#include <kernel/arch/generic.h>
#include <kernel/mem.h>
+#include <kernel/panic.h>
#include <kernel/proc.h>
#include <kernel/util.h>
#include <stdint.h>
@@ -54,6 +55,15 @@ void process_switch(struct process *proc) {
sysexit(proc->regs);
}
+_Noreturn void process_switch_any() {
+ struct process *found = process_find(PS_RUNNING);
+ if (found)
+ process_switch(found);
+
+ tty_const(" no running processes left...");
+ panic();
+}
+
// TODO there's no check for going past the stack - VULN
struct process *_process_find_recursive(
enum process_state target, struct process *iter) {