[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

@ -26,8 +26,8 @@
*
* See also: kd\kdio.c
*/
static SIZE_T
INIT_FUNCTION
static INIT_FUNCTION
SIZE_T
KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PLIST_ENTRY ListEntry;
@ -67,8 +67,8 @@ KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
}
/* See also: kd\kdio.c */
static VOID
INIT_FUNCTION
static INIT_FUNCTION
VOID
KdpPrintBanner(IN SIZE_T MemSizeMBs)
{
DPRINT1("-----------------------------------------------------\n");
@ -340,7 +340,7 @@ KdInitSystem(IN ULONG BootPhase,
}
else
{
/* Called from a bugcheck or a re-enable. Save the Kernel Base */
/* Called from a bugcheck or a re-enable. Save the Kernel Base. */
KdVersionBlock.KernBase = (ULONG64)(LONG_PTR)PsNtosImageBase;
/* Unconditionally enable KD */