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 */
|
/* If there's no thread scheduled, put this CPU in the Idle summary */
|
||||||
KiAcquirePrcbLock(Prcb);
|
KiAcquirePrcbLock(Prcb);
|
||||||
if (!Prcb->NextThread) KiIdleSummary |= (ULONG_PTR)1 << Prcb->Number;
|
if (!Prcb->NextThread)
|
||||||
|
InterlockedBitTestAndSetAffinity(&KiIdleSummary, Prcb->Number);
|
||||||
KiReleasePrcbLock(Prcb);
|
KiReleasePrcbLock(Prcb);
|
||||||
|
|
||||||
/* Raise back to HIGH_LEVEL and clear the PRCB for the loader block */
|
/* Raise back to HIGH_LEVEL and clear the PRCB for the loader block */
|
||||||
|
|
|
@ -101,6 +101,9 @@ KiIdleLoop(VOID)
|
||||||
PKPRCB Prcb = KeGetCurrentPrcb();
|
PKPRCB Prcb = KeGetCurrentPrcb();
|
||||||
PKTHREAD OldThread, NewThread;
|
PKTHREAD OldThread, NewThread;
|
||||||
|
|
||||||
|
/* Set idle summary bit */
|
||||||
|
InterlockedBitTestAndSetAffinity(&KiIdleSummary, Prcb->Number);
|
||||||
|
|
||||||
/* Now loop forever */
|
/* Now loop forever */
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
@ -144,9 +147,15 @@ KiIdleLoop(VOID)
|
||||||
KfRaiseIrql(SYNCH_LEVEL);
|
KfRaiseIrql(SYNCH_LEVEL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Clear idle summary bit */
|
||||||
|
InterlockedBitTestAndResetAffinity(&KiIdleSummary, Prcb->Number);
|
||||||
|
|
||||||
/* Switch away from the idle thread */
|
/* Switch away from the idle thread */
|
||||||
KiSwapContext(APC_LEVEL, OldThread);
|
KiSwapContext(APC_LEVEL, OldThread);
|
||||||
|
|
||||||
|
/* Set idle summary bit */
|
||||||
|
InterlockedBitTestAndSetAffinity(&KiIdleSummary, Prcb->Number);
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
/* Go back to DISPATCH_LEVEL */
|
/* Go back to DISPATCH_LEVEL */
|
||||||
KeLowerIrql(DISPATCH_LEVEL);
|
KeLowerIrql(DISPATCH_LEVEL);
|
||||||
|
|
Loading…
Reference in a new issue