Bochs debug output is only a simple print routine and not a wrapper which can handle faults.

svn path=/trunk/; revision=20883
This commit is contained in:
Hartmut Birr 2006-01-15 08:49:26 +00:00
parent ba9679e15b
commit 68151ba039
3 changed files with 34 additions and 18 deletions

View file

@ -202,7 +202,8 @@ KdpBochsDebugPrint(
#define KdScreen 0 #define KdScreen 0
#define KdSerial 1 #define KdSerial 1
#define KdFile 2 #define KdFile 2
#define KdMax 3 #define KdBochs 3
#define KdMax 4
/* KD Private Debug Modes */ /* KD Private Debug Modes */
typedef struct _KDP_DEBUG_MODE typedef struct _KDP_DEBUG_MODE
@ -215,11 +216,11 @@ typedef struct _KDP_DEBUG_MODE
UCHAR Screen :1; UCHAR Screen :1;
UCHAR Serial :1; UCHAR Serial :1;
UCHAR File :1; UCHAR File :1;
UCHAR Bochs :1;
/* Currently Supported Wrappers */ /* Currently Supported Wrappers */
UCHAR Pice :1; UCHAR Pice :1;
UCHAR Gdb :1; UCHAR Gdb :1;
UCHAR Bochs :1;
}; };
/* Generic Value */ /* Generic Value */

View file

@ -25,20 +25,19 @@ KD_PORT_INFORMATION PortInfo = {DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0};
ULONG KdpPortIrq; ULONG KdpPortIrq;
#ifdef AUTO_ENABLE_BOCHS #ifdef AUTO_ENABLE_BOCHS
KDP_DEBUG_MODE KdpDebugMode = {{{.Bochs=TRUE}}};; KDP_DEBUG_MODE KdpDebugMode = {{{.Bochs=TRUE}}};;
PKDP_INIT_ROUTINE WrapperInitRoutine = KdpBochsInit;
KD_DISPATCH_TABLE WrapperTable = {.KdpInitRoutine = KdpBochsInit, .KdpPrintRoutine = KdpBochsDebugPrint};
#else #else
KDP_DEBUG_MODE KdpDebugMode; KDP_DEBUG_MODE KdpDebugMode;
#endif
PKDP_INIT_ROUTINE WrapperInitRoutine; PKDP_INIT_ROUTINE WrapperInitRoutine;
KD_DISPATCH_TABLE WrapperTable; KD_DISPATCH_TABLE WrapperTable;
#endif
BOOLEAN KdpEarlyBreak = FALSE; BOOLEAN KdpEarlyBreak = FALSE;
LIST_ENTRY KdProviders = {&KdProviders, &KdProviders}; LIST_ENTRY KdProviders = {&KdProviders, &KdProviders};
KD_DISPATCH_TABLE DispatchTable[KdMax]; KD_DISPATCH_TABLE DispatchTable[KdMax];
PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit, PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
KdpSerialInit, KdpSerialInit,
KdpInitDebugLog}; KdpInitDebugLog,
KdpBochsInit};
/* PRIVATE FUNCTIONS *********************************************************/ /* PRIVATE FUNCTIONS *********************************************************/
@ -49,15 +48,6 @@ KdpGetWrapperDebugMode(PCHAR Currentp2,
{ {
PCHAR p2 = Currentp2; 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 */ /* Check for GDB Debugging */
if (!_strnicmp(p2, "GDB", 3)) if (!_strnicmp(p2, "GDB", 3))
{ {
@ -128,6 +118,14 @@ KdpGetDebugMode(PCHAR Currentp2)
KdpDebugMode.File = TRUE; KdpDebugMode.File = TRUE;
} }
/* Check for BOCHS Debugging */
else if (!_strnicmp(p2, "BOCHS", 5))
{
/* Enable It */
p2 += 5;
KdpDebugMode.Bochs = TRUE;
}
return p2; return p2;
} }

View file

@ -21,6 +21,8 @@ STDCALL
KdpBochsDebugPrint(IN PCH Message, KdpBochsDebugPrint(IN PCH Message,
IN ULONG Length) IN ULONG Length)
{ {
if (!KdpDebugMode.Bochs) return;
while (*Message != 0) while (*Message != 0)
{ {
if (*Message == '\n') if (*Message == '\n')
@ -44,16 +46,31 @@ KdpBochsDebugPrint(IN PCH Message,
VOID VOID
STDCALL STDCALL
KdpBochsInit(PKD_DISPATCH_TABLE WrapperTable, KdpBochsInit(PKD_DISPATCH_TABLE DispatchTable,
ULONG BootPhase) ULONG BootPhase)
{ {
BYTE Value;
if (!KdpDebugMode.Bochs) return; if (!KdpDebugMode.Bochs) return;
if (BootPhase == 0) 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 */ /* Write out the functions that we support for now */
WrapperTable->KdpInitRoutine = KdpBochsInit; DispatchTable->KdpInitRoutine = KdpBochsInit;
WrapperTable->KdpPrintRoutine = KdpBochsDebugPrint; DispatchTable->KdpPrintRoutine = KdpBochsDebugPrint;
/* Register as a Provider */
InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
} }
else if (BootPhase == 2) else if (BootPhase == 2)
{ {