[NTOS:KE] Handle SwapBusy in x64 KiIdleLoop

This commit is contained in:
Timo Kreuzer 2023-12-21 19:50:47 +02:00
parent 3b026627e9
commit bcbc2c8700
2 changed files with 7 additions and 0 deletions

View file

@ -423,6 +423,8 @@ KiSetThreadSwapBusy(IN PKTHREAD Thread)
{
/* Make sure nobody already set it */
ASSERT(Thread->SwapBusy == FALSE);
ASSERT(KeGetCurrentIrql() >= DISPATCH_LEVEL);
ASSERT(Thread == KeGetCurrentThread());
/* Set it ourselves */
Thread->SwapBusy = TRUE;

View file

@ -107,6 +107,8 @@ KiIdleLoop(VOID)
/* Now loop forever */
while (TRUE)
{
ASSERT(KeGetCurrentThread()->SwapBusy == FALSE);
/* Start of the idle loop: disable interrupts */
_enable();
YieldProcessor();
@ -131,6 +133,9 @@ KiIdleLoop(VOID)
/* Enable interrupts */
_enable();
// Do we need this?
KiSetThreadSwapBusy(Prcb->IdleThread);
/* Capture current thread data */
OldThread = Prcb->CurrentThread;
NewThread = Prcb->NextThread;