https://git.reactos.org/?p=reactos.git;a=commitdiff;h=44c6df4b2769b2b2d7aa6…
commit 44c6df4b2769b2b2d7aa62b589625e1a5b87338d
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Tue Nov 17 14:22:27 2020 +0100
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Tue Nov 17 14:23:36 2020 +0100
[NTOS:KD] Correctly define previous mode when entering KDBG (addendum to
0c76bbfe98d8dae26749670cba355136413ba3ce)
---
ntoskrnl/kd/kdio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c
index 22842942596..50f011c7f02 100644
--- a/ntoskrnl/kd/kdio.c
+++ b/ntoskrnl/kd/kdio.c
@@ -56,6 +56,7 @@ static ULONG KdbgNextApiNumber = DbgKdContinueApi;
static CONTEXT KdbgContext;
static EXCEPTION_RECORD64 KdbgExceptionRecord;
static BOOLEAN KdbgFirstChanceException;
+static KPROCESSOR_MODE KdbgPreviousMode;
static NTSTATUS KdbgContinueStatus = STATUS_SUCCESS;
/* LOCKING FUNCTIONS *********************************************************/
@@ -580,6 +581,7 @@ KdSendPacket(
KdbgNextApiNumber = DbgKdGetContextApi;
KdbgExceptionRecord = WaitStateChange->u.Exception.ExceptionRecord;
KdbgFirstChanceException = WaitStateChange->u.Exception.FirstChance;
+ KdbgPreviousMode =
((PKTHREAD)(ULONG_PTR)WaitStateChange->Thread)->PreviousMode;
return;
}
}
@@ -599,7 +601,7 @@ KdSendPacket(
}
Result = KdbEnterDebuggerException(&KdbgExceptionRecord,
- KernelMode, // FIXME
+ KdbgPreviousMode,
&KdbgContext,
KdbgFirstChanceException);
#else