Fix warnings in inline assembly (I hope this doesnt expose a GCC bug and thus break...
[reactos.git] / reactos / ntoskrnl / kd / wrappers / bochs.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/kd/wrappers/bochs.c
5 * PURPOSE: BOCHS Wrapper for Kd
6 *
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
8 */
9
10 #include <ntoskrnl.h>
11 #define NDEBUG
12 #include <internal/debug.h>
13
14 /* bochs debug output */
15 #define BOCHS_LOGGER_PORT (0xe9)
16
17 /* FUNCTIONS *****************************************************************/
18
19 VOID
20 STDCALL
21 KdpBochsDebugPrint(IN PCH Message)
22 {
23 while (*Message != 0)
24 {
25 if (*Message == '\n')
26 {
27 #if defined(_M_IX86) && defined(__GNUC__)
28 /* Don't use WRITE_PORT_UCHAR because hal isn't initialized yet in the very early boot phase. */
29 __asm__("outb %b0, %w1\n\t" :: "a" ('\r'), "d" (BOCHS_LOGGER_PORT));
30 #else
31 WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r');
32 #endif
33 }
34 #if defined(_M_IX86) && defined(__GNUC__)
35 /* Don't use WRITE_PORT_UCHAR because hal isn't initialized yet in the very early boot phase. */
36 __asm__("outb %b0, %w1\n\t" :: "a" (*Message), "d" (BOCHS_LOGGER_PORT));
37 #else
38 WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *Message);
39 #endif
40 Message++;
41 }
42 }
43
44
45
46 VOID
47 STDCALL
48 KdpBochsInit(PKD_DISPATCH_TABLE WrapperTable,
49 ULONG BootPhase)
50 {
51 if (!KdpDebugMode.Bochs) return;
52
53 if (BootPhase == 0)
54 {
55 /* Write out the functions that we support for now */
56 WrapperTable->KdpInitRoutine = KdpBochsInit;
57 WrapperTable->KdpPrintRoutine = KdpBochsDebugPrint;
58 }
59 else if (BootPhase == 2)
60 {
61 HalDisplayString("\n Bochs debugging enabled\n\n");
62 }
63 }
64
65 /* EOF */