**** WIP HAL Set correct IRQL for interrupt handlers (see Timo's branch/PR for updated fix) ****

This commit is contained in:
Hermès Bélusca-Maïto 2024-12-06 21:23:19 +01:00
parent 28b7f550ee
commit 03b4cf3544
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 28 additions and 1 deletions

View file

@ -743,6 +743,16 @@ HalDisableSystemInterrupt(
IOApicWrite(IOAPIC_REDTBL + 2 * Index, ReDirReg.Long0);
}
/*
* FIXME: Left enabled, until the non-x86 HAL uses the kernel's
* KeInitializeInterrupt(), KeConnectInterrupt() (or its HAL version)
* so that, when the interrupt handlers are invoked, they already
* are running with the correct IRQL, instead of being enforced with
* HalBeginSystemInterrupt() and cleaned up with HalEndSystemInterrupt().
*
* This code was originally #ifndef _M_AMD64 by commit f085f50747 (r53631).
*/
// #ifndef _M_AMD64
BOOLEAN
NTAPI
HalBeginSystemInterrupt(
@ -821,6 +831,7 @@ HalEndSystemInterrupt(
/* Restore the old IRQL */
ApicLowerIrql(OldIrql);
}
// #endif /* !_M_AMD64 */
/* IRQL MANAGEMENT ************************************************************/

View file

@ -219,7 +219,7 @@ HalpClockIpiHandler(IN PKTRAP_FRAME TrapFrame)
return;
}
/* Call the kernel to update runtimes */
/* Call the kernel to update runtime */
KeUpdateRunTime(TrapFrame, Irql);
/* End the interrupt */

View file

@ -356,6 +356,13 @@ KeProfileInterruptWithSource(IN PKTRAP_FRAME TrapFrame,
{
PKPROCESS Process = KeGetCurrentThread()->ApcState.Process;
{
KIRQL CurrIrql = KeGetCurrentIrql();
if (CurrIrql < PROFILE_LEVEL)
KdDbgPortPrintf("%s() running at IRQL %d\n", __FUNCTION__, CurrIrql);
}
// ASSERT(KeGetCurrentIrql() == PROFILE_LEVEL);
/* We have to parse 2 lists. Per-Process and System-Wide */
KiParseProfileList(TrapFrame, Source, &Process->ProfileListHead);
KiParseProfileList(TrapFrame, Source, &KiProfileListHead);

View file

@ -59,6 +59,8 @@ KiCheckForTimerExpiration(
}
}
extern void KdDbgPortPrintf(PCSTR Format, ...);
VOID
FASTCALL
KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
@ -69,6 +71,13 @@ KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
ULARGE_INTEGER CurrentTime, InterruptTime;
LONG OldTickOffset;
{
KIRQL CurrIrql = KeGetCurrentIrql();
if (CurrIrql < CLOCK_LEVEL)
KdDbgPortPrintf("%s() CurrIrql %d ; PrevIrql %d\n", __FUNCTION__, CurrIrql, Irql);
}
// ASSERT(KeGetCurrentIrql() == CLOCK_LEVEL); // CLOCK2_LEVEL
/* Check if this tick is being skipped */
if (Prcb->SkipTick)
{