X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fthreads.h;h=6c29230763d587f37f1c265543e77113ead4644e;hb=2ae2035466cfa7816079a067ccee25e2b8bac6bc;hp=28d669d29eca66c7685db91a1e9482e827bdd9aa;hpb=814b2d0009da73b56c6def5d70a9dd97c7b17e2e;p=tpg%2Facess2.git diff --git a/Kernel/include/threads.h b/Kernel/include/threads.h index 28d669d2..6c292307 100644 --- a/Kernel/include/threads.h +++ b/Kernel/include/threads.h @@ -5,6 +5,7 @@ #include #include +#include typedef struct sMessage { @@ -17,13 +18,11 @@ typedef struct sMessage typedef struct sThread { // --- threads.c's - // 0 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 - // 16 Uint TID; //!< Thread ID Uint TGID; //!< Thread Group (Process) Uint PTID; //!< Parent Thread ID @@ -31,20 +30,16 @@ 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 - // 60 int CurFaultNum; //!< Current fault number, 0: none tVAddr FaultHandler; //!< Fault Handler @@ -55,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; @@ -67,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