[NTOS:KE] Acquire PRCB lock before marking thread ready for execution in dispatch interrupt routine (#6387)

Fixed in x86 and ARM (this was already done in x64).

This is needed because thread preparation routine KxQueueReadyThread()
releases PRCB lock, but does not acquire it, so that the locking must
always be done outside the function, same as in all its other usage cases.
This fixes an assert from release PRCB routine, when booting x86 ReactOS
in SMP mode, because it attempts to release the lock when it is not
actually acquired.

Addendum to commit a011d19ed.

+ Add an assert in KxQueueReadyThread() to ensure the PRCB lock is actually acquired.
This commit is contained in:
Oleg Dubinskiy 2024-01-20 15:58:39 +01:00 committed by GitHub
parent f72d6dd4c5
commit ab528ac6ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View file

@ -1359,6 +1359,7 @@ KxQueueReadyThread(IN PKTHREAD Thread,
/* Sanity checks */
ASSERT(Prcb == KeGetCurrentPrcb());
ASSERT(Prcb->PrcbLock != 0);
ASSERT(Thread->State == Running);
ASSERT(Thread->NextProcessor == Prcb->Number);

View file

@ -334,6 +334,9 @@ KiDispatchInterrupt(VOID)
}
else if (Prcb->NextThread)
{
/* Acquire the PRCB lock */
KiAcquirePrcbLock(Prcb);
/* Capture current thread data */
OldThread = Prcb->CurrentThread;
NewThread = Prcb->NextThread;

View file

@ -495,6 +495,9 @@ KiDispatchInterrupt(VOID)
}
else if (Prcb->NextThread)
{
/* Acquire the PRCB lock */
KiAcquirePrcbLock(Prcb);
/* Capture current thread data */
OldThread = Prcb->CurrentThread;
NewThread = Prcb->NextThread;