1 /* $Id: kdebug.c,v 1.6 2000/02/27 02:09:40 ekohl Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/kd/kdebug.c
6 * PURPOSE: Kernel debugger
7 * PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
12 #include <ddk/ntddk.h>
13 #include <internal/ntoskrnl.h>
14 #include <internal/kd.h>
18 * Uncomment one of the following symbols to select a debug output style.
21 * Debug information is printed on the screen.
24 * Debug information is printed to a serial device. Check the port
25 * address, the baud rate and the data format.
26 * Default: COM1 19200 Baud 8N1 (8 data bits, no parity, 1 stop bit)
28 * BOCHS_DEBUGGING: (not tested yet)
29 * Debug information is printed to the bochs logging port. Bochs
30 * writes the output to a log file.
33 #define SCREEN_DEBUGGING /* debug info is printed on the screen */
34 //#define SERIAL_DEBUGGING /* remote debugging */
35 //#define BOCHS_DEBUGGING /* debug output using bochs */
38 #define SERIAL_DEBUG_PORT 1 /* COM 1 */
39 // #define SERIAL_DEBUG_PORT 2 /* COM 2 */
40 #define SERIAL_DEBUG_BAUD_RATE 19200
43 //#define BOCHS_DEBUGGING
44 #ifdef BOCHS_DEBUGGING
45 #define BOCHS_LOGGER_PORT (0xe9)
49 /* VARIABLES ***************************************************************/
51 BOOLEAN KdDebuggerEnabled
= FALSE
; /* EXPORTED */
52 BOOLEAN KdDebuggerNotPresent
= TRUE
; /* EXPORTED */
55 /* PRIVATE FUNCTIONS ********************************************************/
61 /* FIXME: parse kernel command line */
63 /* initialize debug port */
64 #ifdef SERIAL_DEBUGGING
65 KD_PORT_INFORMATION PortInfo
;
67 PortInfo
.ComPort
= SERIAL_DEBUG_PORT
;
68 PortInfo
.BaudRate
= SERIAL_DEBUG_BAUD_RATE
;
70 KdPortInitialize (&PortInfo
,
78 KdpPrintString (PANSI_STRING String
)
80 #if defined(SERIAL_DEBUGGING) || defined(BOCHS_DEBUGGING)
81 PCH pch
= String
->Buffer
;
84 #ifdef SCREEN_DEBUGGING
85 HalDisplayString (String
->Buffer
);
88 #ifdef SERIAL_DEBUGGING
102 #ifdef BOCHS_DEBUGGING
107 WRITE_PORT_UCHAR((PUCHAR
)BOCHS_LOGGER_PORT
, '\r');
110 WRITE_PORT_UCHAR((PUCHAR
)BOCHS_LOGGER_PORT
, *pch
);
116 return (ULONG
)String
->Length
;
119 /* PUBLIC FUNCTIONS *********************************************************/
121 /* NTOSKRNL.KdPollBreakIn */
129 return KdPortPollByte();