Kernel - Debugging hard locks
authorJohn Hodge (sonata) <[email protected]>
Wed, 28 Nov 2012 14:26:12 +0000 (22:26 +0800)
committerJohn Hodge (sonata) <[email protected]>
Wed, 28 Nov 2012 14:26:12 +0000 (22:26 +0800)
KernelLand/Kernel/arch/x86/lib.c
KernelLand/Kernel/semaphore.c
KernelLand/Kernel/threads.c

index 6b3d722..1b1a0c3 100644 (file)
@@ -85,6 +85,8 @@ void SHORTLOCK(struct sShortSpinlock *Lock)
        __ASM__ ("pushf;\n\tpop %0" : "=r"(IF));
        IF &= 0x200;    // AND out all but the interrupt flag
        
+       ASSERT( !CPU_HAS_LOCK(Lock) );
+
        #if TRACE_LOCKS
        if( TRACE_LOCK_COND )
        {
index e43547a..2c9fc94 100644 (file)
@@ -127,10 +127,8 @@ int Semaphore_Wait(tSemaphore *Sem, int MaxToTake)
                toWake->RetStatus = given;
                
                // Wake the sleeper
-               SHORTLOCK( &glThreadListLock );
                if( toWake->Status != THREAD_STAT_ACTIVE )
                        Threads_AddActive(toWake);
-               SHORTREL( &glThreadListLock );
        }
        SHORTREL( &Sem->Protector );
        
index 2f76b78..92a7a57 100644 (file)
@@ -765,11 +765,11 @@ int Threads_Wake(tThread *Thread)
                return -EALREADY;
        
        case THREAD_STAT_SLEEPING:
-               SHORTLOCK( &glThreadListLock );
                // Remove from sleeping queue
+               SHORTLOCK( &glThreadListLock );
                Threads_int_DelFromQueue(&gSleepingThreads, Thread);
-               
                SHORTREL( &glThreadListLock );
+               
                Threads_AddActive( Thread );
                
                #if DEBUG_TRACE_STATE

UCC git Repository :: git.ucc.asn.au