X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fthreads.h;h=e9cab73007b6b3a8184752d8aa61e33546c4eaa5;hb=1b9e4d77864462dc119a2acd31002fc16456b671;hp=9c5ebe75467aeb1b5b9ef3c8ee8eb89bf7a6d976;hpb=243bdab4e7acc8516d9b1c138f45dc1195f97767;p=tpg%2Facess2.git diff --git a/Kernel/include/threads.h b/Kernel/include/threads.h index 9c5ebe75..e9cab730 100644 --- a/Kernel/include/threads.h +++ b/Kernel/include/threads.h @@ -5,6 +5,7 @@ #include #include +#include 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,8 +68,20 @@ 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 *Proc_GetCurThread(void); extern tThread *Threads_GetThread(Uint TID); extern void Threads_Wake(tThread *Thread); extern void Threads_AddActive(tThread *Thread);