WIP add a bunch of ASSERTs

This commit is contained in:
Timo Kreuzer 2024-03-06 18:33:09 +01:00
parent bcbc2c8700
commit 8c66cce23c

View file

@ -328,6 +328,7 @@ KiDeferredReadyThread(IN PKTHREAD Thread)
{
/* Sanity check */
ASSERT(NextThread->State == Standby);
ASSERT(NextThread != KeGetCurrentThread());
/* Check if priority changed */
if (OldPriority > NextThread->Priority)
@ -358,6 +359,7 @@ KiDeferredReadyThread(IN PKTHREAD Thread)
/* Set the thread on standby and as the next thread */
Thread->State = Standby;
ASSERT(Prcb->NextThread != Thread);
Prcb->NextThread = Thread;
/* Release the lock */
@ -441,6 +443,9 @@ KiSwapThread(IN PKTHREAD CurrentThread,
NextThread = Prcb->NextThread;
if (NextThread)
{
ASSERT(NextThread->State == Standby);
ASSERT(NextThread != CurrentThread);
/* Already got a thread, set it up */
Prcb->NextThread = NULL;
Prcb->CurrentThread = NextThread;
@ -452,6 +457,10 @@ KiSwapThread(IN PKTHREAD CurrentThread,
NextThread = KiSelectReadyThread(0, Prcb);
if (NextThread)
{
#ifndef CONFIG_SMP
ASSERT(NextThread != CurrentThread);
#endif
/* Switch to it */
Prcb->CurrentThread = NextThread;
NextThread->State = Running;
@ -463,6 +472,7 @@ KiSwapThread(IN PKTHREAD CurrentThread,
/* Schedule the idle thread */
NextThread = Prcb->IdleThread;
ASSERT(NextThread != CurrentThread);
Prcb->CurrentThread = NextThread;
NextThread->State = Running;
}