[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH 4/4] kernel: Beim Prozessende Interrupthandler austragen



! kernel: Interrupts an geloeschte Prozessen zu schicken ist keine
  besonders gute Idee

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 src/kernel/include/intr.h |    1 +
 src/kernel/src/intr.c     |   14 ++++++++++++++
 src/kernel/src/task.c     |    3 +++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/kernel/include/intr.h b/src/kernel/include/intr.h
index f07bf61..a9e558b 100644
--- a/src/kernel/include/intr.h
+++ b/src/kernel/include/intr.h
@@ -17,6 +17,7 @@
 void init_idt(void);
 void set_intr(int intr, word selector, void* handler, int dpl, int type);
 void set_intr_handling_task(byte intr, struct task * task);
+void remove_intr_handling_task(struct task* task);
 
 typedef void(*pfIrqHandler)(int, dword*);
 
diff --git a/src/kernel/src/intr.c b/src/kernel/src/intr.c
index 42f64fb..f7c6854 100644
--- a/src/kernel/src/intr.c
+++ b/src/kernel/src/intr.c
@@ -434,6 +434,20 @@ void set_intr_handling_task(byte intr, struct task * task)
     }
 }
 
+void remove_intr_handling_task(struct task* task)
+{
+    int i, intr;
+
+    for (intr = IRQ_BASE; intr < IRQ_BASE + 0x10; intr++) {
+        for (i = 0; i < MAX_INTERRUPTS; i++) {
+            if (intr_handling_task[intr][i] == task) {
+                intr_handling_task[intr][i] = NULL;
+                break;
+            }
+        }
+    }
+}
+
 void handle_exception(dword* esp)
 {
     struct int_stack_frame * isf = *((struct int_stack_frame **)esp);
diff --git a/src/kernel/src/task.c b/src/kernel/src/task.c
index 1a5b47a..59c05df 100644
--- a/src/kernel/src/task.c
+++ b/src/kernel/src/task.c
@@ -285,6 +285,9 @@ void destroy_task(struct task* task_ptr)
             next_task->parent_task = get_task(1);
         }
     }
+
+    // Interrupthandler ausschalten
+    remove_intr_handling_task(task_ptr);
     
     
     // Melde das Beenden des Tasks per RPC an init
-- 
1.6.0.2