From: John Hodge Date: Sun, 28 Aug 2011 04:04:36 +0000 (+0800) Subject: Kernel - Improved debug in threads.c X-Git-Tag: rel0.11~117 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=9140dcec545feefd5d5c3c874fce42b2668c46f6;p=tpg%2Facess2.git Kernel - Improved debug in threads.c --- diff --git a/Kernel/include/hal_proc.h b/Kernel/include/hal_proc.h index 8a4e052d..242af204 100644 --- a/Kernel/include/hal_proc.h +++ b/Kernel/include/hal_proc.h @@ -21,5 +21,7 @@ extern void Proc_DumpThreadCPUState(tThread *Thread); extern tPAddr MM_ClearUser(void); +extern void MM_DumpTables(tVAddr Start, tVAddr End); + #endif diff --git a/Kernel/threads.c b/Kernel/threads.c index 4a2ccf4c..d5e1b4c3 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -849,7 +849,7 @@ 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, CPU%i %p (%i %s) is adding %p (%i %s) when it is active", GetCPUNum(), cur, cur->TID, cur->ThreadName, Thread, Thread->TID, Thread->ThreadName); SHORTREL( &glThreadListLock ); return ; @@ -979,6 +979,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(); } @@ -988,16 +989,16 @@ void Threads_Fault(int Num) Proc_CallFaultHandler(thread); } -extern void MM_DumpTables(tVAddr Start, tVAddr End); - /** * \fn void Threads_SegFault(tVAddr Addr) * \brief Called when a Segment Fault occurs */ void Threads_SegFault(tVAddr Addr) { - Log_Warning("Threads", "Thread #%i committed a segfault at address %p", Proc_GetCurThread()->TID, Addr); - MM_DumpTables(0, 0xC0000000); + 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 ); }