https://git.reactos.org/?p=reactos.git;a=commitdiff;h=902c6eee1e0d68d0d9766…
commit 902c6eee1e0d68d0d976687d72c6542dbe686cc6
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Jul 23 13:21:18 2022 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Aug 4 16:15:24 2022 +0200
[NTOS:KE] Restore interrupts in KiSwitchKernelStack
---
ntoskrnl/ke/amd64/stubs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ntoskrnl/ke/amd64/stubs.c b/ntoskrnl/ke/amd64/stubs.c
index 7aa5866b978..7933d2c1cf9 100644
--- a/ntoskrnl/ke/amd64/stubs.c
+++ b/ntoskrnl/ke/amd64/stubs.c
@@ -115,6 +115,7 @@ KiSwitchKernelStack(PVOID StackBase, PVOID StackLimit)
LONG_PTR StackOffset;
SIZE_T StackSize;
PKIPCR Pcr;
+ ULONG Eflags;
/* Get the current thread */
CurrentThread = KeGetCurrentThread();
@@ -135,6 +136,7 @@ KiSwitchKernelStack(PVOID StackBase, PVOID StackLimit)
StackOffset = (PUCHAR)StackBase - (PUCHAR)CurrentThread->StackBase;
/* Disable interrupts while messing with the stack */
+ Eflags = __readeflags();
_disable();
/* Set the new trap frame */
@@ -157,6 +159,9 @@ KiSwitchKernelStack(PVOID StackBase, PVOID StackLimit)
/* Adjust Rsp0 in the TSS */
Pcr->TssBase->Rsp0 += StackOffset;
+ /* Restore interrupts */
+ __writeeflags(Eflags);
+
return OldStackBase;
}