X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fthreads.h;h=6c29230763d587f37f1c265543e77113ead4644e;hb=7d881c2e5fef91a6570e46ef69a5d4a5cf0e8b4d;hp=b55fe0e066a8498afadcc9c8a263d3c5be9ea13d;hpb=775bf8013abe9fe4ef3d4883ea2e43bba2a84da1;p=tpg%2Facess2.git diff --git a/Kernel/include/threads.h b/Kernel/include/threads.h index b55fe0e0..6c292307 100644 --- a/Kernel/include/threads.h +++ b/Kernel/include/threads.h @@ -5,6 +5,7 @@ #include #include +#include typedef struct sMessage { @@ -18,7 +19,7 @@ typedef struct sThread { // --- threads.c's struct sThread *Next; //!< Next thread in list - tSpinlock IsLocked; //!< Thread's spinlock + tShortSpinlock IsLocked; //!< Thread's spinlock volatile int Status; //!< Thread Status int RetStatus; //!< Return Status @@ -39,9 +40,8 @@ typedef struct sThread 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 + int CurFaultNum; //!< Current fault number, 0: none + tVAddr FaultHandler; //!< Fault Handler tMsg * volatile Messages; //!< Message Queue tMsg *LastMessage; //!< Last Message (speeds up insertion) @@ -50,6 +50,8 @@ typedef struct sThread int NumTickets; //!< Priority - Chance of gaining CPU Uint Config[NUM_CFG_ENTRIES]; //!< Per-process configuration + + volatile int CurCPU; } tThread; @@ -62,10 +64,24 @@ 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_SetTickets(tThread *Thread, int Num); +extern int Threads_Wake(tThread *Thread); extern void Threads_AddActive(tThread *Thread); +extern tThread *Threads_GetNextToRun(int CPU, tThread *Last); #endif