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

[tyndur-devel] [PATCH 2/2] kernel2: Debugging für kernel2 aktiviert



+ arch/i386/cpu.h: Prototyp für io_ports_check hinzugefügt
+ arch/i386/io.h: io_ports_check hinzugefügt
+ arch/i386/syscall.c: DEBUG_FLAG_SYSCALL wird nun benutzt ;-)

Signed-off-by: Alexander Kluth <hartmut@xxxxxxxxxx>
---
 src/kernel2/include/arch/i386/cpu.h |    2 ++
 src/kernel2/src/arch/i386/io.c      |   21 +++++++++++++++++++++
 src/kernel2/src/arch/i386/syscall.c |    7 +++++++
 3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/kernel2/include/arch/i386/cpu.h b/src/kernel2/include/arch/i386/cpu.h
index 285e677..7e440f1 100644
--- a/src/kernel2/include/arch/i386/cpu.h
+++ b/src/kernel2/include/arch/i386/cpu.h
@@ -195,6 +195,8 @@ void cpu_prepare_current_task(void);
  */
 void io_activate_bitmap(pm_process_t* task);
 
+void io_ports_check(pm_process_t* task);
+
 /**
  * Hält die CPU an.
  */
diff --git a/src/kernel2/src/arch/i386/io.c b/src/kernel2/src/arch/i386/io.c
index 0dc6ca7..01d9492 100644
--- a/src/kernel2/src/arch/i386/io.c
+++ b/src/kernel2/src/arch/i386/io.c
@@ -212,3 +212,24 @@ void io_activate_bitmap(pm_process_t* task)
         memset(tss->io_bit_map, 0xff, CPU_IO_BITMAP_LENGTH / 8);
     }
 }
+
+void io_ports_check(pm_process_t* task)
+{
+    uint32_t i, j;
+    uint8_t* io_bitmap = task->io_bitmap;
+    uint8_t bit;
+
+    if (io_bitmap == NULL) {
+        return;
+    }
+
+    for (i = 0; i < CPU_IO_BITMAP_LENGTH / 8; i++) {
+        for (j = 0; j < 8; j++) {
+            bit = 1 << j;
+            if (((io_bitmap[i] & bit) == 0) && ((global_port_bitmap[i] & bit) == 0)) {
+                panic("IO-Port-Bitmaps sind beschaedigt (Port %d, PID %d)", i * 8 + j, task->pid);
+            }
+        }
+    }
+}
+
diff --git a/src/kernel2/src/arch/i386/syscall.c b/src/kernel2/src/arch/i386/syscall.c
index 7f4a45e..4c1bba4 100644
--- a/src/kernel2/src/arch/i386/syscall.c
+++ b/src/kernel2/src/arch/i386/syscall.c
@@ -6,6 +6,8 @@
 #include "syscallno.h"
 #include "kprintf.h"
 #include "kernel.h"
+#include "debug.h"
+#include "tasks.h"
 
 #define DEBUG_SYSCALLS 1
 
@@ -73,6 +75,11 @@ void syscall_arch(machine_state_t* isf)
 
     void* handler = syscalls[number].handler;
 
+    if (debug_test_flag(DEBUG_FLAG_SYSCALL)) {
+        kprintf("[PID %d] Syscall:%d\n", current_process->pid, isf->eax);
+        io_ports_check(current_process);
+    }
+
     // FIXME Das ist alles nur bedingt ueberzeugend...
     if (handler == syscall_fastrpc) {
 
-- 
1.7.2.5