|
Revision 2011, 2.6 KB
(checked in by mwhitworth, 3 years ago)
|
|
Add cmdLine field, as we now keep a copy of the command line.
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | #ifndef TASK_H |
|---|
| 20 | #define TASK_H |
|---|
| 21 | |
|---|
| 22 | #include <llist.h> |
|---|
| 23 | #include <typedefs.h> |
|---|
| 24 | #include <i386/virtual.h> |
|---|
| 25 | #include <i386/i386.h> |
|---|
| 26 | #include <wait.h> |
|---|
| 27 | |
|---|
| 28 | struct Process; |
|---|
| 29 | struct JournalHandle; |
|---|
| 30 | |
|---|
| 31 | #define THR_USED_MATH 1 |
|---|
| 32 | #define THR_NEED_RESCHED 2 |
|---|
| 33 | |
|---|
| 34 | struct Thread |
|---|
| 35 | { |
|---|
| 36 | volatile DWORD currStack; |
|---|
| 37 | struct Process* parent; |
|---|
| 38 | struct Context* currContext; |
|---|
| 39 | DWORD state,entry,esp3; |
|---|
| 40 | struct ListHead list; |
|---|
| 41 | int quantums, flags, priority, id; |
|---|
| 42 | int preemptCount; |
|---|
| 43 | int refs; |
|---|
| 44 | union FpuSave fpuData; |
|---|
| 45 | unsigned long tlsGdt[2]; |
|---|
| 46 | struct JournalHandle* currHandle; |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | inline static void TlsInstall(struct Thread* thread) |
|---|
| 51 | { |
|---|
| 52 | extern unsigned char* gdt; |
|---|
| 53 | |
|---|
| 54 | memcpy((((unsigned char*)&gdt)+GDT_TLS_OFFSET), thread->tlsGdt, sizeof(unsigned long)*2); |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | #define ThrGetThread(thread) ((thread)->refs++) |
|---|
| 60 | #define ThrReleaseThread(thread) \ |
|---|
| 61 | do { (thread)->refs--; if ((thread)->refs <= 0) ThrFreeThread((thread)); } while(0) |
|---|
| 62 | |
|---|
| 63 | extern struct Thread* idleTask; |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | #define THR_RUNNING 1 |
|---|
| 68 | #define THR_PAUSED 2 |
|---|
| 69 | #define THR_DYING 4 |
|---|
| 70 | |
|---|
| 71 | struct Process |
|---|
| 72 | { |
|---|
| 73 | struct ListHead next,sibling,children; |
|---|
| 74 | int exitCode, state; |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | struct File** files; |
|---|
| 78 | Spinlock fileListLock; |
|---|
| 79 | int numFds; |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | struct VNode *cwd,*root,*exec; |
|---|
| 83 | |
|---|
| 84 | char* name; |
|---|
| 85 | WaitQueue waitQueue; |
|---|
| 86 | char* sCwd; |
|---|
| 87 | DWORD pid; |
|---|
| 88 | int cId; |
|---|
| 89 | struct KeObject object; |
|---|
| 90 | struct ListHead areaList; |
|---|
| 91 | struct MemManager* memManager; |
|---|
| 92 | struct Process* parent; |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | char* cmdLine; |
|---|
| 96 | }; |
|---|
| 97 | |
|---|
| 98 | #define ThrGetProcess(process) (KeObjGet(&process->object)) |
|---|
| 99 | #define ThrPutProcess(process) (KeObjPut(&process->object)) |
|---|
| 100 | |
|---|
| 101 | #endif |
|---|