Fixes to Libc, Doxygen Comments and VTerm layout
[tpg/acess2.git] / Kernel / debug.c
index 99a236e..72621cc 100644 (file)
@@ -5,16 +5,21 @@
 #include <common.h>
 #include <stdarg.h>
 
-// === MACROS ===
-#define E9(ch) __asm__ __volatile__ ("outb %%al, $0xe9"::"a"(((Uint8)ch)))
-
 // === IMPORTS ===
 extern void Threads_Dump();
 
 // === GLOBALS ===
  int   gDebug_Level = 0;
+ int   giDebug_KTerm = -1;
 
 // === CODE ===
+static void E9(char ch)
+{
+       if(giDebug_KTerm != -1)
+               VFS_Write(giDebug_KTerm, 1, &ch);
+       __asm__ __volatile__ ( "outb %%al, $0xe9" :: "a"(((Uint8)ch)) );
+}
+
 static void E9_Str(char *Str)
 {
        while(*Str)     E9(*Str++);
@@ -190,6 +195,13 @@ void Panic(char *Fmt, ...)
        for(;;) __asm__ __volatile__ ("hlt");
 }
 
+void Debug_SetKTerminal(char *File)
+{
+       if(giDebug_KTerm != -1)
+               VFS_Close(giDebug_KTerm);
+       giDebug_KTerm = VFS_Open(File, VFS_OPENFLAG_WRITE);
+}
+
 void Debug_Enter(char *FuncName, char *ArgTypes, ...)
 {
        va_list args;

UCC git Repository :: git.ucc.asn.au