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.

1008 lines
29 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. genxx.inc
  5. Abstract:
  6. This file contains common code to generate assembler definitions.
  7. Author:
  8. David N. Cutler (davec) 9-Aug-1995
  9. Revision History:
  10. Forrest C. Foltz (forrestf) 26-Jan-1998
  11. Modified for use with genxx.exe utility
  12. --*/
  13. //
  14. // Size of a pointer in bytes.
  15. //
  16. genCom("Pointer size in bytes")
  17. genVal(SizeofPointer, sizeof(PVOID))
  18. //
  19. // Process state enumerated type definitions.
  20. //
  21. genCom("Process State Enumerated Type Values")
  22. genVal(ProcessInMemory, ProcessInMemory)
  23. genVal(ProcessOutOfMemory, ProcessOutOfMemory)
  24. genVal(ProcessInTransition, ProcessInTransition)
  25. //
  26. // Thread state enumerated type definitions.
  27. //
  28. genCom("Thread State Enumerated Type Values")
  29. genVal(Initialized, Initialized)
  30. genVal(Ready, Ready)
  31. genVal(Running, Running)
  32. genVal(Standby, Standby)
  33. genVal(Terminated, Terminated)
  34. genVal(Waiting, Waiting)
  35. //
  36. // Wait reason and wait type enumerated type definitions.
  37. //
  38. EnableInc(HAL)
  39. genCom("Wait Reason and Wait Type Enumerated Type Values")
  40. genVal(WrExecutive, Executive)
  41. DisableInc(HAL)
  42. genVal(WrMutex, WrMutex)
  43. genVal(WrDispatchInt, WrDispatchInt)
  44. genVal(WrQuantumEnd, WrQuantumEnd)
  45. genVal(WrEventPair, WrEventPair)
  46. genVal(WaitAny, WaitAny)
  47. genVal(WaitAll, WaitAll)
  48. //
  49. // APC state structure offset definitions.
  50. //
  51. genCom("Apc State Structure Offset Definitions")
  52. genDef(As, KAPC_STATE, ApcListHead)
  53. EnableInc(HAL)
  54. genDef(As, KAPC_STATE, Process)
  55. DisableInc(HAL)
  56. genDef(As, KAPC_STATE, KernelApcInProgress)
  57. genDef(As, KAPC_STATE, KernelApcPending)
  58. genDef(As, KAPC_STATE, UserApcPending)
  59. //
  60. // Bug check code definitions
  61. //
  62. EnableInc(HAL)
  63. genCom("Bug Check Code Definitions")
  64. genVal(APC_INDEX_MISMATCH, APC_INDEX_MISMATCH)
  65. genVal(ATTEMPTED_SWITCH_FROM_DPC, ATTEMPTED_SWITCH_FROM_DPC)
  66. genVal(DATA_BUS_ERROR, DATA_BUS_ERROR)
  67. genVal(DATA_COHERENCY_EXCEPTION, DATA_COHERENCY_EXCEPTION)
  68. genVal(HAL1_INITIALIZATION_FAILED, HAL1_INITIALIZATION_FAILED)
  69. genVal(INSTRUCTION_BUS_ERROR, INSTRUCTION_BUS_ERROR)
  70. genVal(INSTRUCTION_COHERENCY_EXCEPTION, INSTRUCTION_COHERENCY_EXCEPTION)
  71. genVal(INTERRUPT_EXCEPTION_NOT_HANDLED, INTERRUPT_EXCEPTION_NOT_HANDLED)
  72. genVal(INTERRUPT_UNWIND_ATTEMPTED, INTERRUPT_UNWIND_ATTEMPTED)
  73. genVal(INVALID_AFFINITY_SET, INVALID_AFFINITY_SET)
  74. genVal(INVALID_DATA_ACCESS_TRAP, INVALID_DATA_ACCESS_TRAP)
  75. genVal(IRQL_GT_ZERO_AT_SYSTEM_SERVICE, IRQL_GT_ZERO_AT_SYSTEM_SERVICE)
  76. genVal(IRQL_NOT_LESS_OR_EQUAL, IRQL_NOT_LESS_OR_EQUAL)
  77. genVal(KMODE_EXCEPTION_NOT_HANDLED, KMODE_EXCEPTION_NOT_HANDLED)
  78. genVal(NMI_HARDWARE_FAILURE, NMI_HARDWARE_FAILURE)
  79. genVal(NO_USER_MODE_CONTEXT, NO_USER_MODE_CONTEXT)
  80. genVal(PAGE_FAULT_WITH_INTERRUPTS_OFF, PAGE_FAULT_WITH_INTERRUPTS_OFF)
  81. genVal(PANIC_STACK_SWITCH, PANIC_STACK_SWITCH)
  82. genVal(SPIN_LOCK_INIT_FAILURE, SPIN_LOCK_INIT_FAILURE)
  83. genVal(SYSTEM_EXIT_OWNED_MUTEX, SYSTEM_EXIT_OWNED_MUTEX)
  84. genVal(SYSTEM_SERVICE_EXCEPTION, SYSTEM_SERVICE_EXCEPTION)
  85. genVal(SYSTEM_UNWIND_PREVIOUS_USER, SYSTEM_UNWIND_PREVIOUS_USER)
  86. genVal(TRAP_CAUSE_UNKNOWN, TRAP_CAUSE_UNKNOWN)
  87. genVal(UNEXPECTED_KERNEL_MODE_TRAP, UNEXPECTED_KERNEL_MODE_TRAP)
  88. genVal(HARDWARE_INTERRUPT_STORM, HARDWARE_INTERRUPT_STORM)
  89. genVal(RECURSIVE_MACHINE_CHECK, RECURSIVE_MACHINE_CHECK)
  90. DisableInc(HAL)
  91. //
  92. // Breakpoint types
  93. //
  94. EnableInc(HAL)
  95. genCom("Breakpoint type definitions")
  96. genVal(DBG_STATUS_CONTROL_C, DBG_STATUS_CONTROL_C)
  97. DisableInc(HAL)
  98. //
  99. // Client Id structure offset definitions.
  100. //
  101. genCom("Client Id Structure Offset Definitions")
  102. genDef(Cid, CLIENT_ID, UniqueProcess)
  103. genDef(Cid, CLIENT_ID, UniqueThread)
  104. //
  105. // Critical section structure offset definitions.
  106. //
  107. genCom("Critical Section Structure Offset Definitions")
  108. genDef(Cs, RTL_CRITICAL_SECTION, DebugInfo)
  109. genDef(Cs, RTL_CRITICAL_SECTION, LockCount)
  110. genDef(Cs, RTL_CRITICAL_SECTION, RecursionCount)
  111. genDef(Cs, RTL_CRITICAL_SECTION, OwningThread)
  112. genDef(Cs, RTL_CRITICAL_SECTION, LockSemaphore)
  113. genDef(Cs, RTL_CRITICAL_SECTION, SpinCount)
  114. //
  115. // Critical section debug information structure offset definitions.
  116. //
  117. genCom("Critical Section Debug Information Structure Offset Definitions")
  118. genDef(Cs, RTL_CRITICAL_SECTION_DEBUG, Type)
  119. genDef(Cs, RTL_CRITICAL_SECTION_DEBUG, CreatorBackTraceIndex)
  120. genDef(Cs, RTL_CRITICAL_SECTION_DEBUG, CriticalSection)
  121. genDef(Cs, RTL_CRITICAL_SECTION_DEBUG, ProcessLocksList)
  122. genDef(Cs, RTL_CRITICAL_SECTION_DEBUG, EntryCount)
  123. genDef(Cs, RTL_CRITICAL_SECTION_DEBUG, ContentionCount)
  124. //
  125. // Exception record offset, flag, and enumerated type definitions.
  126. //
  127. EnableInc(HAL)
  128. genCom("Exception Record Offset, Flag, and Enumerated Type Definitions")
  129. genVal(EXCEPTION_NONCONTINUABLE, EXCEPTION_NONCONTINUABLE)
  130. genVal(EXCEPTION_UNWINDING, EXCEPTION_UNWINDING)
  131. genVal(EXCEPTION_EXIT_UNWIND, EXCEPTION_EXIT_UNWIND)
  132. genVal(EXCEPTION_STACK_INVALID, EXCEPTION_STACK_INVALID)
  133. genVal(EXCEPTION_NESTED_CALL, EXCEPTION_NESTED_CALL)
  134. genVal(EXCEPTION_TARGET_UNWIND, EXCEPTION_TARGET_UNWIND)
  135. genVal(EXCEPTION_COLLIDED_UNWIND, EXCEPTION_COLLIDED_UNWIND)
  136. genVal(EXCEPTION_UNWIND, EXCEPTION_UNWIND)
  137. genVal(EXCEPTION_EXECUTE_HANDLER, EXCEPTION_EXECUTE_HANDLER)
  138. genVal(EXCEPTION_CONTINUE_SEARCH, EXCEPTION_CONTINUE_SEARCH)
  139. genVal(EXCEPTION_CONTINUE_EXECUTION, EXCEPTION_CONTINUE_EXECUTION)
  140. #if defined(_X86_)
  141. genVal(EXCEPTION_CHAIN_END, (ULONG)EXCEPTION_CHAIN_END)
  142. genVal(FIXED_NTVDMSTATE_LINEAR, (ULONG)FIXED_NTVDMSTATE_LINEAR_PC_AT)
  143. #endif
  144. genSpc()
  145. genVal(ExceptionContinueExecution, ExceptionContinueExecution)
  146. genVal(ExceptionContinueSearch, ExceptionContinueSearch)
  147. genVal(ExceptionNestedException, ExceptionNestedException)
  148. genVal(ExceptionCollidedUnwind, ExceptionCollidedUnwind)
  149. genSpc()
  150. genDef(Er, EXCEPTION_RECORD, ExceptionCode)
  151. genDef(Er, EXCEPTION_RECORD, ExceptionFlags)
  152. genDef(Er, EXCEPTION_RECORD, ExceptionRecord)
  153. genDef(Er, EXCEPTION_RECORD, ExceptionAddress)
  154. genDef(Er, EXCEPTION_RECORD, NumberParameters)
  155. genDef(Er, EXCEPTION_RECORD, ExceptionInformation)
  156. genVal(ExceptionRecordLength, (sizeof(EXCEPTION_RECORD) + 15) & (~15))
  157. DisableInc(HAL)
  158. //
  159. // Fast Mutex structure offset definitions.
  160. //
  161. EnableInc(HAL)
  162. genCom("Fast Mutex Structure Offset Definitions")
  163. genDef(Fm, FAST_MUTEX, Count)
  164. genDef(Fm, FAST_MUTEX, Owner)
  165. genDef(Fm, FAST_MUTEX, Contention)
  166. genDef(Fm, FAST_MUTEX, Event)
  167. genDef(Fm, FAST_MUTEX, OldIrql)
  168. //
  169. // Interrupt priority request level definitions
  170. //
  171. genCom("Interrupt Priority Request Level Definitions")
  172. genVal(PASSIVE_LEVEL, PASSIVE_LEVEL)
  173. genVal(APC_LEVEL, APC_LEVEL)
  174. genVal(DISPATCH_LEVEL, DISPATCH_LEVEL)
  175. #if defined(_AMD64_)
  176. genVal(CLOCK_LEVEL, CLOCK_LEVEL)
  177. #endif
  178. #if defined(_X86_)
  179. genVal(CLOCK1_LEVEL, CLOCK1_LEVEL)
  180. genVal(CLOCK2_LEVEL, CLOCK2_LEVEL)
  181. #endif
  182. genVal(IPI_LEVEL, IPI_LEVEL)
  183. genVal(POWER_LEVEL, POWER_LEVEL)
  184. genVal(PROFILE_LEVEL, PROFILE_LEVEL)
  185. genVal(HIGH_LEVEL, HIGH_LEVEL)
  186. #if defined(_X86_) || defined(_AMD64_)
  187. genTxt("ifdef NT_UP\n")
  188. genVal(SYNCH_LEVEL, DISPATCH_LEVEL)
  189. genTxt("else\n")
  190. genVal(SYNCH_LEVEL, IPI_LEVEL - 2)
  191. genTxt("endif\n")
  192. #else
  193. genTxt("#ifdef NT_UP\n")
  194. genVal(SYNCH_LEVEL, DISPATCH_LEVEL)
  195. genTxt("#else\n")
  196. genVal(SYNCH_LEVEL, IPI_LEVEL - 2)
  197. genTxt("#endif\n")
  198. #endif
  199. //
  200. // Large integer structure offset definitions.
  201. //
  202. genCom("Large Integer Structure Offset Definitions")
  203. genDef(Li, LARGE_INTEGER, LowPart)
  204. genDef(Li, LARGE_INTEGER, HighPart)
  205. //
  206. // List entry structure offset definitions.
  207. //
  208. genCom("List Entry Structure Offset Definitions")
  209. genDef(Ls, LIST_ENTRY, Flink)
  210. genDef(Ls, LIST_ENTRY, Blink)
  211. //
  212. // String structure offset definitions.
  213. //
  214. genCom("String Structure Offset Definitions")
  215. genDef(Str, STRING, Length)
  216. genDef(Str, STRING, MaximumLength)
  217. genDef(Str, STRING, Buffer)
  218. //
  219. // System time structure offset definitions.
  220. //
  221. #if defined(_X86_)
  222. genCom("System Time Structure Offset Definitions")
  223. genAlt(StLowTime, KSYSTEM_TIME, LowPart)
  224. genDef(St, KSYSTEM_TIME, High1Time)
  225. genDef(St, KSYSTEM_TIME, High2Time)
  226. #endif
  227. //
  228. // User shared data tick count offset definitions.
  229. //
  230. genCom("Tick Count Offset Definitions")
  231. genDef(Us, KUSER_SHARED_DATA, TickCount)
  232. //
  233. // Time structure offset definitions.
  234. //
  235. genCom("Time Structure Offset Definitions")
  236. genAlt(TmLowTime, LARGE_INTEGER, LowPart)
  237. genAlt(TmHighTime, LARGE_INTEGER , HighPart)
  238. DisableInc(HAL)
  239. //
  240. // Thread switch counter structure offset definitions.
  241. //
  242. genCom("Thread Switch Counter Offset Definitions")
  243. genDef(Tw, KTHREAD_SWITCH_COUNTERS, FindAny)
  244. genDef(Tw, KTHREAD_SWITCH_COUNTERS, FindIdeal)
  245. genDef(Tw, KTHREAD_SWITCH_COUNTERS, FindLast)
  246. genDef(Tw, KTHREAD_SWITCH_COUNTERS, IdleAny)
  247. genDef(Tw, KTHREAD_SWITCH_COUNTERS, IdleCurrent)
  248. genDef(Tw, KTHREAD_SWITCH_COUNTERS, IdleIdeal)
  249. genDef(Tw, KTHREAD_SWITCH_COUNTERS, IdleLast)
  250. genDef(Tw, KTHREAD_SWITCH_COUNTERS, PreemptAny)
  251. genDef(Tw, KTHREAD_SWITCH_COUNTERS, PreemptCurrent)
  252. genDef(Tw, KTHREAD_SWITCH_COUNTERS, PreemptLast)
  253. genDef(Tw, KTHREAD_SWITCH_COUNTERS, SwitchToIdle)
  254. //
  255. // Status code definitions
  256. //
  257. genCom("Status Code Definitions")
  258. #if defined(_IA64_)
  259. genVal(STATUS_IA64_INVALID_STACK, STATUS_IA64_INVALID_STACK)
  260. #endif
  261. genVal(STATUS_ACCESS_VIOLATION, STATUS_ACCESS_VIOLATION)
  262. genVal(STATUS_ARRAY_BOUNDS_EXCEEDED, STATUS_ARRAY_BOUNDS_EXCEEDED)
  263. genVal(STATUS_BAD_COMPRESSION_BUFFER, STATUS_BAD_COMPRESSION_BUFFER)
  264. genVal(STATUS_BREAKPOINT, STATUS_BREAKPOINT)
  265. genVal(STATUS_DATATYPE_MISALIGNMENT, STATUS_DATATYPE_MISALIGNMENT)
  266. genVal(STATUS_FLOAT_DENORMAL_OPERAND, STATUS_FLOAT_DENORMAL_OPERAND)
  267. genVal(STATUS_FLOAT_DIVIDE_BY_ZERO, STATUS_FLOAT_DIVIDE_BY_ZERO)
  268. genVal(STATUS_FLOAT_INEXACT_RESULT, STATUS_FLOAT_INEXACT_RESULT)
  269. genVal(STATUS_FLOAT_INVALID_OPERATION, STATUS_FLOAT_INVALID_OPERATION)
  270. genVal(STATUS_FLOAT_OVERFLOW, STATUS_FLOAT_OVERFLOW)
  271. genVal(STATUS_FLOAT_STACK_CHECK, STATUS_FLOAT_STACK_CHECK)
  272. genVal(STATUS_FLOAT_UNDERFLOW, STATUS_FLOAT_UNDERFLOW)
  273. genVal(STATUS_FLOAT_MULTIPLE_FAULTS, STATUS_FLOAT_MULTIPLE_FAULTS)
  274. genVal(STATUS_FLOAT_MULTIPLE_TRAPS, STATUS_FLOAT_MULTIPLE_TRAPS)
  275. genVal(STATUS_GUARD_PAGE_VIOLATION, STATUS_GUARD_PAGE_VIOLATION)
  276. genVal(STATUS_ILLEGAL_FLOAT_CONTEXT, STATUS_ILLEGAL_FLOAT_CONTEXT)
  277. genVal(STATUS_ILLEGAL_INSTRUCTION, STATUS_ILLEGAL_INSTRUCTION)
  278. genVal(STATUS_INSTRUCTION_MISALIGNMENT, STATUS_INSTRUCTION_MISALIGNMENT)
  279. genVal(STATUS_INVALID_HANDLE, STATUS_INVALID_HANDLE)
  280. genVal(STATUS_INVALID_LOCK_SEQUENCE, STATUS_INVALID_LOCK_SEQUENCE)
  281. genVal(STATUS_INVALID_OWNER, STATUS_INVALID_OWNER)
  282. genVal(STATUS_INVALID_PARAMETER_1, STATUS_INVALID_PARAMETER_1)
  283. genVal(STATUS_INVALID_SYSTEM_SERVICE, STATUS_INVALID_SYSTEM_SERVICE)
  284. genVal(STATUS_INTEGER_DIVIDE_BY_ZERO, STATUS_INTEGER_DIVIDE_BY_ZERO)
  285. genVal(STATUS_INTEGER_OVERFLOW, STATUS_INTEGER_OVERFLOW)
  286. genVal(STATUS_IN_PAGE_ERROR, STATUS_IN_PAGE_ERROR)
  287. genVal(STATUS_KERNEL_APC, STATUS_KERNEL_APC)
  288. genVal(STATUS_LONGJUMP, STATUS_LONGJUMP)
  289. genVal(STATUS_NO_CALLBACK_ACTIVE, STATUS_NO_CALLBACK_ACTIVE)
  290. genVal(STATUS_NO_EVENT_PAIR, STATUS_NO_EVENT_PAIR)
  291. genVal(STATUS_PRIVILEGED_INSTRUCTION, STATUS_PRIVILEGED_INSTRUCTION)
  292. genVal(STATUS_SINGLE_STEP, STATUS_SINGLE_STEP)
  293. genVal(STATUS_STACK_OVERFLOW, STATUS_STACK_OVERFLOW)
  294. genVal(STATUS_SUCCESS, STATUS_SUCCESS)
  295. genVal(STATUS_THREAD_IS_TERMINATING, STATUS_THREAD_IS_TERMINATING)
  296. genVal(STATUS_TIMEOUT, STATUS_TIMEOUT)
  297. genVal(STATUS_UNWIND, STATUS_UNWIND)
  298. genVal(STATUS_UNWIND_CONSOLIDATE, STATUS_UNWIND_CONSOLIDATE)
  299. genVal(STATUS_WAKE_SYSTEM_DEBUGGER, STATUS_WAKE_SYSTEM_DEBUGGER)
  300. //
  301. // Define kernel object structure definitions.
  302. //
  303. // APC object structure defintions.
  304. //
  305. genCom("APC Object Structure Offset Definitions")
  306. genDef(Ap, KAPC, Type)
  307. genDef(Ap, KAPC, Size)
  308. genDef(Ap, KAPC, Thread)
  309. genDef(Ap, KAPC, ApcListEntry)
  310. genDef(Ap, KAPC, KernelRoutine)
  311. genDef(Ap, KAPC, RundownRoutine)
  312. genDef(Ap, KAPC, NormalRoutine)
  313. genDef(Ap, KAPC, NormalContext)
  314. genDef(Ap, KAPC, SystemArgument1)
  315. genDef(Ap, KAPC, SystemArgument2)
  316. genDef(Ap, KAPC, ApcStateIndex)
  317. genDef(Ap, KAPC, ApcMode)
  318. genDef(Ap, KAPC, Inserted)
  319. genVal(ApcObjectLength, sizeof(KAPC))
  320. //
  321. // DPC Object structure definitions.
  322. //
  323. EnableInc(HAL)
  324. genCom("DPC object Structure Offset Definitions")
  325. genDef(Dp, KDPC, Type)
  326. genDef(Dp, KDPC, Number)
  327. genDef(Dp, KDPC, Importance)
  328. genDef(Dp, KDPC, DpcListEntry)
  329. genDef(Dp, KDPC, DeferredRoutine)
  330. genDef(Dp, KDPC, DeferredContext)
  331. genDef(Dp, KDPC, SystemArgument1)
  332. genDef(Dp, KDPC, SystemArgument2)
  333. genDef(Dp, KDPC, DpcData)
  334. genVal(DpcObjectLength, sizeof(KDPC))
  335. DisableInc(HAL)
  336. //
  337. // Device queue object structure definitions.
  338. //
  339. genCom("Device Queue Object Structure Offset Definitions")
  340. genDef(Dv, KDEVICE_QUEUE, Type)
  341. genDef(Dv, KDEVICE_QUEUE, Size)
  342. genDef(Dv, KDEVICE_QUEUE, DeviceListHead)
  343. genAlt(DvSpinLock, KDEVICE_QUEUE, Lock)
  344. genDef(Dv, KDEVICE_QUEUE, Busy)
  345. genVal(DeviceQueueObjectLength, sizeof(KDEVICE_QUEUE))
  346. //
  347. // Device object entry structure definitions.
  348. //
  349. genCom("Device Queue Entry Structure Offset Definitions")
  350. genDef(De, KDEVICE_QUEUE_ENTRY, DeviceListEntry)
  351. genDef(De, KDEVICE_QUEUE_ENTRY, SortKey)
  352. genDef(De, KDEVICE_QUEUE_ENTRY, Inserted)
  353. genVal(DeviceQueueEntryLength, sizeof(KDEVICE_QUEUE_ENTRY))
  354. //
  355. // Event object structure definitions.
  356. //
  357. genCom("Event Object Structure Offset Definitions")
  358. genDef(Ev, DISPATCHER_HEADER, Type)
  359. genDef(Ev, DISPATCHER_HEADER, Size)
  360. genDef(Ev, DISPATCHER_HEADER, SignalState)
  361. genAlt(EvWaitListHead, KEVENT, Header.WaitListHead)
  362. genVal(EventObjectLength, sizeof(KEVENT))
  363. //
  364. // Event pair object structure definitions.
  365. //
  366. genCom("Event Pair Object Structure Offset Definitions")
  367. genDef(Ep, KEVENT_PAIR, Type)
  368. genDef(Ep, KEVENT_PAIR, Size)
  369. genDef(Ep, KEVENT_PAIR, EventLow)
  370. genDef(Ep, KEVENT_PAIR, EventHigh)
  371. #if defined(_IA64_)
  372. #define EventOffset (OFFSET(KEVENT_PAIR, EventHigh) - \
  373. OFFSET(KEVENT_PAIR, EventLow))
  374. // if ((EventOffset & (EventOffset - 1)) != 0) {
  375. // fprintf(stderr, "GENXX: Event offset not log2N\n")
  376. // }
  377. genVal(SET_LOW_WAIT_HIGH, - (LONG)(EventOffset * 2))
  378. genVal(SET_HIGH_WAIT_LOW, - (LONG)EventOffset)
  379. genVal(SET_EVENT_PAIR_MASK, (LONG)EventOffset)
  380. #endif
  381. //
  382. // Interrupt object structure definitions.
  383. //
  384. #if defined(_AMD64_) || defined(_IA64_)
  385. EnableInc(HAL)
  386. #endif
  387. genCom("Interrupt Object Structure Offset Definitions")
  388. genVal(InLevelSensitive, LevelSensitive)
  389. genVal(InLatched, Latched)
  390. genSpc()
  391. genDef(In, KINTERRUPT, Type)
  392. genDef(In, KINTERRUPT, Size)
  393. genDef(In, KINTERRUPT, InterruptListEntry)
  394. genDef(In, KINTERRUPT, ServiceRoutine)
  395. genDef(In, KINTERRUPT, ServiceContext)
  396. genDef(In, KINTERRUPT, SpinLock)
  397. genDef(In, KINTERRUPT, TickCount)
  398. genDef(In, KINTERRUPT, ActualLock)
  399. genDef(In, KINTERRUPT, DispatchAddress)
  400. genDef(In, KINTERRUPT, Vector)
  401. genDef(In, KINTERRUPT, Irql)
  402. genDef(In, KINTERRUPT, SynchronizeIrql)
  403. genDef(In, KINTERRUPT, FloatingSave)
  404. genDef(In, KINTERRUPT, Connected)
  405. genDef(In, KINTERRUPT, Number)
  406. genDef(In, KINTERRUPT, ShareVector)
  407. genDef(In, KINTERRUPT, Mode)
  408. genDef(In, KINTERRUPT, ServiceCount)
  409. genDef(In, KINTERRUPT, DispatchCount)
  410. #if defined(_AMD64_)
  411. genDef(In, KINTERRUPT, TrapFrame)
  412. #endif
  413. genDef(In, KINTERRUPT, DispatchCode)
  414. genVal(InterruptObjectLength, sizeof(KINTERRUPT))
  415. #if defined(_X86_)
  416. genSpc()
  417. genVal(NORMAL_DISPATCH_LENGTH, NORMAL_DISPATCH_LENGTH * sizeof(ULONG))
  418. genVal(DISPATCH_LENGTH, DISPATCH_LENGTH * sizeof(ULONG))
  419. #endif
  420. #if defined(_AMD64_) || defined(_IA64_)
  421. DisableInc(HAL)
  422. #endif
  423. //
  424. // Process object structure offset definitions.
  425. //
  426. genCom("Process Object Structure Offset Definitions")
  427. genDef(Pr, DISPATCHER_HEADER, Type)
  428. genDef(Pr, DISPATCHER_HEADER, Size)
  429. genDef(Pr, DISPATCHER_HEADER, SignalState)
  430. genDef(Pr, KPROCESS, ProfileListHead)
  431. EnableInc(HAL)
  432. genDef(Pr, KPROCESS, DirectoryTableBase)
  433. DisableInc(HAL)
  434. #if defined(_X86_)
  435. EnableInc(HAL)
  436. genDef(Pr, KPROCESS, LdtDescriptor)
  437. genDef(Pr, KPROCESS, IopmOffset)
  438. DisableInc(HAL)
  439. genDef(Pr, KPROCESS, Int21Descriptor)
  440. genDef(Pr, KPROCESS, Iopl)
  441. genDef(Pr, KPROCESS, VdmTrapcHandler)
  442. genDef(Pr, EPROCESS, VdmObjects)
  443. genDef(Pr, EPROCESS, Flags)
  444. #endif
  445. #if defined(_AMD64_)
  446. genDef(Pr, KPROCESS, IopmOffset)
  447. #endif
  448. #if defined(_IA64_)
  449. genDef(Pr, KPROCESS, ProcessRegion)
  450. genDef(Pr, KPROCESS, SessionMapInfo)
  451. genDef(Pr, KPROCESS, SessionParentBase)
  452. #endif
  453. genDef(Pr, KPROCESS, ActiveProcessors)
  454. genDef(Pr, KPROCESS, KernelTime)
  455. genDef(Pr, KPROCESS, UserTime)
  456. genDef(Pr, KPROCESS, ReadyListHead)
  457. genDef(Pr, KPROCESS, SwapListEntry)
  458. genDef(Pr, KPROCESS, ThreadListHead)
  459. genDef(Pr, KPROCESS, ProcessLock)
  460. genDef(Pr, KPROCESS, Affinity)
  461. genDef(Pr, KPROCESS, StackCount)
  462. genDef(Pr, KPROCESS, BasePriority)
  463. genDef(Pr, KPROCESS, ThreadQuantum)
  464. genDef(Pr, KPROCESS, AutoAlignment)
  465. genDef(Pr, KPROCESS, State)
  466. genVal(ProcessObjectLength, ((sizeof(KPROCESS) + 15) & ~15))
  467. genVal(ExtendedProcessObjectLength, ((sizeof(EPROCESS) + 15) & ~15))
  468. //
  469. // Profile object structure offset definitions.
  470. //
  471. genCom("Profile Object Structure Offset Definitions")
  472. genDef(Pf, KPROFILE, Type)
  473. genDef(Pf, KPROFILE, Size)
  474. genDef(Pf, KPROFILE, ProfileListEntry)
  475. genDef(Pf, KPROFILE, Process)
  476. genDef(Pf, KPROFILE, RangeBase)
  477. genDef(Pf, KPROFILE, RangeLimit)
  478. genDef(Pf, KPROFILE, BucketShift)
  479. genDef(Pf, KPROFILE, Buffer)
  480. genDef(Pf, KPROFILE, Segment)
  481. genDef(Pf, KPROFILE, Affinity)
  482. genDef(Pf, KPROFILE, Source)
  483. genDef(Pf, KPROFILE, Started)
  484. genVal(ProfileObjectLength, sizeof(KPROFILE))
  485. //
  486. // Queue object structure offset definitions.
  487. //
  488. genCom("Queue Object Structure Offset Definitions")
  489. genDef(Qu, DISPATCHER_HEADER, Type)
  490. genDef(Qu, DISPATCHER_HEADER, Size)
  491. genDef(Qu, DISPATCHER_HEADER, SignalState)
  492. genDef(Qu, KQUEUE, EntryListHead)
  493. genDef(Qu, KQUEUE, CurrentCount)
  494. genDef(Qu, KQUEUE, MaximumCount)
  495. genDef(Qu, KQUEUE, ThreadListHead)
  496. genVal(QueueObjectLength, sizeof(KQUEUE))
  497. //
  498. // Thread object structure offset definitions
  499. //
  500. genCom("Thread Object Structure Offset Definitions")
  501. genDef(Ee, EEVENT_PAIR, KernelEventPair)
  502. genDef(Et, ETHREAD, Cid)
  503. #if defined (PERF_DATA)
  504. genDef(Et, ETHREAD, PerformanceCountLow)
  505. genDef(Et, ETHREAD, PerformanceCountHigh)
  506. #endif
  507. genVal(EtEthreadLength, ((sizeof(ETHREAD) + 15) & ~15))
  508. genSpc()
  509. genDef(Th, DISPATCHER_HEADER, Type)
  510. genDef(Th, DISPATCHER_HEADER, Size)
  511. EnableInc(HAL)
  512. genDef(Th, DISPATCHER_HEADER, DebugActive)
  513. DisableInc(HAL)
  514. genDef(Th, DISPATCHER_HEADER, SignalState)
  515. genDef(Th, KTHREAD, MutantListHead)
  516. genDef(Th, KTHREAD, InitialStack)
  517. genDef(Th, KTHREAD, ThreadLock)
  518. EnableInc(HAL)
  519. genDef(Th, KTHREAD, StackLimit)
  520. DisableInc(HAL)
  521. genDef(Th, KTHREAD, KernelStack)
  522. #if defined(_IA64_)
  523. genDef(Th, KTHREAD, InitialBStore)
  524. genDef(Th, KTHREAD, BStoreLimit)
  525. genDef(Th, KTHREAD, Number)
  526. genDef(Th, KTHREAD, KernelBStore)
  527. #endif
  528. genDef(Th, KTHREAD, ContextSwitches)
  529. genDef(Th, KTHREAD, State)
  530. genDef(Th, KTHREAD, NpxState)
  531. genDef(Th, KTHREAD, WaitIrql)
  532. genDef(Th, KTHREAD, WaitMode)
  533. genDef(Th, KTHREAD, Teb)
  534. EnableInc(HAL)
  535. genDef(Th, KTHREAD, ApcState)
  536. DisableInc(HAL)
  537. genDef(Th, KTHREAD, ApcQueueLock)
  538. genDef(Th, KTHREAD, WaitStatus)
  539. genDef(Th, KTHREAD, WaitBlockList)
  540. genDef(Th, KTHREAD, Alertable)
  541. genDef(Th, KTHREAD, WaitNext)
  542. genDef(Th, KTHREAD, WaitReason)
  543. genDef(Th, KTHREAD, Priority)
  544. genDef(Th, KTHREAD, EnableStackSwap)
  545. genDef(Th, KTHREAD, SwapBusy)
  546. genDef(Th, KTHREAD, Alerted)
  547. genDef(Th, KTHREAD, WaitListEntry)
  548. genDef(Th, KTHREAD, Queue)
  549. genDef(Th, KTHREAD, WaitTime)
  550. genDef(Th, KTHREAD, CombinedApcDisable)
  551. genDef(Th, KTHREAD, KernelApcDisable)
  552. genDef(Th, KTHREAD, SpecialApcDisable)
  553. genDef(Th, KTHREAD, Timer)
  554. genDef(Th, KTHREAD, WaitBlock)
  555. genDef(Th, KTHREAD, QueueListEntry)
  556. genDef(Th, KTHREAD, ApcStateIndex)
  557. genDef(Th, KTHREAD, ApcQueueable)
  558. genDef(Th, KTHREAD, Preempted)
  559. genDef(Th, KTHREAD, ProcessReadyQueue)
  560. genDef(Th, KTHREAD, KernelStackResident)
  561. genDef(Th, KTHREAD, Saturation)
  562. genDef(Th, KTHREAD, IdealProcessor)
  563. genDef(Th, KTHREAD, NextProcessor)
  564. genDef(Th, KTHREAD, BasePriority)
  565. genDef(Th, KTHREAD, PriorityDecrement)
  566. genDef(Th, KTHREAD, Quantum)
  567. genDef(Th, KTHREAD, SystemAffinityActive)
  568. genDef(Th, KTHREAD, PreviousMode)
  569. genDef(Th, KTHREAD, ResourceIndex)
  570. genDef(Th, KTHREAD, DisableBoost)
  571. genDef(Th, KTHREAD, UserAffinity)
  572. genDef(Th, KTHREAD, Process)
  573. genDef(Th, KTHREAD, Affinity)
  574. genDef(Th, KTHREAD, ServiceTable)
  575. genDef(Th, KTHREAD, ApcStatePointer)
  576. genDef(Th, KTHREAD, SavedApcState)
  577. #if defined(_IA64_)
  578. genDef(Th, KTHREAD, CallbackBStore)
  579. #endif // defined(_IA64_)
  580. genDef(Th, KTHREAD, CallbackStack)
  581. genDef(Th, KTHREAD, Win32Thread)
  582. genDef(Th, KTHREAD, TrapFrame)
  583. genDef(Th, KTHREAD, KernelTime)
  584. genDef(Th, KTHREAD, UserTime)
  585. genDef(Th, KTHREAD, StackBase)
  586. genDef(Th, KTHREAD, SuspendApc)
  587. genDef(Th, KTHREAD, SuspendSemaphore)
  588. genDef(Th, KTHREAD, TlsArray)
  589. genDef(Th, KTHREAD, LegoData)
  590. genDef(Th, KTHREAD, ThreadListEntry)
  591. genDef(Th, KTHREAD, LargeStack)
  592. genDef(Th, KTHREAD, PowerState)
  593. genDef(Th, KTHREAD, NpxIrql)
  594. genDef(Th, KTHREAD, AutoAlignment)
  595. genDef(Th, KTHREAD, Iopl)
  596. genDef(Th, KTHREAD, FreezeCount)
  597. genDef(Th, KTHREAD, SuspendCount)
  598. genDef(Th, KTHREAD, UserIdealProcessor)
  599. genVal(ThreadObjectLength, ((sizeof(KTHREAD) + 15) & ~15))
  600. genVal(ExtendedThreadObjectLength, ((sizeof(ETHREAD) + 15) & ~15))
  601. genSpc()
  602. genVal(EVENT_WAIT_BLOCK_OFFSET, OFFSET(KTHREAD, WaitBlock) + (sizeof(KWAIT_BLOCK) * EVENT_WAIT_BLOCK))
  603. #if defined(_X86_)
  604. genVal(NPX_STATE_NOT_LOADED, NPX_STATE_NOT_LOADED)
  605. genVal(NPX_STATE_LOADED, NPX_STATE_LOADED)
  606. #endif
  607. //
  608. // Timer object structure offset definitions
  609. //
  610. genCom("Timer object Structure Offset Definitions")
  611. genDef(Ti, DISPATCHER_HEADER, Type)
  612. genDef(Ti, DISPATCHER_HEADER, Size)
  613. genDef(Ti, DISPATCHER_HEADER, Inserted)
  614. genDef(Ti, DISPATCHER_HEADER, SignalState)
  615. genDef(Ti, KTIMER, DueTime)
  616. genDef(Ti, KTIMER, TimerListEntry)
  617. genDef(Ti, KTIMER, Dpc)
  618. genDef(Ti, KTIMER, Period)
  619. genVal(TimerObjectLength, sizeof(KTIMER))
  620. genSpc()
  621. genVal(TIMER_TABLE_SIZE, TIMER_TABLE_SIZE)
  622. //
  623. // Wait block structure offset definitions
  624. //
  625. genCom("Wait Block Structure Offset Definitions")
  626. genDef(Wb, KWAIT_BLOCK, WaitListEntry)
  627. genDef(Wb, KWAIT_BLOCK, Thread)
  628. genDef(Wb, KWAIT_BLOCK, Object)
  629. genDef(Wb, KWAIT_BLOCK, NextWaitBlock)
  630. genDef(Wb, KWAIT_BLOCK, WaitKey)
  631. genDef(Wb, KWAIT_BLOCK, WaitType)
  632. //
  633. // Fiber structure offset definitions.
  634. //
  635. genCom("Fiber Structure Offset Definitions")
  636. genDef(Fb, FIBER, FiberData)
  637. genDef(Fb, FIBER, ExceptionList)
  638. genDef(Fb, FIBER, StackBase)
  639. genDef(Fb, FIBER, StackLimit)
  640. genDef(Fb, FIBER, DeallocationStack)
  641. genDef(Fb, FIBER, FiberContext)
  642. genDef(Fb, FIBER, Wx86Tib)
  643. #if defined(_IA64_)
  644. genDef(Fb, FIBER, DeallocationBStore)
  645. genDef(Fb, FIBER, BStoreLimit)
  646. #endif // defined(_IA64_)
  647. genDef(Fb, FIBER, FlsData)
  648. //
  649. // Process environment block structure offset definitions.
  650. //
  651. genCom("Process Environment Block Structure Offset Definitions")
  652. genDef(Pe, PEB, KernelCallbackTable)
  653. genVal(ProcessEnvironmentBlockLength, sizeof(PEB))
  654. //
  655. // Define System Service Descriptor Table structures.
  656. //
  657. genCom("System Service Descriptor Table Structure Definitions")
  658. genVal(NUMBER_SERVICE_TABLES, NUMBER_SERVICE_TABLES)
  659. genVal(SERVICE_NUMBER_MASK, SERVICE_NUMBER_MASK)
  660. genVal(SERVICE_TABLE_SHIFT, SERVICE_TABLE_SHIFT)
  661. genVal(SERVICE_TABLE_MASK, SERVICE_TABLE_MASK)
  662. genVal(SERVICE_TABLE_TEST, SERVICE_TABLE_TEST)
  663. genSpc()
  664. genDef(Sd, KSERVICE_TABLE_DESCRIPTOR, Base)
  665. genDef(Sd, KSERVICE_TABLE_DESCRIPTOR, Count)
  666. genDef(Sd, KSERVICE_TABLE_DESCRIPTOR, Limit)
  667. #if defined(_IA64_)
  668. genDef(Sd, KSERVICE_TABLE_DESCRIPTOR, TableBaseGpOffset)
  669. #endif
  670. genDef(Sd, KSERVICE_TABLE_DESCRIPTOR, Number)
  671. //
  672. // Common TEB structure offset definitions
  673. //
  674. genCom("Thread Environment Block Structure Offset Definitions")
  675. #if defined(_WIN64)
  676. genAlt(TeCmTeb, NT_TIB, ExceptionList)
  677. #endif
  678. #if defined(_X86_)
  679. genDef(Te, NT_TIB, ExceptionList)
  680. #endif
  681. genDef(Te, NT_TIB, StackBase)
  682. genDef(Te, NT_TIB, StackLimit)
  683. genDef(Te, NT_TIB, FiberData)
  684. genDef(Te, NT_TIB, Self)
  685. genDef(Te, TEB, EnvironmentPointer)
  686. genDef(Te, TEB, ClientId)
  687. genDef(Te, TEB, ActiveRpcHandle)
  688. genDef(Te, TEB, ThreadLocalStoragePointer)
  689. genDef(Te, TEB, CountOfOwnedCriticalSections)
  690. genAlt(TePeb, TEB, ProcessEnvironmentBlock)
  691. genDef(Te, TEB, CsrClientThread)
  692. genDef(Te, TEB, WOW32Reserved)
  693. genAlt(TeSoftFpcr, TEB, FpSoftwareStatusRegister)
  694. genDef(Te, TEB, ExceptionCode)
  695. genDef(Te, TEB, GdiClientPID)
  696. genDef(Te, TEB, GdiClientTID)
  697. genDef(Te, TEB, GdiThreadLocalInfo)
  698. genDef(Te, TEB, glDispatchTable)
  699. genDef(Te, TEB, glReserved1)
  700. genDef(Te, TEB, glReserved2)
  701. genDef(Te, TEB, glSectionInfo)
  702. genDef(Te, TEB, glSection)
  703. genDef(Te, TEB, glTable)
  704. genDef(Te, TEB, glCurrentRC)
  705. genDef(Te, TEB, glContext)
  706. genDef(Te, TEB, DeallocationStack)
  707. genDef(Te, TEB, TlsSlots)
  708. genDef(Te, TEB, Vdm)
  709. genDef(Te, TEB, GdiBatchCount)
  710. genDef(Te, TEB, Instrumentation)
  711. #if defined(_IA64_)
  712. genDef(Te, NT_TIB, ExceptionList)
  713. genDef(Te, TEB, DeallocationBStore)
  714. genDef(Te, TEB, BStoreLimit)
  715. #endif // defined(_IA64_)
  716. genDef(Te, TEB, FlsData)
  717. genVal(ThreadEnvironmentBlockLength, sizeof(TEB))
  718. genVal(CmThreadEnvironmentBlockOffset, ROUND_TO_PAGES(sizeof(TEB)))
  719. //
  720. // Lock Queue structure definitions.
  721. //
  722. #if defined(_X86_)
  723. EnableInc(HAL)
  724. #endif
  725. genCom("Lock Queue Structure Offset Definitions")
  726. genNam(LOCK_QUEUE_WAIT)
  727. genNam(LOCK_QUEUE_OWNER)
  728. genVal(LOCK_QUEUE_HEADER_SIZE, sizeof(KSPIN_LOCK_QUEUE))
  729. genSpc()
  730. genNam(LockQueueDispatcherLock)
  731. genSpc()
  732. genDef(Lq, KSPIN_LOCK_QUEUE, Next)
  733. genDef(Lq, KSPIN_LOCK_QUEUE, Lock)
  734. genSpc()
  735. genAlt(LqhNext, KLOCK_QUEUE_HANDLE, LockQueue.Next)
  736. genAlt(LqhLock, KLOCK_QUEUE_HANDLE, LockQueue.Lock)
  737. genAlt(LqhOldIrql, KLOCK_QUEUE_HANDLE, OldIrql)
  738. #if defined(_X86_)
  739. DisableInc(HAL)
  740. #endif
  741. genCom("Performance Definitions")
  742. genVal(PERF_CONTEXTSWAP_OFFSET,
  743. PERF_GET_MASK_INDEX( PERF_CONTEXT_SWITCH ) * sizeof( ULONG ) )
  744. genVal(PERF_CONTEXTSWAP_FLAG,
  745. PERF_GET_MASK_GROUP( PERF_CONTEXT_SWITCH ))
  746. genVal(PERF_INTERRUPT_OFFSET,
  747. PERF_GET_MASK_INDEX( PERF_INTERRUPT ) * sizeof( ULONG ) )
  748. genVal(PERF_INTERRUPT_FLAG,
  749. PERF_GET_MASK_GROUP( PERF_INTERRUPT ))