mirror of
https://github.com/reactos/reactos.git
synced 2024-09-20 17:51:53 +00:00
[NTOS:KD] Use local print-like functions for output, instead of the kernel-internal KdpDprintf.
Indeed, the latter won't be accessible once those KD IO functions get moved out into a separate KDTERM.DLL.
This commit is contained in:
parent
5d1ae45b83
commit
412037a2e2
|
@ -13,9 +13,19 @@ NTSTATUS
|
|||
typedef
|
||||
VOID
|
||||
(NTAPI *PKDP_PRINT_ROUTINE)(
|
||||
PCHAR String,
|
||||
ULONG Length
|
||||
);
|
||||
_In_ PCCH String,
|
||||
_In_ ULONG Length);
|
||||
|
||||
VOID
|
||||
KdIoPuts(
|
||||
_In_ PCSTR String);
|
||||
|
||||
VOID
|
||||
__cdecl
|
||||
KdIoPrintf(
|
||||
_In_ PCSTR Format,
|
||||
...);
|
||||
|
||||
|
||||
/* INIT ROUTINES *************************************************************/
|
||||
|
||||
|
|
|
@ -151,8 +151,9 @@ KdpLoggerThread(PVOID Context)
|
|||
|
||||
static VOID
|
||||
NTAPI
|
||||
KdpPrintToLogFile(PCHAR String,
|
||||
ULONG Length)
|
||||
KdpPrintToLogFile(
|
||||
_In_ PCCH String,
|
||||
_In_ ULONG Length)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
ULONG beg, end, num;
|
||||
|
@ -359,10 +360,11 @@ Failure:
|
|||
|
||||
static VOID
|
||||
NTAPI
|
||||
KdpSerialPrint(PCHAR String,
|
||||
ULONG Length)
|
||||
KdpSerialPrint(
|
||||
_In_ PCCH String,
|
||||
_In_ ULONG Length)
|
||||
{
|
||||
PCHAR pch = String;
|
||||
PCCH pch = String;
|
||||
KIRQL OldIrql;
|
||||
|
||||
/* Acquire the printing spinlock without waiting at raised IRQL */
|
||||
|
@ -376,7 +378,7 @@ KdpSerialPrint(PCHAR String,
|
|||
KdPortPutByteEx(&SerialPortInfo, '\r');
|
||||
}
|
||||
KdPortPutByteEx(&SerialPortInfo, *pch);
|
||||
pch++;
|
||||
++pch;
|
||||
}
|
||||
|
||||
/* Release the spinlock */
|
||||
|
@ -456,10 +458,11 @@ KdpScreenRelease(VOID)
|
|||
|
||||
static VOID
|
||||
NTAPI
|
||||
KdpScreenPrint(PCHAR String,
|
||||
ULONG Length)
|
||||
KdpScreenPrint(
|
||||
_In_ PCCH String,
|
||||
_In_ ULONG Length)
|
||||
{
|
||||
PCHAR pch = String;
|
||||
PCCH pch = String;
|
||||
|
||||
while (pch < String + Length && *pch)
|
||||
{
|
||||
|
@ -538,6 +541,57 @@ KdpScreenInit(
|
|||
|
||||
/* GENERAL FUNCTIONS *********************************************************/
|
||||
|
||||
static VOID
|
||||
KdIoPrintString(
|
||||
_In_ PCCH String,
|
||||
_In_ ULONG Length)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PKD_DISPATCH_TABLE CurrentTable;
|
||||
|
||||
/* Call the registered providers */
|
||||
for (CurrentEntry = KdProviders.Flink;
|
||||
CurrentEntry != &KdProviders;
|
||||
CurrentEntry = CurrentEntry->Flink)
|
||||
{
|
||||
CurrentTable = CONTAINING_RECORD(CurrentEntry,
|
||||
KD_DISPATCH_TABLE,
|
||||
KdProvidersList);
|
||||
|
||||
CurrentTable->KdpPrintRoutine(String, Length);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
KdIoPuts(
|
||||
_In_ PCSTR String)
|
||||
{
|
||||
KdIoPrintString(String, (ULONG)strlen(String));
|
||||
}
|
||||
|
||||
VOID
|
||||
__cdecl
|
||||
KdIoPrintf(
|
||||
_In_ PCSTR Format,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
ULONG Length;
|
||||
CHAR Buffer[512];
|
||||
|
||||
/* Format the string */
|
||||
va_start(ap, Format);
|
||||
Length = (ULONG)_vsnprintf(Buffer,
|
||||
sizeof(Buffer),
|
||||
Format,
|
||||
ap);
|
||||
va_end(ap);
|
||||
|
||||
/* Send it to the display providers */
|
||||
KdIoPrintString(Buffer, Length);
|
||||
}
|
||||
|
||||
|
||||
extern STRING KdbPromptString;
|
||||
|
||||
VOID
|
||||
|
@ -551,8 +605,6 @@ KdSendPacket(
|
|||
if (PacketType == PACKET_TYPE_KD_DEBUG_IO)
|
||||
{
|
||||
ULONG ApiNumber = ((PDBGKD_DEBUG_IO)MessageHeader->Buffer)->ApiNumber;
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PKD_DISPATCH_TABLE CurrentTable;
|
||||
|
||||
/* Validate API call */
|
||||
if (MessageHeader->Length != sizeof(DBGKD_DEBUG_IO))
|
||||
|
@ -572,17 +624,8 @@ KdSendPacket(
|
|||
if (!KdpDebugMode.Value)
|
||||
return;
|
||||
|
||||
/* Call the registered providers */
|
||||
for (CurrentEntry = KdProviders.Flink;
|
||||
CurrentEntry != &KdProviders;
|
||||
CurrentEntry = CurrentEntry->Flink)
|
||||
{
|
||||
CurrentTable = CONTAINING_RECORD(CurrentEntry,
|
||||
KD_DISPATCH_TABLE,
|
||||
KdProvidersList);
|
||||
|
||||
CurrentTable->KdpPrintRoutine(MessageData->Buffer, MessageData->Length);
|
||||
}
|
||||
/* Print the string proper */
|
||||
KdIoPrintString(MessageData->Buffer, MessageData->Length);
|
||||
return;
|
||||
}
|
||||
else if (PacketType == PACKET_TYPE_KD_STATE_CHANGE64)
|
||||
|
|
|
@ -3781,7 +3781,7 @@ KdbpCliInit(VOID)
|
|||
static VOID
|
||||
NTAPI
|
||||
KdbDebugPrint(
|
||||
_In_ PCHAR String,
|
||||
_In_ PCCH String,
|
||||
_In_ ULONG Length)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
|
|
Loading…
Reference in a new issue