From 95faf65ebf3e5d0f4bd3a41b7d89655fde480359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sat, 28 Mar 2020 19:15:57 +0100 Subject: [PATCH] [NTOS:KD] Remove useless variables/members Those where only set and never read. --- ntoskrnl/include/internal/kd.h | 26 --------------- ntoskrnl/kd/kdio.c | 8 ----- ntoskrnl/kd/kdmain.c | 58 ++-------------------------------- ntoskrnl/kd64/kddata.c | 6 ---- 4 files changed, 2 insertions(+), 96 deletions(-) diff --git a/ntoskrnl/include/internal/kd.h b/ntoskrnl/include/internal/kd.h index 7f727c0df8c..b317cea3084 100644 --- a/ntoskrnl/include/internal/kd.h +++ b/ntoskrnl/include/internal/kd.h @@ -105,18 +105,6 @@ VOID ULONG Length ); -typedef -VOID -(NTAPI*PKDP_PROMPT_ROUTINE)(PCH String); - -typedef -KD_CONTINUE_TYPE -(NTAPI*PKDP_EXCEPTION_ROUTINE)( - PEXCEPTION_RECORD ExceptionRecord, - PCONTEXT Context, - PKTRAP_FRAME TrapFrame -); - /* INIT ROUTINES *************************************************************/ BOOLEAN @@ -239,19 +227,11 @@ typedef struct _KD_DISPATCH_TABLE LIST_ENTRY KdProvidersList; PKDP_INIT_ROUTINE KdpInitRoutine; PKDP_PRINT_ROUTINE KdpPrintRoutine; - PKDP_PROMPT_ROUTINE KdpPromptRoutine; - PKDP_EXCEPTION_ROUTINE KdpExceptionRoutine; } KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE; /* The current Debugging Mode */ extern KDP_DEBUG_MODE KdpDebugMode; -/* The current Port IRQ */ -extern ULONG KdpPortIrq; - -/* The current Port */ -extern ULONG KdpPort; - /* Port Information for the Serial Native Mode */ extern ULONG SerialPortNumber; extern CPPORT SerialPortInfo; @@ -259,15 +239,9 @@ extern CPPORT SerialPortInfo; /* Init Functions for Native Providers */ extern PKDP_INIT_ROUTINE InitRoutines[KdMax]; -/* Wrapper Init Function */ -extern PKDP_INIT_ROUTINE WrapperInitRoutine; - /* Dispatch Tables for Native Providers */ extern KD_DISPATCH_TABLE DispatchTable[KdMax]; -/* Dispatch Table for the Wrapper */ -extern KD_DISPATCH_TABLE WrapperTable; - /* The KD Native Provider List */ extern LIST_ENTRY KdProviders; diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 8fb73f23ccd..d98ab455419 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -31,9 +31,6 @@ static KSPIN_LOCK KdpSerialSpinLock; ULONG SerialPortNumber = DEFAULT_DEBUG_PORT; CPPORT SerialPortInfo = {0, DEFAULT_DEBUG_BAUD_RATE, 0}; -/* Current Port in use. FIXME: Do we support more than one? */ -ULONG KdpPort; - #define KdpScreenLineLengthDefault 80 static CHAR KdpScreenLineBuffer[KdpScreenLineLengthDefault + 1] = ""; static ULONG KdpScreenLineBufferPos = 0, KdpScreenLineLength = 0; @@ -543,11 +540,6 @@ KdSendPacket( /* Next Table */ CurrentEntry = CurrentEntry->Flink; } - - /* Call the Wrapper Routine */ - if (WrapperTable.KdpPrintRoutine) - WrapperTable.KdpPrintRoutine(Output->Buffer, Output->Length); - return; } else if (PacketType == PACKET_TYPE_KD_STATE_CHANGE64) diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index 83009cd80db..9ae8552758c 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -15,7 +15,6 @@ VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads); -extern CPPORT PortInfo; extern ANSI_STRING KdpLogFileName; /* PRIVATE FUNCTIONS *********************************************************/ @@ -49,14 +48,6 @@ KdpReportExceptionStateChange(IN PEXCEPTION_RECORD ExceptionRecord, TrapFrame, !SecondChanceException); #else /* not KDBG */ - if (WrapperInitRoutine) - { - /* Call GDB */ - Return = WrapperTable.KdpExceptionRoutine(ExceptionRecord, - ContextRecord, - TrapFrame); - } - /* We'll manually dump the stack for the user... */ KeRosDumpStackFrames(NULL, 0); #endif /* not KDBG */ @@ -99,7 +90,6 @@ KdpGetDebugMode(PCHAR Currentp2) /* Set the port to use */ SerialPortNumber = Value; - KdpPort = Value; } } else @@ -110,7 +100,6 @@ KdpGetDebugMode(PCHAR Currentp2) KdpDebugMode.Serial = TRUE; SerialPortInfo.Address = UlongToPtr(Value); SerialPortNumber = 0; - KdpPort = 0; } } } @@ -138,9 +127,8 @@ NTAPI KdDebuggerInitialize0( IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL) { - ULONG Value; ULONG i; - PCHAR CommandLine, Port = NULL, BaudRate = NULL, Irq = NULL; + PCHAR CommandLine, Port = NULL; if (LoaderBlock) { @@ -156,10 +144,8 @@ KdDebuggerInitialize0( KdbpGetCommandLineSettings(CommandLine); #endif - /* Get the port and baud rate */ + /* Get the port */ Port = strstr(CommandLine, "DEBUGPORT"); - BaudRate = strstr(CommandLine, "BAUDRATE"); - Irq = strstr(CommandLine, "IRQ"); } } @@ -182,42 +168,6 @@ KdDebuggerInitialize0( if (KdpDebugMode.Value == 0) KdpDebugMode.Serial = TRUE; - /* Check if we got a baud rate */ - if (BaudRate) - { - /* Move past the actual string, to reach the rate */ - BaudRate += sizeof("BAUDRATE") - 1; - - /* Now get past any spaces */ - while (*BaudRate == ' ') BaudRate++; - - /* And make sure we have a rate */ - if (*BaudRate) - { - /* Read and set it */ - Value = atol(BaudRate + 1); - if (Value) PortInfo.BaudRate = SerialPortInfo.BaudRate = Value; - } - } - - /* Check Serial Port Settings [IRQ] */ - if (Irq) - { - /* Move past the actual string, to reach the rate */ - Irq += sizeof("IRQ") - 1; - - /* Now get past any spaces */ - while (*Irq == ' ') Irq++; - - /* And make sure we have an IRQ */ - if (*Irq) - { - /* Read and set it */ - Value = atol(Irq + 1); - if (Value) KdpPortIrq = Value; - } - } - /* Call Providers at Phase 0 */ for (i = 0; i < KdMax; i++) { @@ -251,10 +201,6 @@ KdDebuggerInitialize1( CurrentEntry = CurrentEntry->Flink; } - /* Call the Wrapper Init Routine */ - if (WrapperInitRoutine) - WrapperTable.KdpInitRoutine(&WrapperTable, 1); - NtGlobalFlag |= FLG_STOP_ON_EXCEPTION; return STATUS_SUCCESS; diff --git a/ntoskrnl/kd64/kddata.c b/ntoskrnl/kd64/kddata.c index 2049583026f..c83f9f6665b 100644 --- a/ntoskrnl/kd64/kddata.c +++ b/ntoskrnl/kd64/kddata.c @@ -138,13 +138,7 @@ ULONG KdPrintBufferSize = sizeof(KdPrintDefaultCircularBuffer); ULONG KdPrintBufferChanges = 0; #ifndef _WINKD_ -/* Make bochs debug output in the very early boot phase available */ -ULONG PortNumber = DEFAULT_DEBUG_PORT; -CPPORT PortInfo = {0, DEFAULT_DEBUG_BAUD_RATE, 0}; -ULONG KdpPortIrq; KDP_DEBUG_MODE KdpDebugMode; -PKDP_INIT_ROUTINE WrapperInitRoutine; -KD_DISPATCH_TABLE WrapperTable; LIST_ENTRY KdProviders = {&KdProviders, &KdProviders}; KD_DISPATCH_TABLE DispatchTable[KdMax];