Make the bochs debug output in the very early boot phase available, if AUTO_ENABLE_BOCHS is defined.
Modified: trunk/reactos/ntoskrnl/ex/init.c
Modified: trunk/reactos/ntoskrnl/kd/kdinit.c
Modified: trunk/reactos/ntoskrnl/kd/wrappers/bochs.c
Modified: trunk/reactos/ntoskrnl/ldr/loader.c

Modified: trunk/reactos/ntoskrnl/ex/init.c
--- trunk/reactos/ntoskrnl/ex/init.c	2005-06-04 09:58:35 UTC (rev 15767)
+++ trunk/reactos/ntoskrnl/ex/init.c	2005-06-04 10:05:20 UTC (rev 15768)
@@ -450,8 +450,6 @@
     /* Parse the Loaded Modules (by FreeLoader) and cache the ones we'll need */
     ParseAndCacheLoadedModules();
 
-    /* Initialize the kernel debugger parameters */
-    KdInitSystem(0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
 
     /* Initialize the Dispatcher, Clock and Bug Check Mechanisms. */
     KeInit2();

Modified: trunk/reactos/ntoskrnl/kd/kdinit.c
--- trunk/reactos/ntoskrnl/kd/kdinit.c	2005-06-04 09:58:35 UTC (rev 15767)
+++ trunk/reactos/ntoskrnl/kd/kdinit.c	2005-06-04 10:05:20 UTC (rev 15768)
@@ -11,15 +11,24 @@
 #define NDEBUG
 #include <internal/debug.h>
 
+/* Make bochs debug output in the very early boot phase available */
+//#define AUTO_ENABLE_BOCHS
+
 /* VARIABLES ***************************************************************/
 
 KD_PORT_INFORMATION PortInfo = {DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0};
 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;
-LIST_ENTRY KdProviders;
 PKDP_INIT_ROUTINE WrapperInitRoutine;
+KD_DISPATCH_TABLE WrapperTable;
+#endif
+LIST_ENTRY KdProviders = {&KdProviders, &KdProviders};
 KD_DISPATCH_TABLE DispatchTable[KdMax];
-KD_DISPATCH_TABLE WrapperTable;
 
 PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
                                          KdpSerialInit,
@@ -158,8 +167,6 @@
     /* Set Default Port Options */
     if (BootPhase == 0)
     {
-        /* Initialize the Provider List */
-        InitializeListHead(&KdProviders);
 
         /* Parse the Command Line */
         p1 = (PCHAR)LoaderBlock->CommandLine;

Modified: trunk/reactos/ntoskrnl/kd/wrappers/bochs.c
--- trunk/reactos/ntoskrnl/kd/wrappers/bochs.c	2005-06-04 09:58:35 UTC (rev 15767)
+++ trunk/reactos/ntoskrnl/kd/wrappers/bochs.c	2005-06-04 10:05:20 UTC (rev 15768)
@@ -24,9 +24,19 @@
     {
         if (*Message == '\n')
         {
-            WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r');
+#if defined(_M_IX86) && defined(__GNUC__) 
+           /* Don't use WRITE_PORT_UCHAR because hal isn't initialized yet in the very early boot phase. */
+           __asm__("outb %0, %w1\n\t" :: "a" ('\r'), "d" (BOCHS_LOGGER_PORT));
+#else
+           WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r');
+#endif
         }
+#if defined(_M_IX86) && defined(__GNUC__) 
+        /* Don't use WRITE_PORT_UCHAR because hal isn't initialized yet in the very early boot phase. */
+        __asm__("outb %0, %w1\n\t" :: "a" (*Message), "d" (BOCHS_LOGGER_PORT));
+#else
         WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *Message);
+#endif
         Message++;
     }
 }

Modified: trunk/reactos/ntoskrnl/ldr/loader.c
--- trunk/reactos/ntoskrnl/ldr/loader.c	2005-06-04 09:58:35 UTC (rev 15767)
+++ trunk/reactos/ntoskrnl/ldr/loader.c	2005-06-04 10:05:20 UTC (rev 15768)
@@ -26,6 +26,11 @@
 #endif /* __GNUC__ */
 #endif
 
+#if 0
+#undef ps
+#define ps(args...) DPRINT1(args)
+#endif
+
 #define NDEBUG
 #include <internal/debug.h>