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.

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