X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fthreads.c;h=c0c613297a309f88fa123273f65e9bfc188f4f7d;hb=e6795eb552a6be88b7870dae14a958ab391bfae8;hp=4ab76ff6334f816d982c478bca97d132d84d52e7;hpb=d4e3d74bb9ed79be25604e30231cd64e7091fdc2;p=tpg%2Facess2.git diff --git a/Kernel/threads.c b/Kernel/threads.c index 4ab76ff6..c0c61329 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -9,6 +9,7 @@ #include #include #include +#include // Configuration #define DEBUG_TRACE_TICKETS 0 // Trace ticket counts @@ -34,10 +35,6 @@ const enum eConfigTypes cCONFIG_TYPES[] = { }; // === IMPORTS === -extern void ArchThreads_Init(void); -extern void Proc_CallFaultHandler(tThread *Thread); -extern void Proc_DumpThreadCPUState(tThread *Thread); -extern int GetCPUNum(void); // === PROTOTYPES === void Threads_Init(void); @@ -852,7 +849,8 @@ void Threads_AddActive(tThread *Thread) if( Thread->Status == THREAD_STAT_ACTIVE ) { tThread *cur = Proc_GetCurThread(); - Warning("WTF, CPU%i %p (%i %s) is adding %p (%i %s) when it is active", + Log_Warning("Threads", "WTF, %p CPU%i %p (%i %s) is adding %p (%i %s) when it is active", + __builtin_return_address(0), GetCPUNum(), cur, cur->TID, cur->ThreadName, Thread, Thread->TID, Thread->ThreadName); SHORTREL( &glThreadListLock ); return ; @@ -982,6 +980,7 @@ void Threads_Fault(int Num) // Double Fault? Oh, F**k if(thread->CurFaultNum != 0) { + Log_Warning("Threads", "Threads_Fault: Double fault on %i", thread->TID); Threads_Kill(thread, -1); // For now, just kill HALT(); } @@ -997,7 +996,10 @@ void Threads_Fault(int Num) */ void Threads_SegFault(tVAddr Addr) { - Warning("Thread #%i committed a segfault at address %p", Proc_GetCurThread()->TID, Addr); + tThread *cur = Proc_GetCurThread(); + cur->bInstrTrace = 0; + Log_Warning("Threads", "Thread #%i committed a segfault at address %p", cur->TID, Addr); + MM_DumpTables(0, KERNEL_BASE); Threads_Fault( 1 ); //Threads_Exit( 0, -1 ); } @@ -1291,7 +1293,7 @@ tThread *Threads_GetNextToRun(int CPU, tThread *Last) } // If we fall onto the same queue again, special handling is // needed - if( i == Last->Priority ) { + if( Last && i == Last->Priority ) { tThread *savedThread = thread; // Find the next unscheduled thread in the list