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.

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