mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
WIP [NTOS:KE/x64] Properly handle KiIdleSummary
TODO: Remove the chunk from KiSystemStartupBootStack? Shouldn't be needed. What about other instances of KiIdleSummary?
This commit is contained in:
parent
ea711415c4
commit
3b026627e9
2 changed files with 11 additions and 1 deletions
|
@ -197,7 +197,8 @@ KiSystemStartupBootStack(VOID)
|
|||
|
||||
/* If there's no thread scheduled, put this CPU in the Idle summary */
|
||||
KiAcquirePrcbLock(Prcb);
|
||||
if (!Prcb->NextThread) KiIdleSummary |= (ULONG_PTR)1 << Prcb->Number;
|
||||
if (!Prcb->NextThread)
|
||||
InterlockedBitTestAndSetAffinity(&KiIdleSummary, Prcb->Number);
|
||||
KiReleasePrcbLock(Prcb);
|
||||
|
||||
/* Raise back to HIGH_LEVEL and clear the PRCB for the loader block */
|
||||
|
|
|
@ -101,6 +101,9 @@ KiIdleLoop(VOID)
|
|||
PKPRCB Prcb = KeGetCurrentPrcb();
|
||||
PKTHREAD OldThread, NewThread;
|
||||
|
||||
/* Set idle summary bit */
|
||||
InterlockedBitTestAndSetAffinity(&KiIdleSummary, Prcb->Number);
|
||||
|
||||
/* Now loop forever */
|
||||
while (TRUE)
|
||||
{
|
||||
|
@ -144,9 +147,15 @@ KiIdleLoop(VOID)
|
|||
KfRaiseIrql(SYNCH_LEVEL);
|
||||
#endif
|
||||
|
||||
/* Clear idle summary bit */
|
||||
InterlockedBitTestAndResetAffinity(&KiIdleSummary, Prcb->Number);
|
||||
|
||||
/* Switch away from the idle thread */
|
||||
KiSwapContext(APC_LEVEL, OldThread);
|
||||
|
||||
/* Set idle summary bit */
|
||||
InterlockedBitTestAndSetAffinity(&KiIdleSummary, Prcb->Number);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Go back to DISPATCH_LEVEL */
|
||||
KeLowerIrql(DISPATCH_LEVEL);
|
||||
|
|
Loading…
Reference in a new issue