Protect debug print output with spinlock
All checks were successful
All checks were successful
This commit is contained in:
@@ -21,6 +21,7 @@ namespace KD
|
||||
STATIC PKD_PRINT_ROUTINE KdPrint;
|
||||
|
||||
private:
|
||||
STATIC KSPIN_LOCK DebugIoLock;
|
||||
STATIC KD_DEBUG_MODE DebugMode;
|
||||
STATIC PKD_INIT_ROUTINE IoProvidersInitRoutines[KDBG_PROVIDERS_COUNT];
|
||||
STATIC LIST_ENTRY Providers;
|
||||
@@ -30,8 +31,8 @@ namespace KD
|
||||
public:
|
||||
STATIC XTCDECL VOID DbgPrint(PCWSTR Format,
|
||||
...);
|
||||
STATIC XTCDECL VOID DbgPrintEx(PCWSTR Format,
|
||||
VA_LIST Arguments);
|
||||
STATIC XTCDECL VOID DbgPrint(PCWSTR Format,
|
||||
VA_LIST Arguments);
|
||||
STATIC XTAPI XTSTATUS InitializeDebugIoProviders(VOID);
|
||||
STATIC XTAPI VOID SetPrintRoutine(PKD_PRINT_ROUTINE DebugPrintRoutine);
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Debug I/O spinlock */
|
||||
KSPIN_LOCK KD::DebugIo::DebugIoLock;
|
||||
|
||||
/* Kernel Debugger mode */
|
||||
KD_DEBUG_MODE KD::DebugIo::DebugMode;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ KD::DebugIo::DbgPrint(PCWSTR Format,
|
||||
VA_START(Arguments, Format);
|
||||
|
||||
/* Call the actual debug print routine */
|
||||
DbgPrintEx(Format, Arguments);
|
||||
DbgPrint(Format, Arguments);
|
||||
|
||||
/* Clean up the va_list */
|
||||
VA_END(Arguments);
|
||||
@@ -54,12 +54,16 @@ KD::DebugIo::DbgPrint(PCWSTR Format,
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
KD::DebugIo::DbgPrintEx(PCWSTR Format,
|
||||
VA_LIST Arguments)
|
||||
KD::DebugIo::DbgPrint(PCWSTR Format,
|
||||
VA_LIST Arguments)
|
||||
{
|
||||
PLIST_ENTRY DispatchTableEntry;
|
||||
PKD_DISPATCH_TABLE DispatchTable;
|
||||
|
||||
/* Raise runlevel and acquire the Debug I/O lock */
|
||||
KE::RaiseRunLevel RunLevel(HIGH_LEVEL);
|
||||
KE::SpinLockGuard SpinLock(&DebugIoLock);
|
||||
|
||||
/* Iterate over all registered debug providers */
|
||||
DispatchTableEntry = Providers.Flink;
|
||||
while(DispatchTableEntry != &Providers)
|
||||
@@ -218,6 +222,9 @@ KD::DebugIo::InitializeDebugIoProviders(VOID)
|
||||
ULONG Index;
|
||||
XTSTATUS ProviderStatus, Status;
|
||||
|
||||
/* Initialize debug I/O spinlock */
|
||||
KE::SpinLock::InitializeSpinLock(&DebugIoLock);
|
||||
|
||||
/* Initialize debug providers list */
|
||||
RTL::LinkedList::InitializeListHead(&Providers);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ DbgPrint(PCWSTR Format,
|
||||
/* Initialise the va_list */
|
||||
VA_START(Arguments, Format);
|
||||
|
||||
KD::DebugIo::DbgPrintEx(Format, Arguments);
|
||||
KD::DebugIo::DbgPrint(Format, Arguments);
|
||||
|
||||
/* Clean up the va_list */
|
||||
VA_END(Arguments);
|
||||
|
||||
Reference in New Issue
Block a user