From 8a3452098267e1af127d6c4f1836a9d82cd23f38 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 2 Jul 2024 21:40:10 +0300 Subject: more complete interrupt handling outline + Still largely untested, should really try to come up with a proper testsuite, at the moment it's mostly me trying things out in the (as of yet unreleased) kmx repo --- src/uapi/proc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/uapi/proc.c') diff --git a/src/uapi/proc.c b/src/uapi/proc.c index 153b183..e87a2ec 100644 --- a/src/uapi/proc.c +++ b/src/uapi/proc.c @@ -10,6 +10,7 @@ #include #include #include +#include #include /** @@ -186,6 +187,14 @@ SYSCALL_DEFINE1(swap)(struct tcb *t, sys_arg_t tid){ /* set return value for current thread */ set_args1(t, OK); + /* not running anymore lol */ + if (t->notify_state == NOTIFY_RUNNING) + t->notify_state = NOTIFY_WAITING; + + /* handle possible queued notification */ + if (s->notify_state == NOTIFY_QUEUED) + notify(s, 0); + /* get register state for new thread */ return_args(s, get_args(s)); } -- cgit v1.3