https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ebd4783257270ea50dcc0...
commit 5ebd4783257270ea50dcc02babacd56a6623bce8 Author: Timo Kreuzer timo.kreuzer@reactos.org AuthorDate: Thu Dec 5 16:53:26 2024 +0200 Commit: Timo Kreuzer timo.kreuzer@reactos.org CommitDate: Mon Dec 16 16:21:44 2024 +0200
[NTOS][HAL:APIC] Call HalBegin/EndSystemInterrupt from clock handler --- hal/halx86/apic/apic.c | 2 +- hal/halx86/apic/rtctimer.c | 3 +++ hal/halx86/include/halp.h | 1 - ntoskrnl/include/internal/amd64/ke.h | 5 ++++- ntoskrnl/ke/time.c | 5 +++++ 5 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/hal/halx86/apic/apic.c b/hal/halx86/apic/apic.c index ae2c2e5a4ab..e4165bacf2f 100644 --- a/hal/halx86/apic/apic.c +++ b/hal/halx86/apic/apic.c @@ -743,7 +743,6 @@ HalDisableSystemInterrupt( IOApicWrite(IOAPIC_REDTBL + 2 * Index, ReDirReg.Long0); }
-#ifndef _M_AMD64 BOOLEAN NTAPI HalBeginSystemInterrupt( @@ -826,6 +825,7 @@ HalEndSystemInterrupt(
/* IRQL MANAGEMENT ************************************************************/
+#ifndef _M_AMD64 KIRQL NTAPI KeGetCurrentIrql(VOID) diff --git a/hal/halx86/apic/rtctimer.c b/hal/halx86/apic/rtctimer.c index 2cc67908a0f..a97f0a458a6 100644 --- a/hal/halx86/apic/rtctimer.c +++ b/hal/halx86/apic/rtctimer.c @@ -191,6 +191,9 @@ HalpClockInterruptHandler(IN PKTRAP_FRAME TrapFrame)
/* Update the system time -- on x86 the kernel will exit this trap */ KeUpdateSystemTime(TrapFrame, LastIncrement, Irql); + + /* End the interrupt */ + KiEndInterrupt(Irql, TrapFrame); }
VOID diff --git a/hal/halx86/include/halp.h b/hal/halx86/include/halp.h index 64fa72b3df0..ef6111654df 100644 --- a/hal/halx86/include/halp.h +++ b/hal/halx86/include/halp.h @@ -586,7 +586,6 @@ HalInitializeBios( #ifdef _M_AMD64 #define KfLowerIrql KeLowerIrql #define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */ -#define HalBeginSystemInterrupt(Irql, Vector, OldIrql) ((*(OldIrql) = PASSIVE_LEVEL), TRUE) #endif // _M_AMD64
extern BOOLEAN HalpNMIInProgress; diff --git a/ntoskrnl/include/internal/amd64/ke.h b/ntoskrnl/include/internal/amd64/ke.h index f0c6785ae6f..2bd4d5c8f3d 100644 --- a/ntoskrnl/include/internal/amd64/ke.h +++ b/ntoskrnl/include/internal/amd64/ke.h @@ -356,7 +356,10 @@ KiEndInterrupt(IN KIRQL Irql, { /* Make sure this is from the clock handler */ ASSERT(TrapFrame->ErrorCode == 0xc10c4); - //KeLowerIrql(Irql); + + /* Disable interrupts and end the interrupt */ + _disable(); + HalEndSystemInterrupt(Irql, TrapFrame); }
FORCEINLINE diff --git a/ntoskrnl/ke/time.c b/ntoskrnl/ke/time.c index 09b61f0007d..cb10259bb65 100644 --- a/ntoskrnl/ke/time.c +++ b/ntoskrnl/ke/time.c @@ -77,7 +77,10 @@ KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
/* Increase interrupt count and end the interrupt */ Prcb->InterruptCount++; + +#ifdef _M_IX86 // x86 optimization KiEndInterrupt(Irql, TrapFrame); +#endif
/* Note: non-x86 return back to the caller! */ return; @@ -131,8 +134,10 @@ KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame, Prcb->InterruptCount++; }
+#ifdef _M_IX86 // x86 optimization /* Disable interrupts and end the interrupt */ KiEndInterrupt(Irql, TrapFrame); +#endif }
VOID