diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-08 17:38:59 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-08 17:38:59 +0300 |
| commit | 7e828ec1e1479ff9a8afe845539d08ca0dfada5f (patch) | |
| tree | a227c58b30c99058fc10ff3caffeebca7dbd5913 /src/irq.c | |
| parent | 219c27d420fe0abe5515cefc2513c6fe60aafdf9 (diff) | |
| download | kmi-7e828ec1e1479ff9a8afe845539d08ca0dfada5f.tar.gz kmi-7e828ec1e1479ff9a8afe845539d08ca0dfada5f.zip | |
add orphan checking to timer and irq handling
Diffstat (limited to 'src/irq.c')
| -rw-r--r-- | src/irq.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -7,6 +7,7 @@ */ #include <kmi/irq.h> +#include <kmi/bkl.h> #include <kmi/pmem.h> #include <kmi/debug.h> #include <kmi/assert.h> @@ -54,6 +55,8 @@ stat_t unregister_irq(struct tcb *t, irq_t id) void handle_irq() { + bkl_lock(); + irq_t id = get_irq(); assert(id < max_irq); @@ -65,14 +68,18 @@ void handle_irq() } struct tcb *t = get_tcb(tid); - if (!t) { - error("tcb %llu dead at irq %llu\n", + if (!t || orphan(t)) { + info("tcb %llu dead at irq %llu\n", (unsigned long long)tid, (unsigned long long)id); + + /* unregister irq handler */ + irq_map[id] = 0; + bkl_unlock(); return; } disable_irqs(); notify(t, NOTIFY_IRQ); - error("misc error when trying to notify irq"); + bkl_unlock(); } |
