10 typedef struct sMessage
12 struct sMessage *Next;
16 } tMsg; // sizeof = 12+
18 typedef struct sThread
22 * \brief Next thread in current list
23 * \note Required to be first for linked list hacks to work
26 struct sThread *GlobalNext; //!< Next thread in global list
27 struct sThread *GlobalPrev; //!< Previous thread in global list
28 tShortSpinlock IsLocked; //!< Thread's spinlock
29 volatile int Status; //!< Thread Status
30 int RetStatus; //!< Return Status
32 Uint TID; //!< Thread ID
33 Uint TGID; //!< Thread Group (Process)
34 struct sThread *Parent; //!< Parent Thread
35 Uint UID, GID; //!< User and Group
36 char *ThreadName; //!< Name of thread
38 // --- arch/proc.c's responsibility
42 //! Memory Manager State
43 tMemoryState MemState;
45 //! State on task switch
46 tTaskState SavedState;
49 int CurFaultNum; //!< Current fault number, 0: none
50 tVAddr FaultHandler; //!< Fault Handler
52 tMsg * volatile Messages; //!< Message Queue
53 tMsg *LastMessage; //!< Last Message (speeds up insertion)
55 int Quantum, Remaining; //!< Quantum Size and remaining timesteps
56 int NumTickets; //!< Priority - Chance of gaining CPU
58 Uint Config[NUM_CFG_ENTRIES]; //!< Per-process configuration
65 THREAD_STAT_NULL, // Invalid process
66 THREAD_STAT_ACTIVE, // Running and schedulable process
67 THREAD_STAT_SLEEPING, // Message Sleep
68 THREAD_STAT_OFFSLEEP, // Mutex Sleep (or waiting on a thread)
69 THREAD_STAT_WAITING, // ???
70 THREAD_STAT_ZOMBIE, // Died, just not removed
71 THREAD_STAT_DEAD // Why do we care about these???
84 #define GETMSG_IGNORE ((void*)-1)
87 extern tThread *Proc_GetCurThread(void);
88 extern tThread *Threads_GetThread(Uint TID);
89 extern void Threads_SetTickets(tThread *Thread, int Num);
90 extern int Threads_Wake(tThread *Thread);
91 extern void Threads_AddActive(tThread *Thread);
92 extern tThread *Threads_GetNextToRun(int CPU, tThread *Last);