https://git.reactos.org/?p=reactos.git;a=commitdiff;h=67231bd69ab9b66cc14d92b8ff33d1ffe197392f

commit 67231bd69ab9b66cc14d92b8ff33d1ffe197392f
Author:     Timo Kreuzer <timo.kreu...@reactos.org>
AuthorDate: Thu Dec 5 15:37:28 2024 +0200
Commit:     Timo Kreuzer <timo.kreu...@reactos.org>
CommitDate: Mon Dec 16 16:21:44 2024 +0200

    [NTOS:KE/X64] Fix KiInterruptDispatch
    
    - Enable interrupts
    - Acquire the spinlock on SMP builds
---
 ntoskrnl/ke/amd64/trap.S | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/ntoskrnl/ke/amd64/trap.S b/ntoskrnl/ke/amd64/trap.S
index 34b7c906104..6f1c2a23521 100644
--- a/ntoskrnl/ke/amd64/trap.S
+++ b/ntoskrnl/ke/amd64/trap.S
@@ -23,8 +23,9 @@ EXTERN KiDpcInterruptHandler:PROC
 EXTERN PsConvertToGuiThread:PROC
 EXTERN MmCreateKernelStack:PROC
 EXTERN MmDeleteKernelStack:PROC
-
 EXTERN KdSetOwedBreakpoints:PROC
+EXTERN KeAcquireSpinLockAtDpcLevel:PROC
+EXTERN KeReleaseSpinLockFromDpcLevel:PROC
 
 
 /* Helper Macros *************************************************************/
@@ -744,11 +745,13 @@ FUNC KiInterruptDispatch
     movzx rax, byte ptr [rbx + KINTERRUPT_SynchronizeIrql]
     mov cr8, rax
 
+    /* Enable interrupts */
+    sti
+
 #ifdef CONFIG_SMP
     /* Acquire interrupt lock */
-    mov r8, [rbx + KINTERRUPT_ActualLock]
-
-    //KxAcquireSpinLock(Interrupt->ActualLock);
+    mov rcx, [rbx + KINTERRUPT_ActualLock]
+    call KeAcquireSpinLockAtDpcLevel
 #endif
 
     /* Call the ISR */
@@ -758,10 +761,12 @@ FUNC KiInterruptDispatch
 
 #ifdef CONFIG_SMP
     /* Release interrupt lock */
-    //KxReleaseSpinLock(Interrupt->ActualLock);
+    mov rcx, [rbx + KINTERRUPT_ActualLock]
+    call KeReleaseSpinLockFromDpcLevel
 #endif
 
-    /* Go back to old irql */
+    /* Disable interrupts and go back to old irql */
+    cli
     movzx rax, byte ptr [rbp + KTRAP_FRAME_PreviousIrql]
     mov cr8, rax
 

Reply via email to