Usermode - Changed install dir to $(DISTROOT)/$(ARCH) for cross-installs
[tpg/acess2.git] / Kernel / threads.c
index fa6f6e0..d5e1b4c 100644 (file)
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <mutex.h>
 #include <semaphore.h>
+#include <hal_proc.h>
 
 // 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,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 ;
@@ -982,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();
        }
@@ -997,7 +995,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 );
 }

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