Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
7.4 KiB

  1. //-----------------------------------------------------------------------
  2. //
  3. // TDBX.H - TDBX data structure definition
  4. //
  5. //-----------------------------------------------------------------------
  6. // File Description:
  7. // Provides a definition of the TDBX data structure which is a
  8. // non-pageable data structure used for storage of thread specific
  9. // data which must be accessed from ring 0 at event or thread switch
  10. // time.
  11. //
  12. //-----------------------------------------------------------------------
  13. // Revision History:
  14. // 5/21/93 - created (miketout)
  15. //
  16. //-----------------------------------------------------------------------
  17. /* XLATOFF */
  18. #pragma pack(1)
  19. /* XLATON */
  20. #define MEOW_BOP_STACK_SIZE (48*1024)
  21. #define MEOW_BOP_STACK_FILL 0x5A
  22. typedef struct WNLST {
  23. struct _wnod *wnlst_pwnCirc; // 1 node in circular wait node list
  24. DWORD wnlst_flFlags; // wait flags for any or all, etc.
  25. } WNLST;
  26. typedef struct TDBX {
  27. #ifdef WOW
  28. BYTE tdbxType;
  29. BYTE tdbxUnused;
  30. WORD tdbxCntUses; // Ref count
  31. #else // WOW
  32. DWORD tdbxCntUses; // Ref count
  33. #endif // else WOW
  34. WNLST tdbxWaitNodeList; // wait node list
  35. DWORD tdbxR0ThreadHandle; // ring 0 thread handle
  36. DWORD tdbxContextHandle; // ring 0 memory context handle
  37. DWORD tdbxProcessHandle; // ring 3 process handle
  38. #ifdef WOW
  39. struct _tdb *tdbxThreadHandle; // ring 3 thread handle
  40. #else // WOW
  41. DWORD tdbxThreadHandle; // ring 3 thread handle
  42. #endif // else WOW
  43. DWORD tdbxMustCpltCount; // nested must-complete count
  44. DWORD tdbxSuspendHandle; // suspend apc handle
  45. DWORD tdbxSuspendCount; // nested suspend count
  46. #ifdef WOW
  47. LONG tdbxBlockState; // -1 = blkd, 0 = norm, 1 = wake pending
  48. HANDLE tdbxBlockHandle; // handle to thread's private semaphore
  49. #else // WOW
  50. DWORD tdbxBlockState; // -1 = blkd, 0 = norm, 1 = wake pending
  51. DWORD tdbxBlockHandle; // handle to thread's private semaphore
  52. #endif // else WOW
  53. DWORD tdbxWakeParam; // caller defined wakeup parameter
  54. DWORD tdbxTimeOutHandle; // handle from Set_Global_Time_Out
  55. DWORD tdbxCreateDestroyData; // create/destroy parameter
  56. KERNELAPCREC tdbxkernelapcrec; // apc record for terminate and freeze
  57. volatile DWORD tdbxBlockedOnID; // if the thread is blocked on id
  58. DWORD tdbxpPMPSPSelector; // ptr to TCB_PMPSPSelector field in TCB
  59. DWORD tdbxKernAPCList; // pointer to first kernel APC
  60. #ifdef WOW
  61. struct _userapcrec *tdbxUserAPCList; // pointer to first user APC in list
  62. #else // WOW
  63. DWORD tdbxUserAPCList; // pointer to first user APC in list
  64. #endif // else WOW
  65. DWORD tdbxQueuedSyncAPCs; // waiting till out of nested Wait()
  66. DWORD tdbxSyncWaitCount; // nested Wait() count
  67. volatile DWORD tdbxWaitExFlags; // bit mask used for alertable waits
  68. DWORD tdbxTraceEventHandle; // trace out event handle
  69. DWORD tdbxTraceCallBack; // trace out call back function
  70. DWORD tdbxTraceRefData; // trace out reference data
  71. WORD tdbxDosPDBSeg; // DOS PDB segment value for this thread
  72. WORD tdbxK16Task; // actual sel for K16 TDB of this TDB
  73. DWORD tdbxDR7; // debug registers
  74. DWORD tdbxDR6;
  75. DWORD tdbxDR3;
  76. DWORD tdbxDR2;
  77. DWORD tdbxDR1;
  78. DWORD tdbxDR0;
  79. #ifdef SYSLEVELCHECK
  80. LONG tdbxLvlCounts[SL_TOTAL]; // to keep track of CRST level
  81. LPLCRST tdbxOwnedCrsts[SL_TOTAL]; // ptrs to crit sections owned
  82. #endif
  83. WORD tdbxTraceOutLastCS; // trace out last CS
  84. WORD tdbxK16PDB; // selector for PDB
  85. BYTE tdbxExceptionCount; // number of nested exceptions
  86. BYTE tdbxSavedIrql; // irql saved by VWIN32_SaveIrql
  87. BYTE tdbxSavedIrqlCount; // INIT <-1>
  88. #ifdef WOW
  89. BYTE tdbxAlign;
  90. struct TDBX *tdbxNext;
  91. HANDLE tdbxNTThreadHandle;
  92. HANDLE tdbxVxDBlockOnIDEvent;
  93. DWORD tdbxVxDBlockOnIDID;
  94. WORD tdbxCurrentPSP;
  95. WORD tdbxAlign2;
  96. DWORD tdbxVxDMutexTry;
  97. DWORD tdbxVxDMutexGrant;
  98. #endif // def WOW
  99. } TDBX;
  100. typedef struct TDBX *PTDBX;
  101. // bit numbers of flags in tdbxWaitExFlags
  102. #define TDBX_WAITEXBIT 0 // wait includes APCs
  103. #define TDBX_WAITEXBIT_MASK (1 << TDBX_WAITEXBIT)
  104. #define TDBX_WAITACKBIT 1 // set once during wake
  105. #define TDBX_WAITACKBIT_MASK (1 << TDBX_WAITACKBIT)
  106. #define TDBX_SUSPEND_APC_PENDING 2 // kernel mode APC pending
  107. #define TDBX_SUSPEND_APC_PENDING_MASK (1 << TDBX_SUSPEND_APC_PENDING)
  108. #define TDBX_SUSPEND_TERMINATED 3 // thread has resumed
  109. #define TDBX_SUSPEND_TERMINATED_MASK (1 << TDBX_SUSPEND_TERMINATED)
  110. #define TDBX_BLOCKED_FOR_TERMINATION 4 // thread is blocked for term
  111. #define TDBX_BLOCKED_FOR_TERMINATION_MASK (1 << TDBX_BLOCKED_FOR_TERMINATION)
  112. #define TDBX_EMULATE_NPX 5 // thread is using FP emulator
  113. #define TDBX_EMULATE_NPX_MASK (1 << TDBX_EMULATE_NPX)
  114. #define TDBX_WIN32_NPX 6 // thread uses Win32 FP model
  115. #define TDBX_WIN32_NPX_MASK (1 << TDBX_WIN32_NPX)
  116. #define TDBX_EXTENDED_HANDLES 7 // uses extended file handles
  117. #define TDBX_EXTENDED_HANDLES_MASK (1 << TDBX_EXTENDED_HANDLES)
  118. #define TDBX_FROZEN 8 // thread is frozen
  119. #define TDBX_FROZEN_MASK (1 << TDBX_FROZEN)
  120. #define TDBX_DONT_FREEZE 9 // don't frozen the thread
  121. #define TDBX_DONT_FREEZE_MASK (1 << TDBX_DONT_FREEZE)
  122. #define TDBX_DONT_UNFREEZE 10 // keep the thread frozen
  123. #define TDBX_DONT_UNFREEZE_MASK (1 << TDBX_DONT_UNFREEZE)
  124. #define TDBX_DONT_TRACE 11 // don't trace the thread
  125. #define TDBX_DONT_TRACE_MASK (1 << TDBX_DONT_TRACE)
  126. #define TDBX_STOP_TRACING 12 // stop tracing the thread
  127. #define TDBX_STOP_TRACING_MASK (1 << TDBX_STOP_TRACING)
  128. #define TDBX_WAITING_FOR_CRST_SAFE 13 // waiting thread to get safe
  129. #define TDBX_WAITING_FOR_CRST_SAFE_MASK (1 << TDBX_WAITING_FOR_CRST_SAFE)
  130. #define TDBX_CRST_SAFE 14 // we know this thread is safe
  131. #define TDBX_CRST_SAFE_MASK (1 << TDBX_CRST_SAFE)
  132. #define TDBX_WTUSROWNMTX 15 // thread waited in user with VxD Mutex Owned
  133. #define TDBX_WTUSROWNMTX_MASK (1 << TDBX_WTUSROWNMTX)
  134. #define TDBX_THREAD_NOT_INIT 17 // thread init not complete
  135. #define TDBX_THREAD_NOT_INIT_MASK (1 << TDBX_THREAD_NOT_INIT)
  136. #define TDBX_BLOCK_TERMINATE_APC 18
  137. #define TDBX_BLOCK_TERMINATE_APC_MASK (1 << TDBX_BLOCK_TERMINATE_APC)
  138. #define TDBX_TERMINATING 19
  139. #define TDBX_TERMINATING_MASK (1 << TDBX_TERMINATING)
  140. // Special block ids (added to tdbx address)
  141. #define TDBX_BLOCK_TERMINATE_APC_ID 0x00569595
  142. #define TDBX_BLOCKED_FOR_TERMINATION_ID 0x00289816
  143. // Equates for thread priority boosting by ring 3 code
  144. #define HIGH_PRI_DEVICE_BOOST 0x00001000
  145. #define LOW_PRI_DEVICE_BOOST 0x00000010
  146. #define KERNEL_EXIT_PRI_BOOST 8
  147. /* XLATOFF */
  148. #pragma pack()
  149. /* XLATON */