Bochs debug output is only a simple print routine and not a wrapper which can handle faults.
Modified: trunk/reactos/ntoskrnl/include/internal/kd.h
Modified: trunk/reactos/ntoskrnl/kd/kdinit.c
Modified: trunk/reactos/ntoskrnl/kd/wrappers/bochs.c

Modified: trunk/reactos/ntoskrnl/include/internal/kd.h
--- trunk/reactos/ntoskrnl/include/internal/kd.h	2006-01-15 03:11:31 UTC (rev 20882)
+++ trunk/reactos/ntoskrnl/include/internal/kd.h	2006-01-15 08:49:26 UTC (rev 20883)
@@ -202,7 +202,8 @@
 #define KdScreen 0
 #define KdSerial 1
 #define KdFile 2
-#define KdMax 3
+#define KdBochs 3
+#define KdMax 4
 
 /* KD Private Debug Modes */
 typedef struct _KDP_DEBUG_MODE
@@ -215,11 +216,11 @@
             UCHAR Screen :1;
             UCHAR Serial :1;
             UCHAR File   :1;
+            UCHAR Bochs  :1;
 
             /* Currently Supported Wrappers */
             UCHAR Pice   :1;
             UCHAR Gdb    :1;
-            UCHAR Bochs  :1;
         };
 
         /* Generic Value */

Modified: trunk/reactos/ntoskrnl/kd/kdinit.c
--- trunk/reactos/ntoskrnl/kd/kdinit.c	2006-01-15 03:11:31 UTC (rev 20882)
+++ trunk/reactos/ntoskrnl/kd/kdinit.c	2006-01-15 08:49:26 UTC (rev 20883)
@@ -25,20 +25,19 @@
 ULONG KdpPortIrq;
 #ifdef AUTO_ENABLE_BOCHS
 KDP_DEBUG_MODE KdpDebugMode = {{{.Bochs=TRUE}}};;
-PKDP_INIT_ROUTINE WrapperInitRoutine = KdpBochsInit;
-KD_DISPATCH_TABLE WrapperTable = {.KdpInitRoutine = KdpBochsInit, .KdpPrintRoutine = KdpBochsDebugPrint};
 #else
 KDP_DEBUG_MODE KdpDebugMode;
+#endif
 PKDP_INIT_ROUTINE WrapperInitRoutine;
 KD_DISPATCH_TABLE WrapperTable;
-#endif
 BOOLEAN KdpEarlyBreak = FALSE;
 LIST_ENTRY KdProviders = {&KdProviders, &KdProviders};
 KD_DISPATCH_TABLE DispatchTable[KdMax];
 
 PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
                                          KdpSerialInit,
-                                         KdpInitDebugLog};
+                                         KdpInitDebugLog,
+                                         KdpBochsInit};
 
 /* PRIVATE FUNCTIONS *********************************************************/
 
@@ -49,15 +48,6 @@
 {
     PCHAR p2 = Currentp2;
 
-    /* Check for BOCHS Debugging */
-    if (!_strnicmp(p2, "BOCHS", 5))
-    {
-        /* Enable It */
-        p2 += 5;
-        KdpDebugMode.Bochs = TRUE;
-        WrapperInitRoutine = KdpBochsInit;
-    }
-
     /* Check for GDB Debugging */
     if (!_strnicmp(p2, "GDB", 3))
     {
@@ -128,6 +118,14 @@
         KdpDebugMode.File = TRUE;
     }
 
+    /* Check for BOCHS Debugging */
+    else if (!_strnicmp(p2, "BOCHS", 5))
+    {
+        /* Enable It */
+        p2 += 5;
+        KdpDebugMode.Bochs = TRUE;
+    }
+
     return p2;
 }
 

Modified: trunk/reactos/ntoskrnl/kd/wrappers/bochs.c
--- trunk/reactos/ntoskrnl/kd/wrappers/bochs.c	2006-01-15 03:11:31 UTC (rev 20882)
+++ trunk/reactos/ntoskrnl/kd/wrappers/bochs.c	2006-01-15 08:49:26 UTC (rev 20883)
@@ -21,6 +21,8 @@
 KdpBochsDebugPrint(IN PCH Message,
                    IN ULONG Length)
 {
+    if (!KdpDebugMode.Bochs) return;
+
     while (*Message != 0)
     {
         if (*Message == '\n')
@@ -44,16 +46,31 @@
 
 VOID
 STDCALL
-KdpBochsInit(PKD_DISPATCH_TABLE WrapperTable,
+KdpBochsInit(PKD_DISPATCH_TABLE DispatchTable,
              ULONG BootPhase)
 {
+    BYTE Value;
     if (!KdpDebugMode.Bochs) return;
 
     if (BootPhase == 0)
     {
+#if defined(_M_IX86) && defined(__GNUC__) 
+        __asm__("inb %w1, %b0\n\t" : "=a" (Value) : "d" (BOCHS_LOGGER_PORT));
+#else
+        Value = READ_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT);
+#endif
+        if (Value != BOCHS_LOGGER_PORT)
+        {
+           KdpDebugMode.Bochs = FALSE;
+           return;
+        }
+
         /* Write out the functions that we support for now */
-        WrapperTable->KdpInitRoutine = KdpBochsInit;
-        WrapperTable->KdpPrintRoutine = KdpBochsDebugPrint;
+        DispatchTable->KdpInitRoutine = KdpBochsInit;
+        DispatchTable->KdpPrintRoutine = KdpBochsDebugPrint;
+
+        /* Register as a Provider */
+        InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
     }
     else if (BootPhase == 2)
     {