Leaked source code of windows server 2003
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.

235 lines
6.2 KiB

  1. ;
  2. ; Task Data Block
  3. ;
  4. ; Contains all task specific data.
  5. ;
  6. ;
  7. ; The following macros allow saving and restoring hardware interrupt
  8. ; vectors inline.
  9. numTaskInts = 0
  10. ?hinum = 0
  11. ?higen macro x,i,r,t
  12. if r LE 3
  13. ?hisav&x &macro
  14. ife t
  15. mov si,4*i
  16. else
  17. mov si,i
  18. endif
  19. rept 2*r
  20. movsw
  21. endm
  22. &endm
  23. ?hires&x &macro
  24. ife t
  25. mov di,4*i
  26. else
  27. mov di,i
  28. endif
  29. rept 2*r
  30. movsw
  31. endm
  32. &endm
  33. else
  34. ?hisav&x &macro
  35. ife t
  36. mov si,4*i
  37. else
  38. mov si,i
  39. endif
  40. mov cx,2*r
  41. rep movsw
  42. &endm
  43. ?hires&x &macro
  44. ife t
  45. mov di,4*i
  46. else
  47. mov di,i
  48. endif
  49. mov cx,2*r
  50. rep movsw
  51. &endm
  52. endif
  53. endm
  54. DefTaskIntGroup macro i,r,t
  55. ?higen %?hinum,i,r,t
  56. ?hinum = ?hinum + 1
  57. numTaskInts = numTaskInts + r
  58. endm
  59. ?hiexp macro n,x
  60. n&x
  61. endm
  62. SaveTaskInts macro destination
  63. mov es,destination
  64. xor ax,ax
  65. mov ds,ax
  66. mov di,TDB_INTVECS
  67. ?hicnt = 0
  68. rept ?hinum
  69. ?hiexp &?hisav,%?hicnt
  70. ?hicnt = ?hicnt + 1
  71. endm
  72. endm
  73. RestTaskInts macro source
  74. mov ds,source
  75. mov si,TDB_INTVECS
  76. xor ax,ax
  77. mov es,ax
  78. ?hicnt = 0
  79. rept ?hinum
  80. ?hiexp &?hires,%?hicnt
  81. ?hicnt = ?hicnt + 1
  82. endm
  83. endm
  84. ; Define the hardware interrupts we will keep on a task specific basis.
  85. ; We only save on a per task basis those interrupts related to arithmetic.
  86. ; So we save 0, 2, 4, 6, 7, 10h, 3Eh, and 75h.
  87. ; Int 0 is divide by 0
  88. ; Int 2 is Coprocessor Error
  89. ; Int 4 is overflow
  90. ; Int 6 is invalid op-code
  91. ; Int 7 is no coprocessor,
  92. ; Int 3Eh is use by the C compiler for 8087 emulation.
  93. ; Int 75h is use by the C compiler for 8087 emulation.
  94. ; In Windows 1.03 we saved 0h, 1h, 2h, 3Eh.
  95. ; For DOS5 compatibility we should save 0, 4, 6, and 7.
  96. DefTaskIntGroup (00h),1,0
  97. DefTaskIntGroup (02h),1,0
  98. DefTaskIntGroup (04h),1,0
  99. DefTaskIntGroup (06h),2,0
  100. DefTaskIntGroup (3Eh),1,0
  101. DefTaskIntGroup (75h),1,0
  102. ifdef WOW
  103. include tdb16.inc
  104. else ; original TDB
  105. THUNKELEM EQU 8 ; (62*8) = 512-16 (low arena overhead)
  106. THUNKSIZE EQU 8
  107. ; Task data structure
  108. ;
  109. ; DON'T YOU DARE CHANGE ANYTHING IN HERE
  110. ; OR RAOR WILL KILL YOU
  111. ; OLE DEPENDS ON THIS 3/25/91
  112. ;
  113. TDB STRUC
  114. TDB_next DW ? ; next task in dispatch queue
  115. TDB_taskSP DW ? ; Saved SS:SP for this task
  116. TDB_taskSS DW ? ;
  117. TDB_nEvents DW ? ; Task event counter
  118. TDB_priority DB ? ; Task priority (0 is highest)
  119. TDB_thread_ordinal DB ? ; ordinal number of this thread
  120. TDB_thread_next DW ? ; next thread
  121. TDB_thread_tdb DW ? ; the real TDB for this task
  122. TDB_thread_list DW ? ; list of allocated thread structures
  123. TDB_thread_free DW ? ; free list of availble thread structures
  124. TDB_thread_count DW ? ; total count of tread structures
  125. TDB_FCW DW ? ; Floating point control word
  126. TDB_flags DB ? ; Task flags
  127. TDB_filler DB ? ; keep word aligned
  128. TDB_ErrMode DW ? ; Error mode for this task
  129. TDB_ExpWinVer DW ? ; Expected Windows version for this task
  130. TDB_Module DW ? ; Task module handle to free in killtask
  131. TDB_pModule DW ? ; Pointer to the module database.
  132. TDB_Queue DW ? ; Task Event Queue pointer
  133. TDB_Parent DW ? ; TDB of the task that started this up
  134. TDB_SigAction DW ? ; Action for app task signal
  135. TDB_ASignalProc DD ? ; App's Task Signal procedure address
  136. TDB_USignalProc DD ? ; User's Task Signal procedure address
  137. TDB_GNotifyProc DD ? ; Task global discard notify proc.
  138. TDB_INTVECS DD numTaskInts DUP (?) ; Task specfic hardware interrupts
  139. if 0
  140. ; EMS fields are OBSOLETE!
  141. TDB_LIMSave DW ? ; Offset within TDB of LIM save area
  142. TDB_EMSPID DW ? ; EMS PID for this task
  143. TDB_EEMSSave DD ? ; LPTR to EEMS save area (in a TDB)
  144. TDB_EMSBCnt DW ? ; number of EMS banks allocated so far
  145. TDB_EMSMaxBCnt DW ? ; Maximum # banks this task wants.
  146. TDB_EMSRegSet DB ? ; The register set this TDB lives in.
  147. else
  148. TDB_CompatFlags DW ? ; Compatibility flags
  149. TDB_CompatFlags2 DW ? ; Upper 16 bits
  150. DB 9 DUP (?) ; Filler to keep TDB size unchanged
  151. endif
  152. TDB_cLibrary DB ? ; tracks add/del of ALL libs in system EMS
  153. TDB_PHT DD ? ; (HANDLE:OFFSET) to private handle table
  154. TDB_PDB DW ? ; MSDOS Process Data Block (PDB)
  155. TDB_DTA DD ? ; MSDOS Disk Transfer Address
  156. TDB_Drive DB ? ; MSDOS current drive
  157. TDB_Directory DB 65 DUP (?) ; MSDOS current directory
  158. TDB_Validity DW ? ; initial AX to be passed to a task
  159. TDB_Yield_to DW ? ; DirectedYield arg stored here
  160. TDB_LibInitSeg DW ? ; segment address of libraries to init
  161. TDB_LibInitOff DW ?
  162. ; MakeProcInstance thunks live here.
  163. TDB_MPI_Sel DW ? ; Code selector for thunks
  164. TDB_MPI_Thunks DW ((THUNKELEM*THUNKSIZE)/2) dup (?)
  165. TDB_ModName DB 8 DUP (?) ; Name of Module.
  166. TDB_sig DW ? ; Signature word to detect bogus code
  167. TDB ENDS
  168. endif ; original TDB_
  169. TDBsize = SIZE TDB
  170. ; signature word used to check validity of a TDB
  171. TDB_SIGNATURE equ 'DT'
  172. ; TDB flags
  173. TDBF_WINOLDAP EQU 01h ; This app is WinOldAp.
  174. TDBF_EMSSHARE EQU 02h ; This app shares EMS banks with MSDOS EXEC.
  175. TDBF_CACHECHECK EQU 04h ; Used in CacheCompact to prevent revisitation.
  176. TDBF_OS2APP EQU 08h ; This is an OS/2 app.
  177. TDBF_WIN32S EQU 10h ; This is Win32S app.
  178. Task_Regs struc
  179. Task_DX dw ?
  180. Task_BX dw ?
  181. Task_ES dw ?
  182. Task_CX dw ?
  183. Task_AX dw ?
  184. Task_DI dw ?
  185. Task_SI dw ?
  186. Task_DS dw ?
  187. Task_BP dw ?
  188. Task_IP dw ?
  189. Task_CS dw ?
  190. Task_Regs ends