From 4286b14839c0c4ec016d816e426660f6685ae349 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 7 May 2020 18:10:22 +0200 Subject: Fixed many bugs with wait() and fork() This also adds many race conditions which really need to be fixed.. --- src/kernel/tasks/process.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/kernel/tasks/process.c') diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c index d2a75fd..b8dd808 100644 --- a/src/kernel/tasks/process.c +++ b/src/kernel/tasks/process.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,7 @@ extern u32 stack_hold; void scheduler(struct regs *regs) { + cli(); memcpy(¤t_proc->registers, regs, sizeof(struct regs)); timer_handler(regs); @@ -29,7 +31,7 @@ void scheduler(struct regs *regs) current_proc = root; } - //debug("Task switch to %s", current_proc->name); + debug("Task switch to %s with pid %d", current_proc->name, current_proc->pid); while (current_proc->state == PROC_ASLEEP) { current_proc = current_proc->next; @@ -39,6 +41,7 @@ void scheduler(struct regs *regs) memcpy(regs, ¤t_proc->registers, sizeof(struct regs)); paging_switch_directory(current_proc->cr3); + sti(); } void process_init(struct process *proc) @@ -125,7 +128,7 @@ void process_suspend(u32 pid) struct process *proc = process_from_pid(pid); if (proc == PID_NOT_FOUND) { - warn("couldn't find PID for suspension"); + warn("Couldn't find PID for suspension"); return; } -- cgit v1.2.3