x86_64 support, requiring a slight refactor to the build system.
[tpg/acess2.git] / Kernel / include / threads.h
index 9c5ebe7..f23c5b5 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <arch.h>
 #include <signal.h>
+#include <proc.h>
 
 typedef struct sMessage
 {
@@ -17,11 +18,13 @@ typedef struct sMessage
 typedef struct sThread
 {
        // --- threads.c's
+       //  0
        struct sThread  *Next;  //!< Next thread in list
        tSpinlock       IsLocked;       //!< Thread's spinlock
-        int    Status;         //!< Thread Status
+       volatile int    Status;         //!< Thread Status
         int    RetStatus;      //!< Return Status
        
+       // 16
        Uint    TID;    //!< Thread ID
        Uint    TGID;   //!< Thread Group (Process)
        Uint    PTID;   //!< Parent Thread ID
@@ -29,19 +32,22 @@ typedef struct sThread
        char    *ThreadName;    //!< Name of thread
        
        // --- arch/proc.c's responsibility
+       // 40
        //! Kernel Stack Base
        tVAddr  KernelStack;
        
+       // 44 (x86)
        //! Memory Manager State
        tMemoryState    MemState;
        
+       // 48 (x86)
        //! State on task switch
        tTaskState      SavedState;
        
        // --- threads.c's
-        int    CurSignal;      //!< Signal currently being handled (0 for none)
-       tVAddr  SignalHandlers[NSIG];   //!< Signal Handler List
-       tTaskState      SignalState;    //!< Saved state for signal handler
+       // 60
+        int    CurFaultNum;    //!< Current fault number, 0: none
+       tVAddr  FaultHandler;   //!< Fault Handler
        
        tMsg * volatile Messages;       //!< Message Queue
        tMsg    *LastMessage;   //!< Last Message (speeds up insertion)
@@ -62,6 +68,18 @@ enum {
        THREAD_STAT_DEAD
 };
 
+enum eFaultNumbers
+{
+       FAULT_MISC,
+       FAULT_PAGE,
+       FAULT_ACCESS,
+       FAULT_DIV0,
+       FAULT_OPCODE,
+       FAULT_FLOAT
+};
+
+#define GETMSG_IGNORE  ((void*)-1)
+
 // === FUNCTIONS ===
 extern tThread *Proc_GetCurThread();
 extern tThread *Threads_GetThread(Uint TID);

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