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 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 @@ typedef struct _KDP_DEBUG_MODE
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 */

View file

@ -25,20 +25,19 @@ 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;
#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 @@ KdpGetWrapperDebugMode(PCHAR 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 */
if (!_strnicmp(p2, "GDB", 3))
{
@ -128,6 +118,14 @@ KdpGetDebugMode(PCHAR Currentp2)
KdpDebugMode.File = TRUE;
}
/* Check for BOCHS Debugging */
else if (!_strnicmp(p2, "BOCHS", 5))
{
/* Enable It */
p2 += 5;
KdpDebugMode.Bochs = TRUE;
}
return p2;
}

View file

@ -21,6 +21,8 @@ STDCALL
KdpBochsDebugPrint(IN PCH Message,
IN ULONG Length)
{
if (!KdpDebugMode.Bochs) return;
while (*Message != 0)
{
if (*Message == '\n')
@ -44,16 +46,31 @@ KdpBochsDebugPrint(IN PCH Message,
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)
{