[NTOS:KD/KDBG] Code enhancements for KDBG/KD.

- Introduce KdpScreenAcquire() / KdpScreenRelease() helpers that allow
  to correctly acquire or release the screen when using INBV for
  "Screen-Mode" debugging.

- Introduce KdpAcquireLock() / KdpReleaseLock() helpers so as to reduce
  the copy-pasted code required when acquiring spin-locks in the KD debug
  logger functions.

- Close the opened KdpLogFileHandle file in the KdpInitDebugLog() logger
  in case we failed to create the logger writer thread.
  Also use explicit kernel-mode handle when opening the log file.

- static-ify some local variables, remove few hardcoded values, and
  minor formatting.

- Correctly define the INIT_FUNCTION's.
This commit is contained in:
Hermès Bélusca-Maïto 2019-11-17 16:44:22 +01:00
parent a4b6e0d929
commit 9537653ee7
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
5 changed files with 156 additions and 147 deletions

View file

@ -31,7 +31,7 @@ KD_DISPATCH_TABLE DispatchTable[KdMax];
PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
KdpSerialInit,
KdpInitDebugLog,
KdpDebugLogInit,
KdpBochsInit,
KdpKdbgInit};
@ -39,9 +39,9 @@ extern ANSI_STRING KdpLogFileName;
/* PRIVATE FUNCTIONS *********************************************************/
INIT_FUNCTION
PCHAR
NTAPI
INIT_FUNCTION
KdpGetDebugMode(PCHAR Currentp2)
{
PCHAR p1, p2 = Currentp2;
@ -135,9 +135,9 @@ KdpGetDebugMode(PCHAR Currentp2)
return p2;
}
INIT_FUNCTION
VOID
NTAPI
INIT_FUNCTION
KdpCallInitRoutine(ULONG BootPhase)
{
PLIST_ENTRY CurrentEntry;
@ -213,7 +213,7 @@ KdInitSystem(ULONG BootPhase,
}
else
{
/* Called from a bugcheck or a re-enable. Unconditionally enable KD */
/* Called from a bugcheck or a re-enable. Unconditionally enable KD. */
KdDebuggerEnabled = TRUE;
}