summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/arch/amd64/time.c1
-rw-r--r--src/kernel/proc.c7
-rw-r--r--src/kernel/proc.h4
3 files changed, 12 insertions, 0 deletions
diff --git a/src/kernel/arch/amd64/time.c b/src/kernel/arch/amd64/time.c
index aa7603c..f4fa744 100644
--- a/src/kernel/arch/amd64/time.c
+++ b/src/kernel/arch/amd64/time.c
@@ -48,6 +48,7 @@ void timer_deschedule(Proc *p) {
assert(*slot);
*slot = p->waits4timer.next;
+ proc_setstate(p, PS_RUNNING);
update_goal();
}
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 1084f48..4164874 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -394,8 +394,15 @@ void proc_tryreap(Proc *dead) {
}
}
+void proc_tryintr(Proc *p) {
+ if (p->state == PS_WAITS4TIMER) {
+ timer_deschedule(p);
+ }
+}
+
void proc_intr(Proc *p) {
if (!p->intr_fn) return;
+ proc_tryintr(p);
/* save old rsp,rip */
struct intr_data d;
diff --git a/src/kernel/proc.h b/src/kernel/proc.h
index 15da852..bfe5cfc 100644
--- a/src/kernel/proc.h
+++ b/src/kernel/proc.h
@@ -119,6 +119,10 @@ void proc_filicide(Proc *proc, int ret);
/** Tries to reap a dead process / free a tombstone. */
void proc_tryreap(Proc *dead);
+/** Try to interrupt whatever the process is doing instead of PS_RUNNING. */
+void proc_tryintr(Proc *p);
+
+/** Send an interupt to a process. */
void proc_intr(Proc *proc);
/** Switches execution to any running process. */