https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8ec888487af60784a3e765...
commit 8ec888487af60784a3e7655c676cdb0479a79498 Author: Timo Kreuzer timo.kreuzer@reactos.org AuthorDate: Mon Feb 12 20:48:11 2018 +0100 Commit: Timo Kreuzer timo.kreuzer@reactos.org CommitDate: Sat Oct 31 14:23:16 2020 +0100
[ASM:X64] ASSERT that interrupts are enabled, when returning to user mode --- ntoskrnl/ke/amd64/trap.S | 5 +++++ sdk/include/asm/trapamd64.inc | 9 +++++++++ 2 files changed, 14 insertions(+)
diff --git a/ntoskrnl/ke/amd64/trap.S b/ntoskrnl/ke/amd64/trap.S index 3bcaa1684bf..75707e1d72d 100644 --- a/ntoskrnl/ke/amd64/trap.S +++ b/ntoskrnl/ke/amd64/trap.S @@ -786,6 +786,11 @@ PUBLIC KiSystemCallEntry64 #if DBG /* Restore rbp */ mov rbp, [rsp + SYSCALL_ALLOCATION + KTRAP_FRAME_Rbp] + + test dword ptr [rsp + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_EFlags], HEX(200) + jnz IntsEnabled + int 3 +IntsEnabled: #endif
/* Disable interrupts for return */ diff --git a/sdk/include/asm/trapamd64.inc b/sdk/include/asm/trapamd64.inc index 88a8d182cc2..74209493d90 100644 --- a/sdk/include/asm/trapamd64.inc +++ b/sdk/include/asm/trapamd64.inc @@ -142,6 +142,7 @@ ENDM */ MACRO(ExitTrap, Flags) LOCAL kernel_mode_return + LOCAL IntsEnabled
#if DBG /* Check previous irql */ @@ -177,6 +178,14 @@ MACRO(ExitTrap, Flags)
endif
+#if DBG + /*Make sure interrupts are enabled */ + test dword ptr [rbp + KTRAP_FRAME_EFlags], HEX(200) + jnz IntsEnabled + int HEX(2c) +IntsEnabled: +#endif + /* Swap gs to user mode */ swapgs