https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5e14dbd6481f29f9f3b66…
commit 5e14dbd6481f29f9f3b666e64b5bfd74ac887f73
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Dec 26 13:53:50 2019 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Dec 26 13:53:50 2019 +0100
WIP kdbg work.
---
ntoskrnl/kd/kdinit.c | 6 ++----
ntoskrnl/kd/kdio.c | 31 +++++++++++++++++++++------
ntoskrnl/kdbg/kdb.c | 60 ++++++++++++++++++++++++++++++++++++++++------------
3 files changed, 73 insertions(+), 24 deletions(-)
diff --git a/ntoskrnl/kd/kdinit.c b/ntoskrnl/kd/kdinit.c
index a73ec17ecad..0de4c73fe5f 100644
--- a/ntoskrnl/kd/kdinit.c
+++ b/ntoskrnl/kd/kdinit.c
@@ -39,9 +39,8 @@ extern ANSI_STRING KdpLogFileName;
/* PRIVATE FUNCTIONS *********************************************************/
-INIT_FUNCTION
+static INIT_FUNCTION
PCHAR
-NTAPI
KdpGetDebugMode(PCHAR Currentp2)
{
PCHAR p1, p2 = Currentp2;
@@ -135,9 +134,8 @@ KdpGetDebugMode(PCHAR Currentp2)
return p2;
}
-INIT_FUNCTION
+static INIT_FUNCTION
VOID
-NTAPI
KdpCallInitRoutine(ULONG BootPhase)
{
PLIST_ENTRY CurrentEntry;
diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c
index 4921d6af7c2..1291e823cfb 100644
--- a/ntoskrnl/kd/kdio.c
+++ b/ntoskrnl/kd/kdio.c
@@ -423,10 +423,12 @@ 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)
{
@@ -434,7 +436,6 @@ KdpScreenRelease(VOID)
InbvCheckDisplayOwnership())
{
/* Release the display */
- // InbvSetDisplayOwnership(FALSE);
InbvNotifyDisplayOwnershipLost(NULL);
}
}
@@ -632,6 +633,14 @@ 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);
@@ -648,8 +657,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++)
@@ -711,8 +720,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);
@@ -721,6 +730,14 @@ 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 d2a890276fe..1eabd45b10c 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,6 +1356,13 @@ 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;
@@ -1531,7 +1538,9 @@ KdbEnterDebuggerException(
{
if (!EnterConditionMet)
{
- return kdHandleException;
+ // return kdHandleException;
+ ContinueType = kdHandleException;
+ goto cleanup_quit;
}
KdbpPrint("\nEntered debugger on unexpected debug trap!\n");
@@ -1546,7 +1555,9 @@ KdbEnterDebuggerException(
}
if (!EnterConditionMet)
{
- return kdHandleException;
+ // return kdHandleException;
+ ContinueType = kdHandleException;
+ goto cleanup_quit;
}
KdbpPrint("\nEntered debugger on embedded INT3 at 0x%04x:0x%08x.\n",
@@ -1560,7 +1571,8 @@ KdbEnterDebuggerException(
if (!EnterConditionMet)
{
- return ContinueType;
+ // return ContinueType;
+ goto cleanup_quit;
}
KdbpPrint("\nEntered debugger on %s-chance exception (Exception Code: 0x%x)
(%s)\n",
@@ -1616,7 +1628,9 @@ KdbEnterDebuggerException(
if (InterlockedIncrement(&KdbEntryCount) > 1)
{
__writeeflags(OldEflags);
- return kdHandleException;
+ // return kdHandleException;
+ ContinueType = kdHandleException;
+ goto cleanup_quit;
}
/* Call the main loop */
@@ -1669,6 +1683,14 @@ KdbEnterDebuggerException(
}
continue_execution:
+
+/*************************/
+ /* Release the display */
+ if (KdpDebugMode.Screen)
+ KdpScreenRelease();
+ KbdEnableMouse();
+/*************************/
+
/* Clear debug status */
if (ExceptionCode == STATUS_BREAKPOINT) /* FIXME: Why clear DR6 on INT3? */
{
@@ -1688,6 +1710,17 @@ continue_execution:
}
}
+ return ContinueType;
+
+cleanup_quit:
+
+/*************************/
+ /* Release the display */
+ if (KdpDebugMode.Screen)
+ KdpScreenRelease();
+ KbdEnableMouse();
+/*************************/
+
return ContinueType;
}
@@ -1699,7 +1732,8 @@ KdbpGetCommandLineSettings(
{
#define CONST_STR_LEN(x) (sizeof(x)/sizeof(x[0]) - 1)
- while (p1 && (p1 = strchr(p1, ' ')))
+ /* Loop through the switches */
+ for (; p1 && *p1; p1 = strchr(p1, ' '))
{
/* Skip other spaces */
while (*p1 == ' ') ++p1;