X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fthreads.h;h=d138cf01684eccd45f843b89937b359d1a5c15bc;hb=f0ffa8c904a7a99e115e926b4bf59d9749e86334;hp=3b6e9c60441e011fd3409a5e1e89cbda9fa2ec9e;hpb=15999a03acd4083fb2618c92bebbc557813c5084;p=tpg%2Facess2.git diff --git a/Kernel/include/threads.h b/Kernel/include/threads.h index 3b6e9c60..d138cf01 100644 --- a/Kernel/include/threads.h +++ b/Kernel/include/threads.h @@ -7,70 +7,6 @@ #include #include -typedef struct sMessage -{ - struct sMessage *Next; - Uint Source; - Uint Length; - Uint8 Data[]; -} tMsg; // sizeof = 12+ - -typedef struct sThread -{ - // --- threads.c's - /** - * \brief Next thread in current list - * \note Required to be first for linked list hacks to work - */ - struct sThread *Next; - struct sThread *GlobalNext; //!< Next thread in global list - struct sThread *GlobalPrev; //!< Previous thread in global list - tShortSpinlock IsLocked; //!< Thread's spinlock - volatile int Status; //!< Thread Status - int RetStatus; //!< Return Status - - Uint TID; //!< Thread ID - Uint TGID; //!< Thread Group (Process) - struct sThread *Parent; //!< Parent Thread - Uint UID, GID; //!< User and Group - char *ThreadName; //!< Name of thread - - // --- arch/proc.c's responsibility - //! Kernel Stack Base - tVAddr KernelStack; - - //! Memory Manager State - tMemoryState MemState; - - //! State on task switch - tTaskState SavedState; - - // --- threads.c's - int CurFaultNum; //!< Current fault number, 0: none - tVAddr FaultHandler; //!< Fault Handler - - tMsg * volatile Messages; //!< Message Queue - tMsg *LastMessage; //!< Last Message (speeds up insertion) - - int Quantum, Remaining; //!< Quantum Size and remaining timesteps - int NumTickets; //!< Priority - Chance of gaining CPU - - Uint Config[NUM_CFG_ENTRIES]; //!< Per-process configuration - - volatile int CurCPU; -} tThread; - - -enum { - THREAD_STAT_NULL, // Invalid process - THREAD_STAT_ACTIVE, // Running and schedulable process - THREAD_STAT_SLEEPING, // Message Sleep - THREAD_STAT_OFFSLEEP, // Mutex Sleep (or waiting on a thread) - THREAD_STAT_WAITING, // ??? - THREAD_STAT_ZOMBIE, // Died, just not removed - THREAD_STAT_DEAD // Why do we care about these??? -}; - enum eFaultNumbers { FAULT_MISC, @@ -84,11 +20,13 @@ enum eFaultNumbers #define GETMSG_IGNORE ((void*)-1) // === FUNCTIONS === -extern tThread *Proc_GetCurThread(void); -extern tThread *Threads_GetThread(Uint TID); -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); +extern void Threads_SetFaultHandler(Uint Handler); + +extern int Threads_SetUID(Uint *Errno, tUID ID); +extern int Threads_SetGID(Uint *Errno, tUID ID); +extern int Threads_WaitTID(int TID, int *Status); + +extern int Proc_SendMessage(Uint *Err, Uint Dest, int Length, void *Data); +extern int Proc_GetMessage(Uint *Err, Uint *Source, void *Buffer); #endif