[6282] | 1 | /* $Id: OS2KTCB.h,v 1.3 2001-07-10 05:22:57 bird Exp $
|
---|
[3829] | 2 | *
|
---|
| 3 | * TCB - Thread Control Block access methods.
|
---|
| 4 | *
|
---|
[4787] | 5 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
[3829] | 6 | *
|
---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 8 | *
|
---|
| 9 | */
|
---|
[6282] | 10 | #ifndef _OS2KTCB_h_
|
---|
| 11 | #define _OS2KTCB_h_
|
---|
[3829] | 12 |
|
---|
| 13 | #ifdef __cplusplus
|
---|
| 14 | extern "C" {
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
[6282] | 17 | /*******************************************************************************
|
---|
| 18 | * Defined Constants And Macros *
|
---|
| 19 | *******************************************************************************/
|
---|
| 20 | /*
|
---|
| 21 | * sg24-4640-00: TCBForcedActions flag definitions:
|
---|
| 22 | */
|
---|
| 23 | #define TK_FF_BUF 0x00000001 /* Buffer must be released */
|
---|
| 24 | #define TK_FF_EXIT 0x00000002 /* Call TKExit (old FF_DES) */
|
---|
| 25 | #define TK_FF_CRITSEC 0x00000004 /* Enter Per-task critical section */
|
---|
| 26 | #define TK_FF_ICE 0x00000008 /* Freeze thread */
|
---|
| 27 | #define TK_FF_NPX 0x00000010 /* NPX Error */
|
---|
| 28 | #define TK_FF_TIB 0x00000020 /* Update the TIB */
|
---|
| 29 | #define TK_FF_TRC 0x00000040 /* Enter Debug */
|
---|
| 30 | #define TK_FF_SIG 0x00000080 /* Signal pending */
|
---|
| 31 | #define TK_FF_CTXH 0x00000100 /* Pending local context hooks */
|
---|
| 32 | #define TK_FF_STIH 0x00000200 /* Execute STI hooks */
|
---|
| 33 | #define TK_FF_VDMBP 0x00000400 /* Execute VDM BP hooks */
|
---|
| 34 | #define TK_FF_RTRY 0x00000800 /* Retry V86 system call */
|
---|
| 35 | #define TK_FF_PIB 0x00001000 /* Update the PIB */
|
---|
| 36 | #define TK_FF_SCH 0x00002000 /* Do Scheuler Processing */
|
---|
| 37 | #define TK_FF_TFBIT 0x00004000 /* Validate user eflags TF bit */
|
---|
| 38 | #define TK_FF_TIBPRI 0x00008000 /* Update only the priority fields in TIB */
|
---|
[3829] | 39 |
|
---|
[6282] | 40 |
|
---|
| 41 | /*
|
---|
| 42 | * sg24-4640-00: TCBEntryActions flag definitions:
|
---|
| 43 | */
|
---|
| 44 | #define TK_EF_PFCLI 1 /* Page fault inside CLI */
|
---|
| 45 | #define TK_EF_TRC 2 /* DosDebug action pending */
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | /*
|
---|
| 49 | * sg24-4640-00: TCBWakeFlags flag definitions:
|
---|
| 50 | */
|
---|
| 51 | #define TK_WF_INTERRUPTED 0x01 /* Sleep was interrupted */
|
---|
| 52 | #define TK_WF_TIMEEXP 0x02 /* Timeout expired */
|
---|
| 53 | #define TK_WF_INTPENDING 0x04 /* Interrupt pending */
|
---|
| 54 | #define TK_WF_SINGLEWAKEUP 0x08 /* Thread wants single wakeup */
|
---|
| 55 | #define TK_WF_INTERRUPTIBLE 0x10 /* Thread blocked interruptibly */
|
---|
| 56 | #define TK_WF_TIMEOUT 0x20 /* Thread blocked with timeout */
|
---|
| 57 | #define TK_WF_SLEEPING 0x40 /* In TKSleep() */
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | * sg24-4640-00: TCBState and TCBQState definitions:
|
---|
| 62 | */
|
---|
| 63 | #define STATE_VOID 0 /* Uninitialized */
|
---|
| 64 | #define STATE_READY 1 /* Ready to run */
|
---|
| 65 | #define STATE_BLOCKED 2 /* Blocked on an ID */
|
---|
| 66 | #define STATE_SUSPENDED 3 /* Suspended (DosSuspendThread) */
|
---|
| 67 | #define STATE_CRITSEC 4 /* Blocked by another CritSec thread */
|
---|
| 68 | #define STATE_RUNNING 5 /* Thread currently running */
|
---|
| 69 | #define STATE_READYBOOST 6 /* Ready, but apply an IO boost */
|
---|
| 70 | #define STATE_TSD 7 /* Thread waiting for TSD */
|
---|
| 71 | #define STATE_DELAYED 8 /* Delayed TKWakeup (Almost Ready) */
|
---|
| 72 | #define STATE_FROZEN 9 /* Frozen Thread (FF_ICE) */
|
---|
| 73 | #define STATE_GETSTACK 10 /* Incomming TSD */
|
---|
| 74 | #define STATE_BADSTACK 11 /* TSD failed to swap in */
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | /*
|
---|
| 78 | * sg24-4640-00: TCBPriClassMod definitions:
|
---|
| 79 | */
|
---|
| 80 | #define CLASSMOD_KEYBOARD 0x04 /* Keyboard boost */
|
---|
| 81 | #define CLASSMOD_STARVED 0x08 /* Starvation boost */
|
---|
| 82 | #define CLASSMOD_DEVICE 0x10 /* Device I/O Done Boost */
|
---|
| 83 | #define CLASSMOD_FOREGROUND 0x20 /* Foreground boost */
|
---|
| 84 | #define CLASSMOD_WINDOW 0x40 /* Window Boost */
|
---|
| 85 | #define CLASSMOD_VDM_INTERRUPT 0x80 /* VDM simulated interrupt boost */
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | * sg24-4640-00: TCBPriClass definitions:
|
---|
| 90 | */
|
---|
| 91 | #define CLASS_NOCHANGE 0x00 /* No priority class change */
|
---|
| 92 | #define CLASS_IDLE_TIME 0x01 /* Idle - Time class */
|
---|
| 93 | #define CLASS_REGULAR 0x02 /* Regular class */
|
---|
| 94 | #define CLASS_TIME_CRITICAL 0x03 /* Time-Critical class */
|
---|
| 95 | #define CLASS_SERVER 0x04 /* Client-Server Server class */
|
---|
| 96 |
|
---|
| 97 |
|
---|
| 98 | /*
|
---|
| 99 | * sg24-4640-00: TCBSchFlg flag definitions:
|
---|
| 100 | */
|
---|
| 101 | #define SCH_PROTECTED_PRI 0x0001 /* Only Intra-process SetPri allowed */
|
---|
| 102 | #define SCH_WINDOWBOOST_LOCK 0x0002 /* Lock out windoboost changes */
|
---|
| 103 | #define SCH_MINSLICE 0x0004 /* Use minimum timeslice */
|
---|
| 104 | #define SCH_PAGE_FAULT 0x0008 /* Dynamic timeslicing ### */
|
---|
| 105 | #define SCH_PAGE_FAULT_BIT 0x03 /* Dynamic timeslicing P728371 */
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | /*
|
---|
| 109 | * sg24-4640-00: TCBfSwapping flag definitions:
|
---|
| 110 | */
|
---|
| 111 | #define SM_TCB_SWAPPING 0x01 /* swap i/o underway */
|
---|
| 112 | #define SM_TCB_RESIZING 0x02 /* data structures are growing */
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | /*
|
---|
| 116 | * sg24-4640-00: TCBMiscFlags flag definitions:
|
---|
| 117 | */
|
---|
| 118 | #define TMF_CMapFailed (0x01) /* Set if alloc/realloc failed on a cluster */
|
---|
| 119 | /* map (mft_selCMap). */
|
---|
| 120 | #define TMF_IGNORE_HE (0x02) /* If set, ignore (auto fail) hard error */
|
---|
| 121 | #define TMF_MULT_XCPT (0x04) /* Set if multiple ring 0 exceptions */
|
---|
| 122 | #define TMF_NoFwd (0x08) /* Set if inhibiting forwarders */
|
---|
| 123 | #define TMF_EXIT_TERM (0x10) /* TK_FF_EXIT means TKTermThread */
|
---|
| 124 | #define TMF_NO_EXCEPT (0x20) /* Indicates TIB exception field invalid */
|
---|
| 125 | #define TMF_XCPT_HE (0x40) /* Indicates an exception harderr is */
|
---|
| 126 | /* pending */
|
---|
| 127 |
|
---|
| 128 |
|
---|
| 129 | /*
|
---|
| 130 | * sg24-4640-00: TCBMSpareFlags flag definitions:
|
---|
| 131 | */
|
---|
| 132 | #define SPFLAGS_FGND_DISKIO 0x0080 /* Foreground Disk I/O */
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 | /*
|
---|
| 136 | * sg24-4640-00: TCBReqPktFlg flag definitions:
|
---|
| 137 | */
|
---|
| 138 | #define TK_RP_ALLOCATED 0x01
|
---|
| 139 | #define TK_RP_INUSE 0x02
|
---|
| 140 |
|
---|
| 141 |
|
---|
| 142 |
|
---|
[3829] | 143 | /*******************************************************************************
|
---|
| 144 | * Structures and Typedefs *
|
---|
| 145 | *******************************************************************************/
|
---|
| 146 | typedef struct _TCB
|
---|
| 147 | {
|
---|
| 148 | char dummy;
|
---|
| 149 | } TCB, *PTCB, **PPTCB;
|
---|
| 150 |
|
---|
| 151 | extern PPTCB ppTCBCur;
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 | /*******************************************************************************
|
---|
| 155 | * Defined Constants And Macros *
|
---|
| 156 | *******************************************************************************/
|
---|
| 157 |
|
---|
| 158 | /**
|
---|
| 159 | * Gets pointer to the current TCB.
|
---|
| 160 | * @returns Pointer to the current thread control block (TCB).
|
---|
| 161 | * NULL if not task-time.
|
---|
| 162 | */
|
---|
| 163 | #define tcbGetCur() *ppTCBCur
|
---|
| 164 |
|
---|
| 165 |
|
---|
| 166 | USHORT tcbGetTCBFailErr(PTCB pTCB);
|
---|
| 167 | USHORT tcbSetTCBFailErr(PTCB pTCB, USHORT TCBFailErr);
|
---|
| 168 |
|
---|
| 169 |
|
---|
| 170 |
|
---|
| 171 | #ifdef __cplusplus
|
---|
| 172 | }
|
---|
| 173 | #endif
|
---|
| 174 |
|
---|
| 175 | #endif
|
---|