Fixes to VM8086 handler to remove operand size errors.
[tpg/acess2.git] / Kernel / include / threads.h
1 /*
2  */
3 #ifndef _THREADS_H_
4 #define _THREADS_H_
5
6 #include <arch.h>
7 #include <signal.h>
8
9 typedef struct sMessage
10 {
11         struct sMessage *Next;
12         Uint    Source;
13         Uint    Length;
14         Uint8   Data[];
15 } tMsg; // sizeof = 12+
16
17 typedef struct sThread
18 {
19         // --- threads.c's
20         //  0
21         struct sThread  *Next;  //!< Next thread in list
22         tSpinlock       IsLocked;       //!< Thread's spinlock
23         volatile int    Status;         //!< Thread Status
24          int    RetStatus;      //!< Return Status
25         
26         // 16
27         Uint    TID;    //!< Thread ID
28         Uint    TGID;   //!< Thread Group (Process)
29         Uint    PTID;   //!< Parent Thread ID
30         Uint    UID, GID;       //!< User and Group
31         char    *ThreadName;    //!< Name of thread
32         
33         // --- arch/proc.c's responsibility
34         // 40
35         //! Kernel Stack Base
36         tVAddr  KernelStack;
37         
38         // 44 (x86)
39         //! Memory Manager State
40         tMemoryState    MemState;
41         
42         // 48 (x86)
43         //! State on task switch
44         tTaskState      SavedState;
45         
46         // --- threads.c's
47         // 60
48          int    CurFaultNum;    //!< Current fault number, 0: none
49         tVAddr  FaultHandler;   //!< Fault Handler
50         
51         tMsg * volatile Messages;       //!< Message Queue
52         tMsg    *LastMessage;   //!< Last Message (speeds up insertion)
53         
54          int    Quantum, Remaining;     //!< Quantum Size and remaining timesteps
55          int    NumTickets;     //!< Priority - Chance of gaining CPU
56         
57         Uint    Config[NUM_CFG_ENTRIES];        //!< Per-process configuration
58 } tThread;
59
60
61 enum {
62         THREAD_STAT_NULL,
63         THREAD_STAT_ACTIVE,
64         THREAD_STAT_SLEEPING,
65         THREAD_STAT_WAITING,
66         THREAD_STAT_ZOMBIE,
67         THREAD_STAT_DEAD
68 };
69
70 // === FUNCTIONS ===
71 extern tThread  *Proc_GetCurThread();
72 extern tThread  *Threads_GetThread(Uint TID);
73 extern void     Threads_Wake(tThread *Thread);
74 extern void     Threads_AddActive(tThread *Thread);
75
76 #endif

UCC git Repository :: git.ucc.asn.au