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.

953 lines
29 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. genamd64.m4
  5. Abstract:
  6. This module implements a program which generates structure offset
  7. definitions for kernel structures that are accessed in assembly code.
  8. Author:
  9. David N. Cutler (davec) 30-Oct-2000
  10. --*/
  11. #include "ki.h"
  12. #pragma hdrstop
  13. #include "nturtl.h"
  14. #include "setjmp.h"
  15. include(`..\genxx.h')
  16. #define KSAMD64 KERNEL
  17. #define HALAMD64 HAL
  18. STRUC_ELEMENT ElementList[] = {
  19. START_LIST
  20. //
  21. // Output include statement for AMD64 static definitions and macros.
  22. //
  23. EnableInc(KSAMD64 | HALAMD64)
  24. genTxt("include kxamd64.inc\n")
  25. DisableInc(HALAMD64)
  26. EnableInc(KSAMD64)
  27. #include "genxx.inc"
  28. //
  29. // Generate call frame register argument home address offsets.
  30. //
  31. genCom("Register Argument Home Address Offset Definitions")
  32. genVal(P1Home, 1 * 8)
  33. genVal(P2Home, 2 * 8)
  34. genVal(P3Home, 3 * 8)
  35. genVal(P4Home, 4 * 8)
  36. //
  37. // Generate architecture dependent definitions.
  38. //
  39. genCom("Apc Record Structure Offset Definitions")
  40. genDef(Ar, KAPC_RECORD, NormalRoutine)
  41. genDef(Ar, KAPC_RECORD, NormalContext)
  42. genDef(Ar, KAPC_RECORD, SystemArgument1)
  43. genDef(Ar, KAPC_RECORD, SystemArgument2)
  44. genVal(ApcRecordLength, sizeof(KAPC_RECORD))
  45. genSpc()
  46. EnableInc(HALAMD64)
  47. genCom("Special Register Structure Offset Definition")
  48. genDef(Sr, KSPECIAL_REGISTERS, KernelDr0)
  49. genDef(Sr, KSPECIAL_REGISTERS, KernelDr1)
  50. genDef(Sr, KSPECIAL_REGISTERS, KernelDr2)
  51. genDef(Sr, KSPECIAL_REGISTERS, KernelDr3)
  52. genDef(Sr, KSPECIAL_REGISTERS, KernelDr6)
  53. genDef(Sr, KSPECIAL_REGISTERS, KernelDr7)
  54. genDef(Sr, KSPECIAL_REGISTERS, Gdtr)
  55. genDef(Sr, KSPECIAL_REGISTERS, Idtr)
  56. genDef(Sr, KSPECIAL_REGISTERS, Tr)
  57. genDef(Sr, KSPECIAL_REGISTERS, MxCsr)
  58. genDef(Sr, KSPECIAL_REGISTERS, MsrGsBase)
  59. genDef(Sr, KSPECIAL_REGISTERS, MsrGsSwap)
  60. genDef(Sr, KSPECIAL_REGISTERS, MsrStar)
  61. genDef(Sr, KSPECIAL_REGISTERS, MsrLStar)
  62. genDef(Sr, KSPECIAL_REGISTERS, MsrCStar)
  63. genDef(Sr, KSPECIAL_REGISTERS, MsrSyscallMask)
  64. genCom("Processor Control Region Structure Offset Definitions")
  65. genAlt(PcGdt, KPCR, GdtBase)
  66. genAlt(PcTss, KPCR, TssBase)
  67. genDef(Pc, KPCR, PerfGlobalGroupMask)
  68. genDef(Pc, KPCR, Self)
  69. genDef(Pc, KPCR, ContextSwitches)
  70. genDef(Pc, KPCR, SetMember)
  71. genAlt(PcTeb, KPCR, NtTib.Self)
  72. genDef(Pc, KPCR, CurrentPrcb)
  73. genDef(Pc, KPCR, SavedRcx)
  74. genDef(Pc, KPCR, SavedR11)
  75. genDef(Pc, KPCR, Irql)
  76. genDef(Pc, KPCR, Number)
  77. genDef(Pc, KPCR, Irr)
  78. genDef(Pc, KPCR, IrrActive)
  79. genDef(Pc, KPCR, Idr)
  80. genDef(Pc, KPCR, StallScaleFactor)
  81. genAlt(PcIdt, KPCR, IdtBase)
  82. genDef(Pc, KPCR, HalReserved)
  83. genDef(Pc, KPCR, MxCsr)
  84. genDef(Pc, KPCR, Prcb)
  85. genAlt(PcCurrentThread, KPCR, Prcb.CurrentThread)
  86. genAlt(PcNextThread, KPCR, Prcb.NextThread)
  87. genAlt(PcIdleThread, KPCR, Prcb.IdleThread)
  88. genAlt(PcNotSetMember, KPCR, Prcb.NotSetMember)
  89. genAlt(PcCr0, KPCR, Prcb.ProcessorState.SpecialRegisters.Cr0)
  90. genAlt(PcCr2, KPCR, Prcb.ProcessorState.SpecialRegisters.Cr2)
  91. genAlt(PcCr3, KPCR, Prcb.ProcessorState.SpecialRegisters.Cr3)
  92. genAlt(PcCr4, KPCR, Prcb.ProcessorState.SpecialRegisters.Cr4)
  93. genAlt(PcKernelDr0, KPCR, Prcb.ProcessorState.SpecialRegisters.KernelDr0)
  94. genAlt(PcKernelDr1, KPCR, Prcb.ProcessorState.SpecialRegisters.KernelDr1)
  95. genAlt(PcKernelDr2, KPCR, Prcb.ProcessorState.SpecialRegisters.KernelDr2)
  96. genAlt(PcKernelDr3, KPCR, Prcb.ProcessorState.SpecialRegisters.KernelDr3)
  97. genAlt(PcKernelDr7, KPCR, Prcb.ProcessorState.SpecialRegisters.KernelDr7)
  98. genAlt(PcGdtrLimit, KPCR, Prcb.ProcessorState.SpecialRegisters.Gdtr.Limit)
  99. genAlt(PcGdtrBase, KPCR, Prcb.ProcessorState.SpecialRegisters.Gdtr.Base)
  100. genAlt(PcIdtrLimit, KPCR, Prcb.ProcessorState.SpecialRegisters.Idtr.Limit)
  101. genAlt(PcIdtrBase, KPCR, Prcb.ProcessorState.SpecialRegisters.Idtr.Base)
  102. genAlt(PcTr, KPCR, Prcb.ProcessorState.SpecialRegisters.Tr)
  103. genAlt(PcLdtr, KPCR, Prcb.ProcessorState.SpecialRegisters.Ldtr)
  104. genAlt(PcDebugControl, KPCR, Prcb.ProcessorState.SpecialRegisters.DebugControl)
  105. genAlt(PcLastBranchToRip, KPCR, Prcb.ProcessorState.SpecialRegisters.LastBranchToRip)
  106. genAlt(PcLastBranchFromRip, KPCR, Prcb.ProcessorState.SpecialRegisters.LastBranchFromRip)
  107. genAlt(PcLastExceptionToRip, KPCR, Prcb.ProcessorState.SpecialRegisters.LastExceptionToRip)
  108. genAlt(PcLastExceptionFromRip, KPCR, Prcb.ProcessorState.SpecialRegisters.LastExceptionFromRip)
  109. genAlt(PcCr8, KPCR, Prcb.ProcessorState.SpecialRegisters.Cr8)
  110. genAlt(PcCpuType, KPCR, Prcb.CpuType)
  111. genAlt(PcCpuID, KPCR, Prcb.CpuID)
  112. genAlt(PcCpuStep, KPCR, Prcb.CpuStep)
  113. genAlt(PcInterruptCount, KPCR, Prcb.InterruptCount)
  114. genAlt(PcSystemCalls, KPCR, Prcb.KeSystemCalls)
  115. genAlt(PcDpcRoutineActive, KPCR, Prcb.DpcRoutineActive)
  116. genAlt(PcDeferredReadyListHead, KPCR, Prcb.DeferredReadyListHead)
  117. genAlt(PcSkipTick, KPCR, Prcb.SkipTick)
  118. DisableInc (HALAMD64)
  119. genVal(ProcessorControlRegisterLength, sizeof(KPCR))
  120. EnableInc (HALAMD64)
  121. genCom("Defines for user shared data")
  122. genValUint(USER_SHARED_DATA, KI_USER_SHARED_DATA)
  123. genValUint(MM_SHARED_USER_DATA_VA, MM_SHARED_USER_DATA_VA)
  124. genDef(Us, KUSER_SHARED_DATA, TickCountMultiplier)
  125. genDef(Us, KUSER_SHARED_DATA, InterruptTime)
  126. genDef(Us, KUSER_SHARED_DATA, SystemTime)
  127. genCom("Tss Structure Offset Definitions")
  128. genDef(Tss, KTSS64, Rsp0)
  129. genDef(Tss, KTSS64, Rsp1)
  130. genDef(Tss, KTSS64, Rsp2)
  131. genAlt(TssPanicStack, KTSS64, Ist[TSS_IST_PANIC])
  132. genAlt(TssMcaStack, KTSS64, Ist[TSS_IST_MCA])
  133. genVal(TssLength, sizeof(KTSS64))
  134. DisableInc (HALAMD64)
  135. EnableInc (HALAMD64)
  136. genCom("Gdt Descriptor Offset Definitions")
  137. genNam(KGDT64_NULL)
  138. genNam(KGDT64_R0_CODE)
  139. genNam(KGDT64_R0_DATA)
  140. genNam(KGDT64_R3_CMCODE)
  141. genNam(KGDT64_R3_DATA)
  142. genNam(KGDT64_R3_CODE)
  143. genNam(KGDT64_SYS_TSS)
  144. genNam(KGDT64_R3_CMTEB)
  145. DisableInc (HALAMD64)
  146. EnableInc (HALAMD64)
  147. genCom("GDT Entry Offset Definitions")
  148. genDef(Kgdt, KGDTENTRY64, BaseLow)
  149. genAlt(KgdtBaseMiddle, KGDTENTRY64, Bytes.BaseMiddle)
  150. genAlt(KgdtBaseHigh, KGDTENTRY64, Bytes.BaseHigh)
  151. genAlt(KgdtBaseUpper, KGDTENTRY64, BaseUpper)
  152. genAlt(KgdtLimitHigh, KGDTENTRY64, Bytes.Flags2)
  153. genDef(Kgdt, KGDTENTRY64, LimitLow)
  154. genSpc()
  155. //
  156. // Processor block structure definitions.
  157. //
  158. genCom("Processor Block Structure Offset Definitions")
  159. genAlt(PbMinorVersion, KPRCB, MinorVersion)
  160. genAlt(PbMajorVersion, KPRCB, MajorVersion)
  161. genAlt(PbNumber, KPRCB, Number)
  162. genAlt(PbBuildType, KPRCB, BuildType)
  163. genAlt(PbCurrentThread, KPRCB, CurrentThread)
  164. genAlt(PbNextThread, KPRCB, NextThread)
  165. genAlt(PbIdleThread, KPRCB, IdleThread)
  166. genDef(Pb, KPRCB, SetMember)
  167. genDef(Pb, KPRCB, NotSetMember)
  168. genDef(Pb, KPRCB, PrcbLock)
  169. genAlt(PbProcessorState, KPRCB, ProcessorState)
  170. genAlt(PbCpuType, KPRCB, CpuType)
  171. genAlt(PbCpuID, KPRCB, CpuID)
  172. genAlt(PbCpuStep, KPRCB, CpuStep)
  173. genDef(Pb, KPRCB, HalReserved)
  174. DisableInc (HALAMD64)
  175. genDef(Pb, KPRCB, LockQueue)
  176. genDef(Pb, KPRCB, PPLookasideList)
  177. genDef(Pb, KPRCB, PPNPagedLookasideList)
  178. genDef(Pb, KPRCB, PPPagedLookasideList)
  179. genDef(Pb, KPRCB, PacketBarrier)
  180. genDef(Pb, KPRCB, CurrentPacket)
  181. genDef(Pb, KPRCB, TargetSet)
  182. genDef(Pb, KPRCB, WorkerRoutine)
  183. genDef(Pb, KPRCB, IpiFrozen)
  184. genDef(Pb, KPRCB, RequestSummary)
  185. genAlt(PbDpcListHead, KPRCB, DpcData[DPC_NORMAL].DpcListHead)
  186. genAlt(PbDpcLock, KPRCB, DpcData[DPC_NORMAL].DpcLock)
  187. genAlt(PbDpcQueueDepth, KPRCB, DpcData[DPC_NORMAL].DpcQueueDepth)
  188. genAlt(PbDpcCount, KPRCB, DpcData[DPC_NORMAL].DpcCount)
  189. genDef(Pb, KPRCB, DpcStack)
  190. genDef(Pb, KPRCB, SavedRsp)
  191. genDef(Pb, KPRCB, MaximumDpcQueueDepth)
  192. genDef(Pb, KPRCB, DpcRequestRate)
  193. genDef(Pb, KPRCB, MinimumDpcRate)
  194. genDef(Pb, KPRCB, DpcInterruptRequested)
  195. genDef(Pb, KPRCB, DpcThreadRequested)
  196. genDef(Pb, KPRCB, DpcRoutineActive)
  197. genDef(Pb, KPRCB, DpcThreadActive)
  198. genDef(Pb, KPRCB, TimerHand)
  199. genDef(Pb, KPRCB, TimerRequest)
  200. genDef(Pb, KPRCB, DpcLastCount)
  201. genDef(Pb, KPRCB, ThreadDpcEnable)
  202. genDef(Pb, KPRCB, QuantumEnd)
  203. genDef(Pb, KPRCB, DpcSetEventRequest)
  204. genDef(Pb, KPRCB, IdleSchedule)
  205. genDef(Pb, KPRCB, DeferredReadyListHead)
  206. genDef(Pb, KPRCB, ReadySummary)
  207. genDef(Pb, KPRCB, DispatcherReadyListHead)
  208. genDef(Pb, KPRCB, InterruptCount)
  209. genDef(Pb, KPRCB, KernelTime)
  210. genDef(Pb, KPRCB, UserTime)
  211. genDef(Pb, KPRCB, DpcTime)
  212. genDef(Pb, KPRCB, InterruptTime)
  213. genDef(Pb, KPRCB, AdjustDpcThreshold)
  214. genDef(Pb, KPRCB, PageColor)
  215. genDef(Pb, KPRCB, SkipTick)
  216. genDef(Pb, KPRCB, PollSlot)
  217. genDef(Pb, KPRCB, ParentNode)
  218. genDef(Pb, KPRCB, MultiThreadProcessorSet)
  219. genDef(Pb, KPRCB, ThreadStartCount)
  220. genDef(Pb, KPRCB, DebugDpcTime)
  221. genAlt(PbFastReadNoWait, KPRCB, CcFastReadNoWait)
  222. genAlt(PbFastReadWait, KPRCB, CcFastReadWait)
  223. genAlt(PbFastReadNotPossible, KPRCB, CcFastReadNotPossible)
  224. genAlt(PbCopyReadNoWait, KPRCB, CcCopyReadNoWait)
  225. genAlt(PbCopyReadWait, KPRCB, CcCopyReadWait)
  226. genAlt(PbCopyReadNoWaitMiss, KPRCB, CcCopyReadNoWaitMiss)
  227. genAlt(PbAlignmentFixupCount, KPRCB, KeAlignmentFixupCount)
  228. genAlt(PbDcacheFlushCount, KPRCB, KeDcacheFlushCount)
  229. genAlt(PbExceptionDispatchCount, KPRCB, KeExceptionDispatchCount)
  230. genAlt(PbFirstLevelTbFills, KPRCB, KeFirstLevelTbFills)
  231. genAlt(PbFloatingEmulationCount, KPRCB, KeFloatingEmulationCount)
  232. genAlt(PbIcacheFlushCount, KPRCB, KeIcacheFlushCount)
  233. genAlt(PbSecondLevelTbFills, KPRCB, KeSecondLevelTbFills)
  234. genAlt(PbSystemCalls, KPRCB, KeSystemCalls)
  235. genDef(Pb, KPRCB, LookasideIrpFloat)
  236. genDef(Pb, KPRCB, VendorString)
  237. genDef(Pb, KPRCB, PowerState)
  238. genVal(ProcessorBlockLength, ((sizeof(KPRCB) + 15) & ~15))
  239. //
  240. // Prcb power state
  241. //
  242. genCom("Processor Power State Offset Definitions")
  243. genDef(Pp, PROCESSOR_POWER_STATE, IdleFunction)
  244. //
  245. // Interprocessor command definitions.
  246. //
  247. genCom("Immediate Interprocessor Command Definitions")
  248. genVal(IPI_APC, IPI_APC)
  249. genVal(IPI_DPC, IPI_DPC)
  250. genVal(IPI_FREEZE, IPI_FREEZE)
  251. genVal(IPI_PACKET_READY, IPI_PACKET_READY)
  252. genVal(IPI_SYNCH_REQUEST, IPI_SYNCH_REQUEST)
  253. //
  254. // Time fields definitions.
  255. //
  256. EnableInc (HALAMD64)
  257. genCom("Time Fields (TIME_FIELDS) Structure Offset Definitions")
  258. genDef(Tf, TIME_FIELDS, Second)
  259. genDef(Tf, TIME_FIELDS, Minute)
  260. genDef(Tf, TIME_FIELDS, Hour)
  261. genDef(Tf, TIME_FIELDS, Weekday)
  262. genDef(Tf, TIME_FIELDS, Day)
  263. genDef(Tf, TIME_FIELDS, Month)
  264. genDef(Tf, TIME_FIELDS, Year)
  265. genDef(Tf, TIME_FIELDS, Milliseconds)
  266. genSpc()
  267. DisableInc (HALAMD64)
  268. EnableInc (HALAMD64)
  269. genCom("Define constants for system IRQL and IDT vector conversion")
  270. genNam(MAXIMUM_IDTVECTOR)
  271. genNam(MAXIMUM_PRIMARY_VECTOR)
  272. genNam(PRIMARY_VECTOR_BASE)
  273. genNam(RPL_MASK)
  274. genNam(MODE_BIT)
  275. genNam(MODE_MASK)
  276. genCom("Flags in the CR0 register")
  277. genNam(CR0_PG)
  278. genNam(CR0_ET)
  279. genNam(CR0_TS)
  280. genNam(CR0_EM)
  281. genNam(CR0_MP)
  282. genNam(CR0_PE)
  283. genNam(CR0_CD)
  284. genNam(CR0_NW)
  285. genNam(CR0_AM)
  286. genNam(CR0_WP)
  287. genNam(CR0_NE)
  288. genCom("Flags in the CR4 register")
  289. genNam(CR4_VME)
  290. genNam(CR4_PVI)
  291. genNam(CR4_TSD)
  292. genNam(CR4_DE)
  293. genNam(CR4_PSE)
  294. genNam(CR4_PAE)
  295. genNam(CR4_MCE)
  296. genNam(CR4_PGE)
  297. genNam(CR4_FXSR)
  298. genNam(CR4_XMMEXCPT)
  299. genCom("Legacy Floating Status Bit Masks")
  300. genNam(FSW_INVALID_OPERATION)
  301. genNam(FSW_DENORMAL)
  302. genNam(FSW_ZERO_DIVIDE)
  303. genNam(FSW_OVERFLOW)
  304. genNam(FSW_UNDERFLOW)
  305. genNam(FSW_PRECISION)
  306. genNam(FSW_STACK_FAULT)
  307. genNam(FSW_CONDITION_CODE_0)
  308. genNam(FSW_CONDITION_CODE_1)
  309. genNam(FSW_CONDITION_CODE_2)
  310. genNam(FSW_CONDITION_CODE_3)
  311. genNam(FSW_ERROR_MASK)
  312. genCom("Legacy Floating States")
  313. genNam(LEGACY_STATE_UNUSED)
  314. genNam(LEGACY_STATE_SCRUB)
  315. genNam(LEGACY_STATE_SWITCH)
  316. genCom("MXCSR Floating Control/Status Bit Masks")
  317. genNam(XSW_INVALID_OPERATION)
  318. genNam(XSW_DENORMAL)
  319. genNam(XSW_ZERO_DIVIDE)
  320. genNam(XSW_OVERFLOW)
  321. genNam(XSW_UNDERFLOW)
  322. genNam(XSW_PRECISION)
  323. genNam(XSW_ERROR_MASK)
  324. genNam(XSW_ERROR_SHIFT)
  325. genNam(XCW_INVALID_OPERATION)
  326. genNam(XCW_DENORMAL)
  327. genNam(XCW_ZERO_DIVIDE)
  328. genNam(XCW_OVERFLOW)
  329. genNam(XCW_UNDERFLOW)
  330. genNam(XCW_PRECISION)
  331. genNam(XCW_ROUND_CONTROL)
  332. genNam(XCW_FLUSH_ZERO)
  333. genNam(INITIAL_MXCSR)
  334. genCom("Machine Specific Register Numbers")
  335. genNam(MSR_EFER)
  336. genNam(MSR_STAR)
  337. genNam(MSR_LSTAR)
  338. genNam(MSR_CSTAR)
  339. genNam(MSR_SYSCALL_MASK)
  340. genNam(MSR_FS_BASE)
  341. genNam(MSR_GS_BASE)
  342. genNam(MSR_GS_SWAP)
  343. genNam(MSR_MCG_STATUS)
  344. genCom("Flags within MSR_EFER")
  345. genNam(MSR_LMA)
  346. genNam(MSR_LME)
  347. genNam(MSR_SCE)
  348. genNam(MSR_NXE)
  349. genNam(MSR_PAT)
  350. genCom("Miscellaneous Definitions")
  351. genNam(MAXIMUM_PROCESSORS)
  352. genNam(INITIAL_STALL_COUNT)
  353. genNam(IRQL_NOT_GREATER_OR_EQUAL)
  354. genNam(IRQL_NOT_LESS_OR_EQUAL)
  355. genNam(MUTEX_ALREADY_OWNED)
  356. genNam(THREAD_NOT_MUTEX_OWNER)
  357. genNam(SPIN_LOCK_ALREADY_OWNED)
  358. genNam(SPIN_LOCK_NOT_OWNED)
  359. genNam(Executive)
  360. genNam(KernelMode)
  361. genNam(UserMode)
  362. genNam(FALSE)
  363. genNam(TRUE)
  364. genNam(KERNEL_MCA_EXCEPTION_STACK_SIZE)
  365. DisableInc (HALAMD64)
  366. genNam(BASE_PRIORITY_THRESHOLD)
  367. genNam(EVENT_PAIR_INCREMENT)
  368. genNam(LOW_REALTIME_PRIORITY)
  369. genVal(BlackHole, 0xffffa000)
  370. genNam(KERNEL_LARGE_STACK_COMMIT)
  371. genNam(KERNEL_STACK_SIZE)
  372. genNam(DOUBLE_FAULT_STACK_SIZE)
  373. genNam(BREAKPOINT_BREAK)
  374. genNam(BREAKPOINT_COMMAND_STRING)
  375. genNam(BREAKPOINT_PRINT)
  376. genNam(BREAKPOINT_PROMPT)
  377. genNam(BREAKPOINT_LOAD_SYMBOLS)
  378. genNam(BREAKPOINT_UNLOAD_SYMBOLS)
  379. genNam(IPI_FREEZE)
  380. genNam(CLOCK_QUANTUM_DECREMENT)
  381. genNam(READY_SKIP_QUANTUM)
  382. genNam(THREAD_QUANTUM)
  383. genNam(WAIT_QUANTUM_DECREMENT)
  384. genNam(ROUND_TRIP_DECREMENT_COUNT)
  385. //
  386. // Exception frame offset definitions.
  387. //
  388. EnableInc (HALAMD64)
  389. genCom("Exception Frame Offset Definitions and Length")
  390. genDef(Ex, KEXCEPTION_FRAME, P1Home)
  391. genDef(Ex, KEXCEPTION_FRAME, P2Home)
  392. genDef(Ex, KEXCEPTION_FRAME, P3Home)
  393. genDef(Ex, KEXCEPTION_FRAME, P4Home)
  394. genDef(Ex, KEXCEPTION_FRAME, P5)
  395. genDef(Ex, KEXCEPTION_FRAME, Xmm6)
  396. genDef(Ex, KEXCEPTION_FRAME, Xmm7)
  397. genDef(Ex, KEXCEPTION_FRAME, Xmm8)
  398. genDef(Ex, KEXCEPTION_FRAME, Xmm9)
  399. genDef(Ex, KEXCEPTION_FRAME, Xmm10)
  400. genDef(Ex, KEXCEPTION_FRAME, Xmm11)
  401. genDef(Ex, KEXCEPTION_FRAME, Xmm12)
  402. genDef(Ex, KEXCEPTION_FRAME, Xmm13)
  403. genDef(Ex, KEXCEPTION_FRAME, Xmm14)
  404. genDef(Ex, KEXCEPTION_FRAME, Xmm15)
  405. genDef(Ex, KEXCEPTION_FRAME, ExceptionRecord)
  406. genDef(Ex, KEXCEPTION_FRAME, Rbp)
  407. genDef(Ex, KEXCEPTION_FRAME, Rbx)
  408. genDef(Ex, KEXCEPTION_FRAME, Rdi)
  409. genDef(Ex, KEXCEPTION_FRAME, Rsi)
  410. genDef(Ex, KEXCEPTION_FRAME, R12)
  411. genDef(Ex, KEXCEPTION_FRAME, R13)
  412. genDef(Ex, KEXCEPTION_FRAME, R14)
  413. genDef(Ex, KEXCEPTION_FRAME, R15)
  414. genDef(Ex, KEXCEPTION_FRAME, Return)
  415. genSpc()
  416. genNam(KEXCEPTION_FRAME_LENGTH)
  417. genNam(EXCEPTION_RECORD_LENGTH)
  418. //
  419. // Jump buffer offset definitions.
  420. //
  421. genCom("Jump Offset Definitions and Length")
  422. genDef(Jb, _JUMP_BUFFER, Frame)
  423. genDef(Jb, _JUMP_BUFFER, Rbx)
  424. genDef(Jb, _JUMP_BUFFER, Rsp)
  425. genDef(Jb, _JUMP_BUFFER, Rbp)
  426. genDef(Jb, _JUMP_BUFFER, Rsi)
  427. genDef(Jb, _JUMP_BUFFER, Rdi)
  428. genDef(Jb, _JUMP_BUFFER, R12)
  429. genDef(Jb, _JUMP_BUFFER, R13)
  430. genDef(Jb, _JUMP_BUFFER, R14)
  431. genDef(Jb, _JUMP_BUFFER, R15)
  432. genDef(Jb, _JUMP_BUFFER, Rip)
  433. genDef(Jb, _JUMP_BUFFER, Xmm6)
  434. genDef(Jb, _JUMP_BUFFER, Xmm7)
  435. genDef(Jb, _JUMP_BUFFER, Xmm8)
  436. genDef(Jb, _JUMP_BUFFER, Xmm9)
  437. genDef(Jb, _JUMP_BUFFER, Xmm10)
  438. genDef(Jb, _JUMP_BUFFER, Xmm11)
  439. genDef(Jb, _JUMP_BUFFER, Xmm12)
  440. genDef(Jb, _JUMP_BUFFER, Xmm13)
  441. genDef(Jb, _JUMP_BUFFER, Xmm14)
  442. genDef(Jb, _JUMP_BUFFER, Xmm15)
  443. //
  444. // Switch frame offset definitions.
  445. //
  446. genCom("Switch Frame Offset Definitions and Length")
  447. genDef(Sw, KSWITCH_FRAME, P5Home)
  448. genDef(Sw, KSWITCH_FRAME, MxCsr)
  449. genDef(Sw, KSWITCH_FRAME, ApcBypass)
  450. genDef(Sw, KSWITCH_FRAME, Rbp)
  451. genDef(Sw, KSWITCH_FRAME, Return)
  452. genSpc()
  453. genNam(KSWITCH_FRAME_LENGTH)
  454. //
  455. // Start system thread frame offset definitions.
  456. //
  457. genCom("Start System Thread Frame Offset Definitions and Length")
  458. genDef(Sf, KSTART_FRAME, P1Home)
  459. genDef(Sf, KSTART_FRAME, P2Home)
  460. genDef(Sf, KSTART_FRAME, P3Home)
  461. genDef(Sf, KSTART_FRAME, Return)
  462. genSpc()
  463. genNam(KSTART_FRAME_LENGTH)
  464. //
  465. // Trap frame offsets definitions.
  466. //
  467. genCom("Trap Frame Offset and EFLAG Definitions and Length")
  468. genNam(EFLAGS_TF_MASK)
  469. genNam(EFLAGS_TF_SHIFT)
  470. genNam(EFLAGS_IF_MASK)
  471. genNam(EFLAGS_IF_SHIFT)
  472. genNam(EFLAGS_USER_SANITIZE)
  473. genSpc()
  474. genOff(Tr, KTRAP_FRAME, P1Home, 128)
  475. genOff(Tr, KTRAP_FRAME, P2Home, 128)
  476. genOff(Tr, KTRAP_FRAME, P3Home, 128)
  477. genOff(Tr, KTRAP_FRAME, P4Home, 128)
  478. genOff(Tr, KTRAP_FRAME, P5, 128)
  479. genOff(Tr, KTRAP_FRAME, PreviousMode, 128)
  480. genOff(Tr, KTRAP_FRAME, PreviousIrql, 128)
  481. genOff(Tr, KTRAP_FRAME, FaultIndicator, 128)
  482. genOff(Tr, KTRAP_FRAME, MxCsr, 128)
  483. genOff(Tr, KTRAP_FRAME, Rax, 128)
  484. genOff(Tr, KTRAP_FRAME, Rcx, 128)
  485. genOff(Tr, KTRAP_FRAME, Rdx, 128)
  486. genOff(Tr, KTRAP_FRAME, R8, 128)
  487. genOff(Tr, KTRAP_FRAME, R9, 128)
  488. genOff(Tr, KTRAP_FRAME, R10, 128)
  489. genOff(Tr, KTRAP_FRAME, R11, 128)
  490. genOff(Tr, KTRAP_FRAME, Xmm0, 128)
  491. genOff(Tr, KTRAP_FRAME, Xmm1, 128)
  492. genOff(Tr, KTRAP_FRAME, Xmm2, 128)
  493. genOff(Tr, KTRAP_FRAME, Xmm3, 128)
  494. genOff(Tr, KTRAP_FRAME, Xmm4, 128)
  495. genOff(Tr, KTRAP_FRAME, Xmm5, 128)
  496. genOff(Tr, KTRAP_FRAME, FaultAddress, 128)
  497. genOff(Tr, KTRAP_FRAME, Dr0, 128)
  498. genOff(Tr, KTRAP_FRAME, Dr1, 128)
  499. genOff(Tr, KTRAP_FRAME, Dr2, 128)
  500. genOff(Tr, KTRAP_FRAME, Dr3, 128)
  501. genOff(Tr, KTRAP_FRAME, Dr6, 128)
  502. genOff(Tr, KTRAP_FRAME, Dr7, 128)
  503. genOff(Tr, KTRAP_FRAME, DebugControl, 128)
  504. genOff(Tr, KTRAP_FRAME, LastBranchToRip, 128)
  505. genOff(Tr, KTRAP_FRAME, LastBranchFromRip, 128)
  506. genOff(Tr, KTRAP_FRAME, LastExceptionToRip, 128)
  507. genOff(Tr, KTRAP_FRAME, LastExceptionFromRip, 128)
  508. genOff(Tr, KTRAP_FRAME, SegDs, 128)
  509. genOff(Tr, KTRAP_FRAME, SegEs, 128)
  510. genOff(Tr, KTRAP_FRAME, SegFs, 128)
  511. genOff(Tr, KTRAP_FRAME, SegGs, 128)
  512. genOff(Tr, KTRAP_FRAME, TrapFrame, 128)
  513. genOff(Tr, KTRAP_FRAME, Rbx, 128)
  514. genOff(Tr, KTRAP_FRAME, Rdi, 128)
  515. genOff(Tr, KTRAP_FRAME, Rsi, 128)
  516. genOff(Tr, KTRAP_FRAME, Rbp, 128)
  517. genOff(Tr, KTRAP_FRAME, ErrorCode, 128)
  518. genOff(Tr, KTRAP_FRAME, Rip, 128)
  519. genOff(Tr, KTRAP_FRAME, SegCs, 128)
  520. genOff(Tr, KTRAP_FRAME, EFlags, 128)
  521. genOff(Tr, KTRAP_FRAME, Rsp, 128)
  522. genOff(Tr, KTRAP_FRAME, SegSs, 128)
  523. genSpc()
  524. genNam(KTRAP_FRAME_LENGTH)
  525. //
  526. // CPU information structure definition.
  527. //
  528. genCom("CPU information structure offset definitions")
  529. genDef(Cpu, CPU_INFO, Eax)
  530. genDef(Cpu, CPU_INFO, Ebx)
  531. genDef(Cpu, CPU_INFO, Ecx)
  532. genDef(Cpu, CPU_INFO, Edx)
  533. //
  534. // Usermode callout user frame definitions.
  535. //
  536. genCom("Usermode Callout User Frame Definitions")
  537. genDef(Ck, UCALLOUT_FRAME, Buffer)
  538. genDef(Ck, UCALLOUT_FRAME, Length)
  539. genDef(Ck, UCALLOUT_FRAME, ApiNumber)
  540. genAlt(CkRsp, UCALLOUT_FRAME, MachineFrame.Rsp)
  541. genAlt(CkRip, UCALLOUT_FRAME, MachineFrame.Rip)
  542. genVal(CalloutFrameLength, sizeof(UCALLOUT_FRAME))
  543. //
  544. // Machine frame offset definitions.
  545. //
  546. genCom("Machine Frame Offset Definitions")
  547. genDef(Mf, MACHINE_FRAME, Rip)
  548. genDef(Mf, MACHINE_FRAME, SegCs)
  549. genDef(Mf, MACHINE_FRAME, EFlags)
  550. genDef(Mf, MACHINE_FRAME, Rsp)
  551. genDef(Mf, MACHINE_FRAME, SegSs)
  552. genVal(MachineFrameLength, sizeof(MACHINE_FRAME))
  553. //
  554. // Floating save structure defintions.
  555. //
  556. genCom("Floating Save Offset Definitions")
  557. genDef(Fs, KFLOATING_SAVE, MxCsr)
  558. //
  559. // LPC structure offset definitions.
  560. //
  561. genCom("LPC Structure Offset Definitions")
  562. genAlt(PmLength, PORT_MESSAGE, u1.Length)
  563. genAlt(PmZeroInit, PORT_MESSAGE, u2.ZeroInit)
  564. genAlt(PmClientId, PORT_MESSAGE, ClientId)
  565. genAlt(PmProcess, PORT_MESSAGE, ClientId.UniqueProcess)
  566. genAlt(PmThread, PORT_MESSAGE, ClientId.UniqueThread)
  567. genAlt(PmMessageId, PORT_MESSAGE, MessageId)
  568. genAlt(PmClientViewSize, PORT_MESSAGE, ClientViewSize)
  569. genVal(PortMessageLength, sizeof(PORT_MESSAGE))
  570. //
  571. // Client ID structure offset definitions
  572. //
  573. genCom("Client Id Structure Offset Definitions")
  574. genDef(Cid, CLIENT_ID, UniqueProcess)
  575. genDef(Cid, CLIENT_ID, UniqueThread)
  576. //
  577. // Context frame offset definitions.
  578. //
  579. genCom("Context Frame Offset and Flag Definitions")
  580. genNam(CONTEXT_FULL)
  581. genNam(CONTEXT_CONTROL)
  582. genNam(CONTEXT_INTEGER)
  583. genNam(CONTEXT_SEGMENTS)
  584. genNam(CONTEXT_FLOATING_POINT)
  585. genNam(CONTEXT_DEBUG_REGISTERS)
  586. genSpc()
  587. genDef(Cx, CONTEXT, P1Home)
  588. genDef(Cx, CONTEXT, P2Home)
  589. genDef(Cx, CONTEXT, P3Home)
  590. genDef(Cx, CONTEXT, P4Home)
  591. genDef(Cx, CONTEXT, P5Home)
  592. genDef(Cx, CONTEXT, P6Home)
  593. genDef(Cx, CONTEXT, ContextFlags)
  594. genDef(Cx, CONTEXT, MxCsr)
  595. genDef(Cx, CONTEXT, SegCs)
  596. genDef(Cx, CONTEXT, SegDs)
  597. genDef(Cx, CONTEXT, SegEs)
  598. genDef(Cx, CONTEXT, SegFs)
  599. genDef(Cx, CONTEXT, SegGs)
  600. genDef(Cx, CONTEXT, SegSs)
  601. genDef(Cx, CONTEXT, EFlags)
  602. genDef(Cx, CONTEXT, Dr0)
  603. genDef(Cx, CONTEXT, Dr1)
  604. genDef(Cx, CONTEXT, Dr2)
  605. genDef(Cx, CONTEXT, Dr3)
  606. genDef(Cx, CONTEXT, Dr6)
  607. genDef(Cx, CONTEXT, Dr7)
  608. genDef(Cx, CONTEXT, Rax)
  609. genDef(Cx, CONTEXT, Rcx)
  610. genDef(Cx, CONTEXT, Rdx)
  611. genDef(Cx, CONTEXT, Rbx)
  612. genDef(Cx, CONTEXT, Rsp)
  613. genDef(Cx, CONTEXT, Rbp)
  614. genDef(Cx, CONTEXT, Rsi)
  615. genDef(Cx, CONTEXT, Rdi)
  616. genDef(Cx, CONTEXT, R8)
  617. genDef(Cx, CONTEXT, R9)
  618. genDef(Cx, CONTEXT, R10)
  619. genDef(Cx, CONTEXT, R11)
  620. genDef(Cx, CONTEXT, R12)
  621. genDef(Cx, CONTEXT, R13)
  622. genDef(Cx, CONTEXT, R14)
  623. genDef(Cx, CONTEXT, R15)
  624. genDef(Cx, CONTEXT, Rip)
  625. genDef(Cx, CONTEXT, Xmm0)
  626. genDef(Cx, CONTEXT, Xmm1)
  627. genDef(Cx, CONTEXT, Xmm2)
  628. genDef(Cx, CONTEXT, Xmm3)
  629. genDef(Cx, CONTEXT, Xmm4)
  630. genDef(Cx, CONTEXT, Xmm5)
  631. genDef(Cx, CONTEXT, Xmm6)
  632. genDef(Cx, CONTEXT, Xmm7)
  633. genDef(Cx, CONTEXT, Xmm8)
  634. genDef(Cx, CONTEXT, Xmm9)
  635. genDef(Cx, CONTEXT, Xmm10)
  636. genDef(Cx, CONTEXT, Xmm11)
  637. genDef(Cx, CONTEXT, Xmm12)
  638. genDef(Cx, CONTEXT, Xmm13)
  639. genDef(Cx, CONTEXT, Xmm14)
  640. genDef(Cx, CONTEXT, Xmm15)
  641. genDef(Cx, CONTEXT, FltSave)
  642. genDef(Cx, CONTEXT, DebugControl)
  643. genDef(Cx, CONTEXT, LastBranchToRip)
  644. genDef(Cx, CONTEXT, LastBranchFromRip)
  645. genDef(Cx, CONTEXT, LastExceptionToRip)
  646. genDef(Cx, CONTEXT, LastExceptionFromRip)
  647. genVal(CONTEXT_FRAME_LENGTH, CONTEXT_LENGTH)
  648. genNam(DR7_ACTIVE)
  649. //
  650. // Exception dispatcher context structure offset definitions.
  651. //
  652. genCom("Dispatcher Context Structure Offset Definitions")
  653. genDef(Dc, DISPATCHER_CONTEXT, ControlPc)
  654. genDef(Dc, DISPATCHER_CONTEXT, ImageBase)
  655. genDef(Dc, DISPATCHER_CONTEXT, FunctionEntry)
  656. genDef(Dc, DISPATCHER_CONTEXT, EstablisherFrame)
  657. genDef(Dc, DISPATCHER_CONTEXT, TargetIp)
  658. genDef(Dc, DISPATCHER_CONTEXT, ContextRecord)
  659. genDef(Dc, DISPATCHER_CONTEXT, LanguageHandler)
  660. genDef(Dc, DISPATCHER_CONTEXT, HandlerData)
  661. genDef(Dc, DISPATCHER_CONTEXT, HistoryTable)
  662. //
  663. // Print floating point field offsets.
  664. //
  665. genCom("Legacy Floating save area field offset definitions")
  666. genDef(Lf, LEGACY_SAVE_AREA, ControlWord)
  667. genDef(Lf, LEGACY_SAVE_AREA, StatusWord)
  668. genDef(Lf, LEGACY_SAVE_AREA, TagWord)
  669. genDef(Lf, LEGACY_SAVE_AREA, ErrorOffset)
  670. genDef(Lf, LEGACY_SAVE_AREA, ErrorOpcode)
  671. genDef(Lf, LEGACY_SAVE_AREA, ErrorSelector)
  672. genDef(Lf, LEGACY_SAVE_AREA, DataOffset)
  673. genDef(Lf, LEGACY_SAVE_AREA, DataSelector)
  674. genDef(Lf, LEGACY_SAVE_AREA, FloatRegisters)
  675. genSpc()
  676. genVal(LEGACY_SAVE_AREA_LENGTH, LEGACY_SAVE_AREA_LENGTH)
  677. //
  678. // Processor State Frame offsets relative to base
  679. //
  680. genCom("Processor State Frame Offset Definitions")
  681. genDef(Ps, KPROCESSOR_STATE, SpecialRegisters)
  682. genAlt(PsCr0, KPROCESSOR_STATE, SpecialRegisters.Cr0)
  683. genAlt(PsCr2, KPROCESSOR_STATE, SpecialRegisters.Cr2)
  684. genAlt(PsCr3, KPROCESSOR_STATE, SpecialRegisters.Cr3)
  685. genAlt(PsCr4, KPROCESSOR_STATE, SpecialRegisters.Cr4)
  686. genAlt(PsKernelDr0, KPROCESSOR_STATE, SpecialRegisters.KernelDr0)
  687. genAlt(PsKernelDr1, KPROCESSOR_STATE, SpecialRegisters.KernelDr1)
  688. genAlt(PsKernelDr2, KPROCESSOR_STATE, SpecialRegisters.KernelDr2)
  689. genAlt(PsKernelDr3, KPROCESSOR_STATE, SpecialRegisters.KernelDr3)
  690. genAlt(PsKernelDr6, KPROCESSOR_STATE, SpecialRegisters.KernelDr6)
  691. genAlt(PsKernelDr7, KPROCESSOR_STATE, SpecialRegisters.KernelDr7)
  692. genAlt(PsGdtr, KPROCESSOR_STATE, SpecialRegisters.Gdtr.Limit)
  693. genAlt(PsIdtr, KPROCESSOR_STATE, SpecialRegisters.Idtr.Limit)
  694. genAlt(PsTr, KPROCESSOR_STATE, SpecialRegisters.Tr)
  695. genAlt(PsLdtr, KPROCESSOR_STATE, SpecialRegisters.Ldtr)
  696. genAlt(PsMxCsr, KPROCESSOR_STATE, SpecialRegisters.MxCsr)
  697. genDef(Ps, KPROCESSOR_STATE, ContextFrame)
  698. genAlt(PsDebugControl, KPROCESSOR_STATE, SpecialRegisters.DebugControl)
  699. genAlt(PsLastBranchToRip, KPROCESSOR_STATE, SpecialRegisters.LastBranchToRip)
  700. genAlt(PsLastBranchFromRip, KPROCESSOR_STATE, SpecialRegisters.LastBranchFromRip)
  701. genAlt(PsLastExceptionToRip, KPROCESSOR_STATE, SpecialRegisters.LastExceptionToRip)
  702. genAlt(PsLastExceptionFromRip, KPROCESSOR_STATE, SpecialRegisters.LastExceptionFromRip)
  703. genAlt(PsCr8, KPROCESSOR_STATE, SpecialRegisters.Cr8)
  704. genVal(ProcessorStateLength, ROUND_UP(sizeof(KPROCESSOR_STATE), 15))
  705. //
  706. // Processor Start Block offsets relative to base
  707. //
  708. genCom("Processor Start Block Offset Definitions")
  709. genDef(Psb, PROCESSOR_START_BLOCK, CompletionFlag)
  710. genDef(Psb, PROCESSOR_START_BLOCK, Gdt32)
  711. genDef(Psb, PROCESSOR_START_BLOCK, Idt32)
  712. genDef(Psb, PROCESSOR_START_BLOCK, Gdt)
  713. genDef(Psb, PROCESSOR_START_BLOCK, TiledCr3)
  714. genDef(Psb, PROCESSOR_START_BLOCK, PmTarget)
  715. genDef(Psb, PROCESSOR_START_BLOCK, LmTarget)
  716. genDef(Psb, PROCESSOR_START_BLOCK, LmIdentityTarget)
  717. genDef(Psb, PROCESSOR_START_BLOCK, SelfMap)
  718. genDef(Psb, PROCESSOR_START_BLOCK, MsrPat)
  719. genDef(Psb, PROCESSOR_START_BLOCK, ProcessorState)
  720. genVal(ProcessorStartBlockLength, sizeof(PROCESSOR_START_BLOCK))
  721. DisableInc (HALAMD64)
  722. //
  723. // E Process fields relative to base
  724. //
  725. genCom("EPROCESS")
  726. genDef(Ep, EPROCESS, DebugPort)
  727. genDef(Ep, EPROCESS, VdmObjects)
  728. //
  729. // Define machine type (temporarily)
  730. //
  731. EnableInc (HALAMD64)
  732. genCom("Machine type definitions (Temporarily)")
  733. genNam(MACHINE_TYPE_ISA)
  734. genNam(MACHINE_TYPE_EISA)
  735. genNam(MACHINE_TYPE_MCA)
  736. DisableInc (HALAMD64)
  737. genCom("KeFeatureBits defines")
  738. genNam(KF_V86_VIS)
  739. genNam(KF_RDTSC)
  740. genNam(KF_CR4)
  741. genNam(KF_GLOBAL_PAGE)
  742. genNam(KF_LARGE_PAGE)
  743. genNam(KF_CMPXCHG8B)
  744. genNam(KF_FAST_SYSCALL)
  745. EnableInc (HALAMD64)
  746. genCom("LoaderParameterBlock offsets relative to base")
  747. genDef(Lpb, LOADER_PARAMETER_BLOCK, LoadOrderListHead)
  748. genDef(Lpb, LOADER_PARAMETER_BLOCK, MemoryDescriptorListHead)
  749. genDef(Lpb, LOADER_PARAMETER_BLOCK, KernelStack)
  750. genDef(Lpb, LOADER_PARAMETER_BLOCK, Prcb)
  751. genDef(Lpb, LOADER_PARAMETER_BLOCK, Process)
  752. genDef(Lpb, LOADER_PARAMETER_BLOCK, Thread)
  753. genAlt(LpbI386, LOADER_PARAMETER_BLOCK, u.I386)
  754. genDef(Lpb, LOADER_PARAMETER_BLOCK, RegistryLength)
  755. genDef(Lpb, LOADER_PARAMETER_BLOCK, RegistryBase)
  756. genDef(Lpb, LOADER_PARAMETER_BLOCK, ConfigurationRoot)
  757. genDef(Lpb, LOADER_PARAMETER_BLOCK, ArcBootDeviceName)
  758. genDef(Lpb, LOADER_PARAMETER_BLOCK, ArcHalDeviceName)
  759. genDef(Lpb, LOADER_PARAMETER_BLOCK, LoadOptions)
  760. DisableInc (HALAMD64)
  761. genNam(PAGE_SIZE)
  762. //
  763. // Usermode callout frame
  764. //
  765. DisableInc (HALAMD64)
  766. genCom("Kernel Mode Callout Frame Definitions")
  767. genDef(Cu, KCALLOUT_FRAME, InitialStack)
  768. genDef(Cu, KCALLOUT_FRAME, TrapFrame)
  769. genDef(Cu, KCALLOUT_FRAME, CallbackStack)
  770. genDef(Cu, KCALLOUT_FRAME, OutputBuffer)
  771. genDef(Cu, KCALLOUT_FRAME, OutputLength)
  772. EnableInc (HALAMD64)
  773. END_LIST
  774. };