From d32e96d60253b0100987e78e696fd4a57c7314bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 26 Dec 2019 17:19:11 +0100 Subject: [PATCH] This was not meant to be committed! This reverts commit 5e14dbd6481f29f9f3b666e64b5bfd74ac887f73. --- ntoskrnl/kd/kdinit.c | 6 +++-- ntoskrnl/kd/kdio.c | 31 ++++++----------------- ntoskrnl/kdbg/kdb.c | 60 ++++++++++---------------------------------- 3 files changed, 24 insertions(+), 73 deletions(-) diff --git a/ntoskrnl/kd/kdinit.c b/ntoskrnl/kd/kdinit.c index 0de4c73fe5f..a73ec17ecad 100644 --- a/ntoskrnl/kd/kdinit.c +++ b/ntoskrnl/kd/kdinit.c @@ -39,8 +39,9 @@ extern ANSI_STRING KdpLogFileName; /* PRIVATE FUNCTIONS *********************************************************/ -static INIT_FUNCTION +INIT_FUNCTION PCHAR +NTAPI KdpGetDebugMode(PCHAR Currentp2) { PCHAR p1, p2 = Currentp2; @@ -134,8 +135,9 @@ KdpGetDebugMode(PCHAR Currentp2) return p2; } -static INIT_FUNCTION +INIT_FUNCTION VOID +NTAPI KdpCallInitRoutine(ULONG BootPhase) { PLIST_ENTRY CurrentEntry; diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 1291e823cfb..4921d6af7c2 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -423,12 +423,10 @@ KdpScreenAcquire(VOID) InbvEnableDisplayString(TRUE); InbvSetScrollRegion(0, 0, 639, 479); } - else - { - DbgPrint("********* -----> Could NOT acquire SCREEN!! <----- *********\n"); - } } +// extern VOID NTAPI InbvSetDisplayOwnership(IN BOOLEAN DisplayOwned); + VOID KdpScreenRelease(VOID) { @@ -436,6 +434,7 @@ KdpScreenRelease(VOID) InbvCheckDisplayOwnership()) { /* Release the display */ + // InbvSetDisplayOwnership(FALSE); InbvNotifyDisplayOwnershipLost(NULL); } } @@ -633,14 +632,6 @@ KdpPromptString( USHORT i; ULONG DummyScanCode; -/*************************/ - /**/if (!(KdbDebugState & KD_DEBUG_KDSERIAL))/**/ - KbdDisableMouse(); - /* Take control of the display */ - if (KdpDebugMode.Screen) - KdpScreenAcquire(); -/*************************/ - StringChar.Buffer = &Response; StringChar.Length = StringChar.MaximumLength = sizeof(Response); @@ -657,8 +648,8 @@ KdpPromptString( /* Acquire the printing spinlock without waiting at raised IRQL */ OldIrql = KdpAcquireLock(&KdpSerialSpinLock); - // if (!(KdbDebugState & KD_DEBUG_KDSERIAL)) - // KbdDisableMouse(); + if (!(KdbDebugState & KD_DEBUG_KDSERIAL)) + KbdDisableMouse(); /* Loop the whole string */ for (i = 0; i < ResponseString->MaximumLength; i++) @@ -720,8 +711,8 @@ KdpPromptString( /* Return the length */ ResponseString->Length = i; - // if (!(KdbDebugState & KD_DEBUG_KDSERIAL)) - // KbdEnableMouse(); + if (!(KdbDebugState & KD_DEBUG_KDSERIAL)) + KbdEnableMouse(); /* Release the spinlock */ KdpReleaseLock(&KdpSerialSpinLock, OldIrql); @@ -730,14 +721,6 @@ KdpPromptString( *StringChar.Buffer = '\n'; KdpPrintString(&StringChar); -/*************************/ - /* Release the display */ - if (KdpDebugMode.Screen) - KdpScreenRelease(); - /**/if (!(KdbDebugState & KD_DEBUG_KDSERIAL))/**/ - KbdEnableMouse(); -/*************************/ - /* Success; we don't need to resend */ return FALSE; } diff --git a/ntoskrnl/kdbg/kdb.c b/ntoskrnl/kdbg/kdb.c index 1eabd45b10c..d2a890276fe 100644 --- a/ntoskrnl/kdbg/kdb.c +++ b/ntoskrnl/kdbg/kdb.c @@ -1216,11 +1216,11 @@ KdbpInternalEnter(VOID) PVOID SavedInitialStack, SavedStackBase, SavedKernelStack; ULONG SavedStackLimit; - // KbdDisableMouse(); + KbdDisableMouse(); - // /* Take control of the display */ - // if (KdpDebugMode.Screen) - // KdpScreenAcquire(); + /* Take control of the display */ + if (KdpDebugMode.Screen) + KdpScreenAcquire(); /* Call the interface's main loop on a different stack */ Thread = PsGetCurrentThread(); @@ -1241,11 +1241,11 @@ KdbpInternalEnter(VOID) Thread->Tcb.StackLimit = SavedStackLimit; Thread->Tcb.KernelStack = SavedKernelStack; - // /* Release the display */ - // if (KdpDebugMode.Screen) - // KdpScreenRelease(); + /* Release the display */ + if (KdpDebugMode.Screen) + KdpScreenRelease(); - // KbdEnableMouse(); + KbdEnableMouse(); } static ULONG @@ -1356,13 +1356,6 @@ KdbEnterDebuggerException( EnterConditionMet = FALSE; } -/*************************/ - KbdDisableMouse(); - /* Take control of the display */ - if (KdpDebugMode.Screen) - KdpScreenAcquire(); -/*************************/ - /* If we stopped on one of our breakpoints then let the user know */ KdbLastBreakPointNr = -1; KdbEnteredOnSingleStep = FALSE; @@ -1538,9 +1531,7 @@ KdbEnterDebuggerException( { if (!EnterConditionMet) { - // return kdHandleException; - ContinueType = kdHandleException; - goto cleanup_quit; + return kdHandleException; } KdbpPrint("\nEntered debugger on unexpected debug trap!\n"); @@ -1555,9 +1546,7 @@ KdbEnterDebuggerException( } if (!EnterConditionMet) { - // return kdHandleException; - ContinueType = kdHandleException; - goto cleanup_quit; + return kdHandleException; } KdbpPrint("\nEntered debugger on embedded INT3 at 0x%04x:0x%08x.\n", @@ -1571,8 +1560,7 @@ KdbEnterDebuggerException( if (!EnterConditionMet) { - // return ContinueType; - goto cleanup_quit; + return ContinueType; } KdbpPrint("\nEntered debugger on %s-chance exception (Exception Code: 0x%x) (%s)\n", @@ -1628,9 +1616,7 @@ KdbEnterDebuggerException( if (InterlockedIncrement(&KdbEntryCount) > 1) { __writeeflags(OldEflags); - // return kdHandleException; - ContinueType = kdHandleException; - goto cleanup_quit; + return kdHandleException; } /* Call the main loop */ @@ -1683,14 +1669,6 @@ KdbEnterDebuggerException( } continue_execution: - -/*************************/ - /* Release the display */ - if (KdpDebugMode.Screen) - KdpScreenRelease(); - KbdEnableMouse(); -/*************************/ - /* Clear debug status */ if (ExceptionCode == STATUS_BREAKPOINT) /* FIXME: Why clear DR6 on INT3? */ { @@ -1710,17 +1688,6 @@ continue_execution: } } - return ContinueType; - -cleanup_quit: - -/*************************/ - /* Release the display */ - if (KdpDebugMode.Screen) - KdpScreenRelease(); - KbdEnableMouse(); -/*************************/ - return ContinueType; } @@ -1732,8 +1699,7 @@ KdbpGetCommandLineSettings( { #define CONST_STR_LEN(x) (sizeof(x)/sizeof(x[0]) - 1) - /* Loop through the switches */ - for (; p1 && *p1; p1 = strchr(p1, ' ')) + while (p1 && (p1 = strchr(p1, ' '))) { /* Skip other spaces */ while (*p1 == ' ') ++p1;