LIST_ENTRY KdProviders = {&KdProviders, &KdProviders};
KD_DISPATCH_TABLE DispatchTable[KdMax];
-PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
- KdpSerialInit,
- KdpDebugLogInit,
- KdpKdbgInit};
+PKDP_INIT_ROUTINE InitRoutines[KdMax] =
+{
+ KdpScreenInit,
+ KdpSerialInit,
+ KdpDebugLogInit,
+#ifdef KDBG
+ KdpKdbgInit
+#endif
+};
static ULONG KdbgNextApiNumber = DbgKdContinueApi;
static CONTEXT KdbgContext;
static VOID
NTAPI
KdpPrintToLogFile(PCHAR String,
- ULONG StringLength)
+ ULONG Length)
{
KIRQL OldIrql;
ULONG beg, end, num;
beg = KdpCurrentPosition;
num = KdpFreeBytes;
- if (StringLength < num)
- num = StringLength;
+ if (Length < num)
+ num = Length;
if (num != 0)
{
if (BootPhase == 0)
{
- KdComPortInUse = NULL;
-
/* Write out the functions that we support for now */
DispatchTable->KdpInitRoutine = KdpDebugLogInit;
DispatchTable->KdpPrintRoutine = KdpPrintToLogFile;
/* SERIAL FUNCTIONS **********************************************************/
-VOID
+static VOID
NTAPI
-KdpSerialDebugPrint(PCHAR Message,
- ULONG Length)
+KdpSerialPrint(PCHAR String,
+ ULONG Length)
{
- PCHAR pch = (PCHAR)Message;
+ PCHAR pch = String;
KIRQL OldIrql;
/* Acquire the printing spinlock without waiting at raised IRQL */
OldIrql = KdpAcquireLock(&KdpSerialSpinLock);
- /* Output the message */
- while (pch < Message + Length && *pch != '\0')
+ /* Output the string */
+ while (pch < String + Length && *pch)
{
if (*pch == '\n')
{
{
/* Write out the functions that we support for now */
DispatchTable->KdpInitRoutine = KdpSerialInit;
- DispatchTable->KdpPrintRoutine = KdpSerialDebugPrint;
+ DispatchTable->KdpPrintRoutine = KdpSerialPrint;
/* Initialize the Port */
if (!KdPortInitializeEx(&SerialPortInfo, SerialPortNumber))
}
/*
- * Screen debug logger function KdpScreenPrint() writes text messages into
+ * Screen debug logger function KdpScreenPrint() writes text strings into
* KdpDmesgBuffer, using it as a circular buffer. KdpDmesgBuffer contents could
* be later (re)viewed using dmesg command of kdbg. KdpScreenPrint() protects
* KdpDmesgBuffer from simultaneous writes by use of KdpDmesgLogSpinLock.
*/
static VOID
NTAPI
-KdpScreenPrint(PCHAR Message,
+KdpScreenPrint(PCHAR String,
ULONG Length)
{
- PCHAR pch = (PCHAR)Message;
+ PCHAR pch = String;
KIRQL OldIrql;
ULONG beg, end, num;
- while (pch < Message + Length && *pch)
+ while (pch < String + Length && *pch)
{
if (*pch == '\b')
{
KdpScreenLineBufferPos = KdpScreenLineLength;
}
- /* Dmesg: store Message in the buffer to show it later */
+ /* Dmesg: store the string in the buffer to show it later */
if (KdbpIsInDmesgMode)
return;
end = (beg + num) % KdpDmesgBufferSize;
if (end > beg)
{
- RtlCopyMemory(KdpDmesgBuffer + beg, Message, Length);
+ RtlCopyMemory(KdpDmesgBuffer + beg, String, Length);
}
else
{
- RtlCopyMemory(KdpDmesgBuffer + beg, Message, KdpDmesgBufferSize - beg);
- RtlCopyMemory(KdpDmesgBuffer, Message + (KdpDmesgBufferSize - beg), end);
+ RtlCopyMemory(KdpDmesgBuffer + beg, String, KdpDmesgBufferSize - beg);
+ RtlCopyMemory(KdpDmesgBuffer, String + (KdpDmesgBufferSize - beg), end);
}
KdpDmesgCurrentPosition = end;
/* Optional step(?): find out a way to notify about buffer exhaustion,
* and possibly fall into kbd to use dmesg command: user will read
- * debug messages before they will be wiped over by next writes.
+ * debug strings before they will be wiped over by next writes.
*/
}
}
}
+#ifdef KDBG
+/* KDBG FUNCTIONS ************************************************************/
+
+/* NOTE: This may be moved completely into kdb_symbols.c */
+VOID NTAPI
+KdbInitialize(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase);
+
+VOID
+NTAPI
+KdpKdbgInit(
+ PKD_DISPATCH_TABLE DispatchTable,
+ ULONG BootPhase)
+{
+ /* Forward the call */
+ KdbInitialize(DispatchTable, BootPhase);
+}
+#endif
+
+
/* GENERAL FUNCTIONS *********************************************************/
BOOLEAN