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.

959 lines
30 KiB

  1. #ifndef _KDEXTS_IA64_H_
  2. #define _KDEXTS_IA64_H_
  3. /*++
  4. Copyright (c) 1999 Microsoft Corporation
  5. Module Name:
  6. ia64.h
  7. Abstract:
  8. This file contains definitions which are specifice to ia64 platforms
  9. Author:
  10. Kshitiz K. Sharma (kksharma)
  11. Environment:
  12. User Mode.
  13. Revision History:
  14. --*/
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //
  19. // Define base address for kernel and user space
  20. //
  21. #define UREGION_INDEX_IA64 0
  22. #define KREGION_INDEX_IA64 7
  23. #define UADDRESS_BASE_IA64 ((ULONGLONG)UREGION_INDEX_IA64 << 61)
  24. #define KADDRESS_BASE_IA64 ((ULONGLONG)KREGION_INDEX_IA64 << 61)
  25. //
  26. // user/kernel page table base and top addresses
  27. //
  28. #define SADDRESS_BASE_IA64 0x2000000000000000UI64 // session base address
  29. //
  30. // Define the number of bits to shift to left to produce page table offset
  31. // from page table index.
  32. //
  33. #define PTE_SHIFT_IA64 3 // Intel-IA64-Filler
  34. #define PAGE_SHIFT_IA64 13L
  35. #define VRN_MASK_IA64 0xE000000000000000UI64 // Virtual Region Number mask
  36. extern ULONG64 KiIA64VaSignedFill;
  37. extern ULONG64 KiIA64PtaSign;
  38. #define PTA_SIGN_IA64 KiIA64PtaSign
  39. #define VA_FILL_IA64 KiIA64VaSignedFill
  40. #define PTA_BASE_IA64 KiIA64PtaBase
  41. #define PTE_UBASE_IA64 (UADDRESS_BASE_IA64|PTA_BASE_IA64)
  42. #define PTE_KBASE_IA64 (KADDRESS_BASE_IA64|PTA_BASE_IA64)
  43. #define PTE_SBASE_IA64 (SADDRESS_BASE_IA64|PTA_BASE_IA64)
  44. #define PTE_UTOP_IA64 (PTE_UBASE_IA64|(((ULONG64)1 << PDI1_SHIFT_IA64) - 1)) // top level PDR address (user)
  45. #define PTE_KTOP_IA64 (PTE_KBASE_IA64|(((ULONG64)1 << PDI1_SHIFT_IA64) - 1)) // top level PDR address (kernel)
  46. #define PTE_STOP_IA64 (PTE_SBASE_IA64|(((ULONG64)1 << PDI1_SHIFT_IA64) - 1)) // top level PDR address (session)
  47. //
  48. // Second level user and kernel PDR address
  49. //
  50. #define PTI_SHIFT_IA64 PAGE_SHIFT_IA64 // Intel-IA64-Filler
  51. #define PDI_SHIFT_IA64 (PTI_SHIFT_IA64 + PAGE_SHIFT_IA64 - PTE_SHIFT_IA64) // Intel-IA64-Filler
  52. #define PDI1_SHIFT_IA64 (PDI_SHIFT_IA64 + PAGE_SHIFT_IA64 - PTE_SHIFT_IA64) // Intel-IA64-Filler
  53. #define PDE_UBASE_IA64 (PTE_UBASE_IA64|(PTE_UBASE_IA64>>(PTI_SHIFT_IA64-PTE_SHIFT_IA64)))
  54. #define PDE_KBASE_IA64 (PTE_KBASE_IA64|(PTE_KBASE_IA64>>(PTI_SHIFT_IA64-PTE_SHIFT_IA64)))
  55. #define PDE_SBASE_IA64 (PTE_SBASE_IA64|(PTE_SBASE_IA64>>(PTI_SHIFT_IA64-PTE_SHIFT_IA64)))
  56. #define PDE_UTOP_IA64 (PDE_UBASE_IA64|(((ULONG64)1 << PDI_SHIFT_IA64) - 1)) // second level PDR address (user)
  57. #define PDE_KTOP_IA64 (PDE_KBASE_IA64|(((ULONG64)1 << PDI_SHIFT_IA64) - 1)) // second level PDR address (kernel)
  58. #define PDE_STOP_IA64 (PDE_SBASE_IA64|(((ULONG64)1 << PDI_SHIFT_IA64) - 1)) // second level PDR address (session)
  59. //
  60. // 8KB first level user and kernel PDR address
  61. //
  62. #define PDE_UTBASE_IA64 (PTE_UBASE_IA64|(PDE_UBASE_IA64>>(PTI_SHIFT_IA64-PTE_SHIFT_IA64)))
  63. #define PDE_KTBASE_IA64 (PTE_KBASE_IA64|(PDE_KBASE_IA64>>(PTI_SHIFT_IA64-PTE_SHIFT_IA64)))
  64. #define PDE_STBASE_IA64 (PTE_SBASE_IA64|(PDE_SBASE_IA64>>(PTI_SHIFT_IA64-PTE_SHIFT_IA64)))
  65. #define PDE_USELFMAP_IA64 (PDE_UTBASE_IA64|(PAGE_SIZE_IA64 - (1<<PTE_SHIFT_IA64))) // self mapped PPE address (user)
  66. #define PDE_KSELFMAP_IA64 (PDE_KTBASE_IA64|(PAGE_SIZE_IA64 - (1<<PTE_SHIFT_IA64))) // self mapped PPE address (kernel)
  67. #define PDE_SSELFMAP_IA64 (PDE_STBASE_IA64|(PAGE_SIZE_IA64 - (1<<PTE_SHIFT_IA64))) // self mapped PPE address (kernel)
  68. #define PTE_BASE_IA64 PTE_UBASE_IA64
  69. #define PDE_BASE_IA64 PDE_UBASE_IA64
  70. #define PDE_TBASE_IA64 PDE_UTBASE_IA64
  71. #define PDE_SELFMAP_IA64 PDE_USELFMAP_IA64
  72. #define KSEG3_BASE_IA64 0x8000000000000000UI64
  73. #define KSEG3_LIMIT_IA64 0x8000100000000000UI64
  74. #define KUSEG_BASE_IA64 (UADDRESS_BASE_IA64 + 0x0) // base of user segment
  75. #define KSEG0_BASE_IA64 (KADDRESS_BASE_IA64 + 0x80000000) // base of kernel
  76. #define KSEG2_BASE_IA64 (KADDRESS_BASE_IA64 + 0xA0000000) // end of kernel
  77. #define PDE_TOP_IA64 PDE_UTOP_IA64
  78. #define MI_IS_PHYSICAL_ADDRESS_IA64(Va) \
  79. ((((Va) >= KSEG3_BASE_IA64) && ((Va) < KSEG3_LIMIT_IA64)) || \
  80. ((Va >= KSEG0_BASE_IA64) && (Va < KSEG2_BASE_IA64)))
  81. #define _MM_PAGING_FILE_LOW_SHIFT_IA64 28
  82. #define _MM_PAGING_FILE_HIGH_SHIFT_IA64 32
  83. #define MI_PTE_LOOKUP_NEEDED_IA64 ((ULONG64)0xffffffff)
  84. #define PTE_TO_PAGEFILE_OFFSET_IA64(PTE_CONTENTS) ((ULONG64)(PTE_CONTENTS) >> 32)
  85. #define PTI_MASK_IA64 0x00FFE000
  86. //
  87. // Define masks for fields within the PTE.
  88. //
  89. #define MM_PTE_OWNER_MASK_IA64 0x0180
  90. #define MM_PTE_VALID_MASK_IA64 1
  91. #define MM_PTE_ACCESS_MASK_IA64 0x0020
  92. #define MM_PTE_DIRTY_MASK_IA64 0x0040
  93. #define MM_PTE_EXECUTE_MASK_IA64 0x0200
  94. #define MM_PTE_WRITE_MASK_IA64 0x0400
  95. #define MM_PTE_LARGE_PAGE_MASK_IA64 4
  96. #define MM_PTE_COPY_ON_WRITE_MASK_IA64 ((ULONG)1 << (PAGE_SHIFT_IA64-1))
  97. #define MM_PTE_PROTOTYPE_MASK_IA64 0x0002
  98. #define MM_PTE_TRANSITION_MASK_IA64 0x0080
  99. #define MM_PTE_PROTECTION_MASK_IA64 0x7c
  100. #define MM_PTE_PAGEFILE_MASK_IA64 0xf0000000
  101. #define MM_SESSION_SPACE_DEFAULT_IA64 (0x2000000000000000UI64) // make it the region 1 space
  102. //
  103. // Define Interruption Function State (IFS) Register
  104. //
  105. // IFS bit field positions
  106. //
  107. #define IFS_IFM_IA64 _IA64 0
  108. #define IFS_IFM_LEN_IA64 38
  109. #define IFS_MBZ0_IA64 38
  110. #define IFS_MBZ0_V_IA64 0x1ffffffi64
  111. #define IFS_V_IA64 63
  112. #define IFS_V_LEN_IA64 1
  113. //
  114. // IFS is valid when IFS_V = IFS_VALID
  115. //
  116. #define IFS_VALID_IA64 1
  117. //
  118. // define the width of each size field in PFS/IFS
  119. //
  120. #define PFS_EC_SHIFT_IA64 52
  121. #define PFS_EC_SIZE_IA64 6
  122. #define PFS_EC_MASK_IA64 0x3F
  123. #define PFS_SIZE_SHIFT_IA64 7
  124. #define PFS_SIZE_MASK_IA64 0x7F
  125. #define NAT_BITS_PER_RNAT_REG_IA64 63
  126. #define RNAT_ALIGNMENT_IA64 (NAT_BITS_PER_RNAT_REG_IA64 << 3)
  127. //
  128. // Define Region Register (RR)
  129. //
  130. // RR bit field positions
  131. //
  132. #define RR_VE_IA64 0
  133. #define RR_MBZ0_IA64 1
  134. #define RR_PS_IA64 2
  135. #define RR_PS_LEN_IA64 6
  136. #define RR_RID_IA64 8
  137. #define RR_RID_LEN_IA64 24
  138. #define RR_MBZ1_IA64 32
  139. //
  140. // indirect mov index for loading RR
  141. //
  142. #define RR_INDEX_IA64 61
  143. #define RR_INDEX_LEN_IA64 3
  144. #ifndef CONTEXT_i386
  145. #define CONTEXT_i386 0x00010000 // this assumes that i386 and
  146. #endif
  147. // Please contact INTEL to get IA64-specific information
  148. // @@BEGIN_DDKSPLIT
  149. #define CONTEXT_IA64 0x00080000 // Intel-IA64-Filler
  150. #define CONTEXTIA64_CONTROL (CONTEXT_IA64 | 0x00000001L) // Intel-IA64-Filler
  151. #define CONTEXTIA64_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L) // Intel-IA64-Filler
  152. #define CONTEXTIA64_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L) // Intel-IA64-Filler
  153. #define CONTEXTIA64_INTEGER (CONTEXT_IA64 | 0x00000008L) // Intel-IA64-Filler
  154. #define CONTEXTIA64_DEBUG (CONTEXT_IA64 | 0x00000010L) // Intel-IA64-Filler
  155. #define CONTEXTIA64_FLOATING_POINT (CONTEXTIA64_LOWER_FLOATING_POINT | CONTEXTIA64_HIGHER_FLOATING_POINT) // Intel-IA64-Filler
  156. #define CONTEXTIA64_FULL (CONTEXTIA64_CONTROL | CONTEXTIA64_FLOATING_POINT | CONTEXTIA64_INTEGER) // Intel-IA64-Filler
  157. // User / System mask
  158. #define IA64_PSR_MBZ4 0
  159. #define IA64_PSR_BE 1
  160. #define IA64_PSR_UP 2
  161. #define IA64_PSR_AC 3
  162. #define IA64_PSR_MFL 4
  163. #define IA64_PSR_MFH 5
  164. // PSR bits 6-12 reserved (must be zero)
  165. #define IA64_PSR_MBZ0 6
  166. #define IA64_PSR_MBZ0_V 0x1ffi64
  167. // System only mask
  168. #define IA64_PSR_IC 13
  169. #define IA64_PSR_I 14
  170. #define IA64_PSR_PK 15
  171. #define IA64_PSR_MBZ1 16
  172. #define IA64_PSR_MBZ1_V 0x1i64
  173. #define IA64_PSR_DT 17
  174. #define IA64_PSR_DFL 18
  175. #define IA64_PSR_DFH 19
  176. #define IA64_PSR_SP 20
  177. #define IA64_PSR_PP 21
  178. #define IA64_PSR_DI 22
  179. #define IA64_PSR_SI 23
  180. #define IA64_PSR_DB 24
  181. #define IA64_PSR_LP 25
  182. #define IA64_PSR_TB 26
  183. #define IA64_PSR_RT 27
  184. // PSR bits 28-31 reserved (must be zero)
  185. #define IA64_PSR_MBZ2 28
  186. #define IA64_PSR_MBZ2_V 0xfi64
  187. // Neither mask
  188. #define IA64_PSR_CPL 32
  189. #define IA64_PSR_CPL_LEN 2
  190. #define IA64_PSR_IS 34
  191. #define IA64_PSR_MC 35
  192. #define IA64_PSR_IT 36
  193. #define IA64_PSR_ID 37
  194. #define IA64_PSR_DA 38
  195. #define IA64_PSR_DD 39
  196. #define IA64_PSR_SS 40
  197. #define IA64_PSR_RI 41
  198. #define IA64_PSR_RI_LEN 2
  199. #define IA64_PSR_ED 43
  200. #define IA64_PSR_BN 44
  201. // PSR bits 45-63 reserved (must be zero)
  202. #define IA64_PSR_MBZ3 45
  203. #define IA64_PSR_MBZ3_V 0xfffffi64
  204. //
  205. // Define IA64 specific read control space commands for the
  206. // Kernel Debugger.
  207. //
  208. #define DEBUG_CONTROL_SPACE_PCR_IA64 1
  209. #define DEBUG_CONTROL_SPACE_PRCB_IA64 2
  210. #define DEBUG_CONTROL_SPACE_KSPECIAL_IA64 3
  211. #define DEBUG_CONTROL_SPACE_THREAD_IA64 4
  212. /////////////////////////////////////////////
  213. //
  214. // Generic EM Registers definitions
  215. //
  216. /////////////////////////////////////////////
  217. typedef unsigned __int64 EM_REG;
  218. typedef EM_REG *PEM_REG;
  219. #define EM_REG_BITS (sizeof(EM_REG) * 8)
  220. __inline EM_REG
  221. ULong64ToEMREG(
  222. IN ULONG64 Val
  223. )
  224. {
  225. return (*((PEM_REG)&Val));
  226. } // ULong64ToEMREG()
  227. __inline ULONG64
  228. EMREGToULong64(
  229. IN EM_REG EmReg
  230. )
  231. {
  232. return (*((PULONG64)&EmReg));
  233. } // EMRegToULong64()
  234. #define DEFINE_ULONG64_TO_EMREG(_EM_REG_TYPE) \
  235. __inline _EM_REG_TYPE \
  236. ULong64To##_EM_REG_TYPE( \
  237. IN ULONG64 Val \
  238. ) \
  239. { \
  240. return (*((P##_EM_REG_TYPE)&Val)); \
  241. } // ULong64To##_EM_REG_TYPE()
  242. #define DEFINE_EMREG_TO_ULONG64(_EM_REG_TYPE) \
  243. __inline ULONG64 \
  244. _EM_REG_TYPE##ToULong64( \
  245. IN _EM_REG_TYPE EmReg \
  246. ) \
  247. { \
  248. return (*((PULONG64)&EmReg)); \
  249. } // _EM_REG_TYPE##ToULong64()
  250. typedef struct _EM_ISR {
  251. unsigned __int64 code:16; // 0-15 : interruption Code
  252. unsigned __int64 vector:8; // 16-23 : IA32 exception vector number
  253. unsigned __int64 reserved0: 8;
  254. unsigned __int64 x:1; // 32 : Execute exception
  255. unsigned __int64 w:1; // 33 : Write exception
  256. unsigned __int64 r:1; // 34 : Read exception
  257. unsigned __int64 na:1; // 35 : Non-Access exception
  258. unsigned __int64 sp:1; // 36 : Speculative load exception
  259. unsigned __int64 rs:1; // 37 : Register Stack
  260. unsigned __int64 ir:1; // 38 : Invalid Register frame
  261. unsigned __int64 ni:1; // 39 : Nested interruption
  262. unsigned __int64 so:1; // 40 : IA32 Supervisor Override
  263. unsigned __int64 ei:2; // 41-42 : Excepting IA64 Instruction
  264. unsigned __int64 ed:1; // 43 : Exception Differal
  265. unsigned __int64 reserved1:20; // 44-63
  266. } EM_ISR, *PEM_ISR;
  267. DEFINE_ULONG64_TO_EMREG(EM_ISR)
  268. DEFINE_EMREG_TO_ULONG64(EM_ISR)
  269. /////////////////////////////////////////////
  270. //
  271. // Trap.c
  272. //
  273. /////////////////////////////////////////////
  274. VOID
  275. DisplayIsrIA64(
  276. IN const PCHAR Header, // Header string displayed before psr.
  277. IN EM_ISR IsrValue, // ISR value. Use ULong64ToEM_ISR() if needed.
  278. IN DISPLAY_MODE DisplayMode // Display mode.
  279. );
  280. /////////////////////////////////////////////
  281. //
  282. // Psr.c
  283. //
  284. /////////////////////////////////////////////
  285. typedef struct _EM_PSR {
  286. unsigned __int64 reserved0:1; // 0 : reserved
  287. unsigned __int64 be:1; // 1 : Big-Endian
  288. unsigned __int64 up:1; // 2 : User Performance monitor enable
  289. unsigned __int64 ac:1; // 3 : Alignment Check
  290. unsigned __int64 mfl:1; // 4 : Lower (f2 .. f31) floating-point registers written
  291. unsigned __int64 mfh:1; // 5 : Upper (f32 .. f127) floating-point registers written
  292. unsigned __int64 reserved1:7; // 6-12 : reserved
  293. unsigned __int64 ic:1; // 13 : Interruption Collection
  294. unsigned __int64 i:1; // 14 : Interrupt Bit
  295. unsigned __int64 pk:1; // 15 : Protection Key enable
  296. unsigned __int64 reserved2:1; // 16 : reserved
  297. unsigned __int64 dt:1; // 17 : Data Address Translation
  298. unsigned __int64 dfl:1; // 18 : Disabled Floating-point Low register set
  299. unsigned __int64 dfh:1; // 19 : Disabled Floating-point High register set
  300. unsigned __int64 sp:1; // 20 : Secure Performance monitors
  301. unsigned __int64 pp:1; // 21 : Privileged Performance monitor enable
  302. unsigned __int64 di:1; // 22 : Disable Instruction set transition
  303. unsigned __int64 si:1; // 23 : Secure Interval timer
  304. unsigned __int64 db:1; // 24 : Debug Breakpoint fault
  305. unsigned __int64 lp:1; // 25 : Lower Privilege transfer trap
  306. unsigned __int64 tb:1; // 26 : Taken Branch trap
  307. unsigned __int64 rt:1; // 27 : Register stack translation
  308. unsigned __int64 reserved3:4; // 28-31 : reserved
  309. unsigned __int64 cpl:2; // 32;33 : Current Privilege Level
  310. unsigned __int64 is:1; // 34 : Instruction Set
  311. unsigned __int64 mc:1; // 35 : Machine Abort Mask
  312. unsigned __int64 it:1; // 36 : Instruction address Translation
  313. unsigned __int64 id:1; // 37 : Instruction Debug fault disable
  314. unsigned __int64 da:1; // 38 : Disable Data Access and Dirty-bit faults
  315. unsigned __int64 dd:1; // 39 : Data Debug fault disable
  316. unsigned __int64 ss:1; // 40 : Single Step enable
  317. unsigned __int64 ri:2; // 41;42 : Restart Instruction
  318. unsigned __int64 ed:1; // 43 : Exception Deferral
  319. unsigned __int64 bn:1; // 44 : register Bank
  320. unsigned __int64 ia:1; // 45 : Disable Instruction Access-bit faults
  321. unsigned __int64 reserved4:18; // 46-63 : reserved
  322. } EM_PSR, *PEM_PSR;
  323. typedef EM_PSR EM_IPSR;
  324. typedef EM_IPSR *PEM_IPSR;
  325. DEFINE_ULONG64_TO_EMREG(EM_PSR)
  326. DEFINE_EMREG_TO_ULONG64(EM_PSR)
  327. VOID
  328. DisplayPsrIA64(
  329. IN const PCHAR Header, // Header string displayed before psr.
  330. IN EM_PSR PsrValue, // PSR value. Use ULong64ToEM_PSR() if needed.
  331. IN DISPLAY_MODE DisplayMode // Display mode.
  332. );
  333. typedef struct _EM_PSP {
  334. unsigned __int64 reserved0:2; // 0-1 : reserved
  335. unsigned __int64 rz:1; // 2 : Rendez-vous successful
  336. unsigned __int64 ra:1; // 3 : Rendez-vous attempted
  337. unsigned __int64 me:1; // 4 : Distinct Multiple errors
  338. unsigned __int64 mn:1; // 5 : Min-state Save Area registered
  339. unsigned __int64 sy:1; // 6 : Storage integrity synchronized
  340. unsigned __int64 co:1; // 7 : Continuable
  341. unsigned __int64 ci:1; // 8 : Machine Check isolated
  342. unsigned __int64 us:1; // 9 : Uncontained Storage damage
  343. unsigned __int64 hd:1; // 10 : Hardware damage
  344. unsigned __int64 tl:1; // 11 : Trap lost
  345. unsigned __int64 mi:1; // 12 : More Information
  346. unsigned __int64 pi:1; // 13 : Precise Instruction pointer
  347. unsigned __int64 pm:1; // 14 : Precise Min-state Save Area
  348. unsigned __int64 dy:1; // 15 : Processor Dynamic State valid
  349. unsigned __int64 in:1; // 16 : INIT interruption
  350. unsigned __int64 rs:1; // 17 : RSE valid
  351. unsigned __int64 cm:1; // 18 : Machine Check corrected
  352. unsigned __int64 ex:1; // 19 : Machine Check expected
  353. unsigned __int64 cr:1; // 20 : Control Registers valid
  354. unsigned __int64 pc:1; // 21 : Performance Counters valid
  355. unsigned __int64 dr:1; // 22 : Debug Registers valid
  356. unsigned __int64 tr:1; // 23 : Translation Registers valid
  357. unsigned __int64 rr:1; // 24 : Region Registers valid
  358. unsigned __int64 ar:1; // 25 : Application Registers valid
  359. unsigned __int64 br:1; // 26 : Branch Registers valid
  360. unsigned __int64 pr:1; // 27 : Predicate Registers valid
  361. unsigned __int64 fp:1; // 28 : Floating-Point Registers valid
  362. unsigned __int64 b1:1; // 29 : Preserved Bank 1 General Registers valid
  363. unsigned __int64 b0:1; // 30 : Preserved Bank 0 General Registers valid
  364. unsigned __int64 gr:1; // 31 : General Registers valid
  365. unsigned __int64 dsize:16; // 32-47 : Processor Dynamic State size
  366. unsigned __int64 reserved1:11; // 48-58 : reserved
  367. unsigned __int64 cc:1; // 59 : Cache Check
  368. unsigned __int64 tc:1; // 60 : TLB Check
  369. unsigned __int64 bc:1; // 61 : Bus Check
  370. unsigned __int64 rc:1; // 62 : Register File Check
  371. unsigned __int64 uc:1; // 63 : Micro-Architectural Check
  372. } EM_PSP, *PEM_PSP;
  373. DEFINE_ULONG64_TO_EMREG(EM_PSP)
  374. DEFINE_EMREG_TO_ULONG64(EM_PSP)
  375. VOID
  376. DisplayPspIA64(
  377. IN const PCHAR Header, // Header string displayed before psr.
  378. IN EM_PSP PspValue, // PSP value. Use ULong64ToEM_PSP() if needed.
  379. IN DISPLAY_MODE DisplayMode // Display mode.
  380. );
  381. /////////////////////////////////////////////
  382. //
  383. // cpuinfo.cpp
  384. //
  385. /////////////////////////////////////////////
  386. extern VOID
  387. ExecCommand(
  388. IN PCSTR Cmd
  389. );
  390. /////////////////////////////////////////////
  391. //
  392. // Pmc.c
  393. //
  394. /////////////////////////////////////////////
  395. VOID
  396. DisplayPmcIA64(
  397. IN const PCHAR Header, // Header string displayed before pmc.
  398. IN ULONG64 PmcValue, // PMC value.
  399. IN DISPLAY_MODE DisplayMode // Display mode.
  400. );
  401. typedef struct _EM_PMC { // Generic PMC register.
  402. unsigned __int64 plm:4; // 0-3 : Privilege Level Mask
  403. unsigned __int64 ev:1; // 4 : External Visibility
  404. unsigned __int64 oi:1; // 5 : Overflow Interrupt
  405. unsigned __int64 pm:1; // 6 : Privilege Mode
  406. unsigned __int64 ignored1:1; // 7 : Ignored
  407. unsigned __int64 es:7; // 8-14 : Event Selection
  408. unsigned __int64 ignored2:1; // 15 : Ignored
  409. unsigned __int64 umask:4; // 16-19 : Event Umask
  410. unsigned __int64 threshold:3; // 20-22 : Event Threshold (3 bits for PMC4-5, 2 for PMC6-7)
  411. unsigned __int64 ignored:1; // 23 : Ignored
  412. unsigned __int64 ism:2; // 24-25 : Instruction Set Mask
  413. unsigned __int64 ignored3:18; // 26-63 : Ignored
  414. } EM_PMC, *PEM_PMC;
  415. VOID
  416. DisplayGenPmcIA64(
  417. IN const PCHAR Header, // Header string displayed before pmc.
  418. IN ULONG64 PmcValue, // PMC value.
  419. IN DISPLAY_MODE DisplayMode // Display mode.
  420. );
  421. DEFINE_ULONG64_TO_EMREG(EM_PMC)
  422. DEFINE_EMREG_TO_ULONG64(EM_PMC)
  423. typedef struct _EM_BTB_PMC { // Branch Trace Buffer PMC register.
  424. unsigned __int64 plm:4; // 0-3 : Privilege Level Mask
  425. unsigned __int64 ignored1:2; // 4-5 : Ignored
  426. unsigned __int64 pm:1; // 6 : Privilege Mode
  427. unsigned __int64 tar:1; // 7 : Target Address Register
  428. unsigned __int64 tm:2; // 8-9 : Taken Mask
  429. unsigned __int64 ptm:2; // 10-11 : Predicted Target Address Mask
  430. unsigned __int64 ppm:2; // 12-13 : Predicted Predicate Mask
  431. unsigned __int64 bpt:1; // 14 : Branch Prediction Table
  432. unsigned __int64 bac:1; // 15 : Branch Address Calculator
  433. unsigned __int64 ignored2:48; // 16-63 : Ignored
  434. } EM_BTB_PMC, *PEM_BTB_PMC;
  435. VOID
  436. DisplayBtbPmcIA64(
  437. IN const PCHAR Header, // Header string displayed before pmc.
  438. IN ULONG64 PmcValue, // PMC value.
  439. IN DISPLAY_MODE DisplayMode // Display mode.
  440. );
  441. DEFINE_ULONG64_TO_EMREG(EM_BTB_PMC)
  442. DEFINE_EMREG_TO_ULONG64(EM_BTB_PMC)
  443. typedef struct _EM_BTB_PMD { // Branch Trace Buffer PMD register.
  444. unsigned __int64 b:1; // 0 : Branch Bit
  445. unsigned __int64 mp:1; // 1 : Mispredict Bit
  446. unsigned __int64 slot:2; // 2-3 : Slot
  447. unsigned __int64 address:60; // 4-63 : Address
  448. } EM_BTB_PMD, *PEM_BTB_PMD;
  449. VOID
  450. DisplayBtbPmdIA64(
  451. IN const PCHAR Header, // Header string displayed before pmc.
  452. IN ULONG64 PmdValue, // PMD value.
  453. IN DISPLAY_MODE DisplayMode // Display mode.
  454. );
  455. DEFINE_ULONG64_TO_EMREG(EM_BTB_PMD)
  456. DEFINE_EMREG_TO_ULONG64(EM_BTB_PMD)
  457. typedef struct _EM_BTB_INDEX_PMD { // Branch Trace Buffer Index Format PMD register.
  458. unsigned __int64 bbi:3; // 0-2 : Branch Buffer Index
  459. unsigned __int64 full:1; // 3 : Full bit
  460. unsigned __int64 ignored:60; // 4-63 : Ignored
  461. } EM_BTB_INDEX_PMD, *PEM_BTB_INDEX_PMD;
  462. VOID
  463. DisplayBtbIndexPmdIA64(
  464. IN const PCHAR Header, // Header string displayed before pmc.
  465. IN ULONG64 PmdValue, // PMD value.
  466. IN DISPLAY_MODE DisplayMode // Display mode.
  467. );
  468. DEFINE_ULONG64_TO_EMREG(EM_BTB_INDEX_PMD)
  469. DEFINE_EMREG_TO_ULONG64(EM_BTB_INDEX_PMD)
  470. /////////////////////////////////////////////
  471. //
  472. // Dcr.c
  473. //
  474. /////////////////////////////////////////////
  475. typedef struct _EM_DCR {
  476. unsigned __int64 pp:1; // 0 : Privileged Performance Monitor Default
  477. unsigned __int64 be:1; // 1 : Big-Endian Default
  478. unsigned __int64 lc:1; // 2 : IA-32 Lock check Enable
  479. unsigned __int64 reserved1:5; // 3-7 : Reserved
  480. unsigned __int64 dm:1; // 8 : Defer TLB Miss faults only
  481. unsigned __int64 dp:1; // 9 : Defer Page Not Present faults only
  482. unsigned __int64 dk:1; // 10 : Defer Key Miss faults only
  483. unsigned __int64 dx:1; // 11 : Defer Key Permission faults only
  484. unsigned __int64 dr:1; // 12 : Defer Access Rights faults only
  485. unsigned __int64 da:1; // 13 : Defer Access Bit faults only
  486. unsigned __int64 dd:1; // 14 : Defer Debug faults only
  487. unsigned __int64 reserved2:49; // 15-63 : Reserved
  488. } EM_DCR, *PEM_DCR;
  489. DEFINE_ULONG64_TO_EMREG(EM_DCR)
  490. DEFINE_EMREG_TO_ULONG64(EM_DCR)
  491. VOID
  492. DisplayDcrIA64(
  493. IN const PCHAR Header, // Header string displayed before dcr.
  494. IN EM_DCR DcrValue, // DCR value. Use ULong64ToEM_DCR() if needed.
  495. IN DISPLAY_MODE DisplayMode // Display mode.
  496. );
  497. /////////////////////////////////////////////
  498. //
  499. // Ih.c
  500. //
  501. /////////////////////////////////////////////
  502. //
  503. // Interruption history
  504. //
  505. // N.B. Currently the history records are saved in the 2nd half of the 8K
  506. // PCR page. Therefore, we can only keep track of up to the latest
  507. // 128 interruption records, each of 32 bytes in size. Also, the PCR
  508. // structure cannot be greater than 4K. In the future, the interruption
  509. // history records may become part of the KPCR structure.
  510. //
  511. typedef struct _IHISTORY_RECORD {
  512. ULONGLONG InterruptionType;
  513. ULONGLONG IIP;
  514. ULONGLONG IPSR;
  515. ULONGLONG Extra0;
  516. } IHISTORY_RECORD;
  517. #define MAX_NUMBER_OF_IHISTORY_RECORDS 128
  518. //
  519. // Branch Trace Buffer history
  520. //
  521. // FIXFIX: MAX_NUMBER_OF_BTB_RECORDS is micro-architecture dependent.
  522. // We should collect this from processor specific data structure.
  523. #define MAX_NUMBER_OF_BTB_RECORDS 8
  524. #define MAX_NUMBER_OF_BTBHISTORY_RECORDS (MAX_NUMBER_OF_BTB_RECORDS + 1 /* HBC */)
  525. /////////////////////////////////////////////
  526. //
  527. // Mca.c
  528. //
  529. //
  530. /////////////////////////////////////////////
  531. //
  532. // IA64 ERRORS: ERROR_SEVERITY definitions
  533. //
  534. // One day the MS compiler will support typed enums with type != int so this
  535. // type of enums (USHORT, __int64) could be defined...
  536. //
  537. #define ErrorRecoverable_IA64 ((USHORT)0)
  538. #define ErrorFatal_IA64 ((USHORT)1)
  539. #define ErrorCorrected_IA64 ((USHORT)2)
  540. // ErrorOthers : Reserved
  541. typedef enum {
  542. CACHE_CHECK_TYPE,
  543. TLB_CHECK_TYPE,
  544. BUS_CHECK_TYPE,
  545. REG_FILE_CHECK_TYPE,
  546. MS_CHECK_TYPE
  547. } CHECK_TYPES;
  548. //
  549. // Flag types to control output of !mca for IA64
  550. //
  551. #define ERROR_SECTION_PROCESSOR_FLAG 0x0000000000000001I64
  552. #define ERROR_SECTION_PLATFORM_SPECIFIC_FLAG 0x0000000000000002I64
  553. #define ERROR_SECTION_MEMORY_FLAG 0x0000000000000004I64
  554. #define ERROR_SECTION_PCI_COMPONENT_FLAG 0x0000000000000008I64
  555. #define ERROR_SECTION_PCI_BUS_FLAG 0x0000000000000010I64
  556. #define ERROR_SECTION_SYSTEM_EVENT_LOG_FLAG 0x0000000000000020I64
  557. #define ERROR_SECTION_PLATFORM_HOST_CONTROLLER_FLAG 0x0000000000000040I64
  558. #define ERROR_SECTION_PLATFORM_BUS_FLAG 0x0000000000000080I64
  559. typedef struct _PROCESSOR_CONTROL_REGISTERS_IA64 {
  560. ULONGLONG DCR;
  561. ULONGLONG ITM;
  562. ULONGLONG IVA;
  563. ULONGLONG CR3;
  564. ULONGLONG CR4;
  565. ULONGLONG CR5;
  566. ULONGLONG CR6;
  567. ULONGLONG CR7;
  568. ULONGLONG PTA;
  569. ULONGLONG GPTA;
  570. ULONGLONG CR10;
  571. ULONGLONG CR11;
  572. ULONGLONG CR12;
  573. ULONGLONG CR13;
  574. ULONGLONG CR14;
  575. ULONGLONG CR15;
  576. ULONGLONG IPSR;
  577. ULONGLONG ISR;
  578. ULONGLONG CR18;
  579. ULONGLONG IIP;
  580. ULONGLONG IFA;
  581. ULONGLONG ITIR;
  582. ULONGLONG IFS;
  583. ULONGLONG IIM;
  584. ULONGLONG IHA;
  585. ULONGLONG CR26;
  586. ULONGLONG CR27;
  587. ULONGLONG CR28;
  588. ULONGLONG CR29;
  589. ULONGLONG CR30;
  590. ULONGLONG CR31;
  591. ULONGLONG CR32;
  592. ULONGLONG CR33;
  593. ULONGLONG CR34;
  594. ULONGLONG CR35;
  595. ULONGLONG CR36;
  596. ULONGLONG CR37;
  597. ULONGLONG CR38;
  598. ULONGLONG CR39;
  599. ULONGLONG CR40;
  600. ULONGLONG CR41;
  601. ULONGLONG CR42;
  602. ULONGLONG CR43;
  603. ULONGLONG CR44;
  604. ULONGLONG CR45;
  605. ULONGLONG CR46;
  606. ULONGLONG CR47;
  607. ULONGLONG CR48;
  608. ULONGLONG CR49;
  609. ULONGLONG CR50;
  610. ULONGLONG CR51;
  611. ULONGLONG CR52;
  612. ULONGLONG CR53;
  613. ULONGLONG CR54;
  614. ULONGLONG CR55;
  615. ULONGLONG CR56;
  616. ULONGLONG CR57;
  617. ULONGLONG CR58;
  618. ULONGLONG CR59;
  619. ULONGLONG CR60;
  620. ULONGLONG CR61;
  621. ULONGLONG CR62;
  622. ULONGLONG CR63;
  623. ULONGLONG LID;
  624. ULONGLONG IVR;
  625. ULONGLONG TPR;
  626. ULONGLONG EOI;
  627. ULONGLONG IRR0;
  628. ULONGLONG IRR1;
  629. ULONGLONG IRR2;
  630. ULONGLONG IRR3;
  631. ULONGLONG ITV;
  632. ULONGLONG PMV;
  633. ULONGLONG CMCV;
  634. ULONGLONG CR75;
  635. ULONGLONG CR76;
  636. ULONGLONG CR77;
  637. ULONGLONG CR78;
  638. ULONGLONG CR79;
  639. ULONGLONG LRR0;
  640. ULONGLONG LRR1;
  641. ULONGLONG CR82;
  642. ULONGLONG CR83;
  643. ULONGLONG CR84;
  644. ULONGLONG CR85;
  645. ULONGLONG CR86;
  646. ULONGLONG CR87;
  647. ULONGLONG CR88;
  648. ULONGLONG CR89;
  649. ULONGLONG CR90;
  650. ULONGLONG CR91;
  651. ULONGLONG CR92;
  652. ULONGLONG CR93;
  653. ULONGLONG CR94;
  654. ULONGLONG CR95;
  655. ULONGLONG CR96;
  656. ULONGLONG CR97;
  657. ULONGLONG CR98;
  658. ULONGLONG CR99;
  659. ULONGLONG CR100;
  660. ULONGLONG CR101;
  661. ULONGLONG CR102;
  662. ULONGLONG CR103;
  663. ULONGLONG CR104;
  664. ULONGLONG CR105;
  665. ULONGLONG CR106;
  666. ULONGLONG CR107;
  667. ULONGLONG CR108;
  668. ULONGLONG CR109;
  669. ULONGLONG CR110;
  670. ULONGLONG CR111;
  671. ULONGLONG CR112;
  672. ULONGLONG CR113;
  673. ULONGLONG CR114;
  674. ULONGLONG CR115;
  675. ULONGLONG CR116;
  676. ULONGLONG CR117;
  677. ULONGLONG CR118;
  678. ULONGLONG CR119;
  679. ULONGLONG CR120;
  680. ULONGLONG CR121;
  681. ULONGLONG CR122;
  682. ULONGLONG CR123;
  683. ULONGLONG CR124;
  684. ULONGLONG CR125;
  685. ULONGLONG CR126;
  686. ULONGLONG CR127;
  687. } PROCESSOR_CONTROL_REGISTERS_IA64, *PPROCESSOR_CONTROL_REGISTERS_IA64;
  688. typedef struct _PROCESSOR_APPLICATION_REGISTERS_IA64 {
  689. ULONGLONG KR0;
  690. ULONGLONG KR1;
  691. ULONGLONG KR2;
  692. ULONGLONG KR3;
  693. ULONGLONG KR4;
  694. ULONGLONG KR5;
  695. ULONGLONG KR6;
  696. ULONGLONG KR7;
  697. ULONGLONG AR8;
  698. ULONGLONG AR9;
  699. ULONGLONG AR10;
  700. ULONGLONG AR11;
  701. ULONGLONG AR12;
  702. ULONGLONG AR13;
  703. ULONGLONG AR14;
  704. ULONGLONG AR15;
  705. ULONGLONG RSC;
  706. ULONGLONG BSP;
  707. ULONGLONG BSPSTORE;
  708. ULONGLONG RNAT;
  709. ULONGLONG AR20;
  710. ULONGLONG FCR;
  711. ULONGLONG AR22;
  712. ULONGLONG AR23;
  713. ULONGLONG EFLAG;
  714. ULONGLONG CSD;
  715. ULONGLONG SSD;
  716. ULONGLONG CFLG;
  717. ULONGLONG FSR;
  718. ULONGLONG FIR;
  719. ULONGLONG FDR;
  720. ULONGLONG AR31;
  721. ULONGLONG CCV;
  722. ULONGLONG AR33;
  723. ULONGLONG AR34;
  724. ULONGLONG AR35;
  725. ULONGLONG UNAT;
  726. ULONGLONG AR37;
  727. ULONGLONG AR38;
  728. ULONGLONG AR39;
  729. ULONGLONG FPSR;
  730. ULONGLONG AR41;
  731. ULONGLONG AR42;
  732. ULONGLONG AR43;
  733. ULONGLONG ITC;
  734. ULONGLONG AR45;
  735. ULONGLONG AR46;
  736. ULONGLONG AR47;
  737. ULONGLONG AR48;
  738. ULONGLONG AR49;
  739. ULONGLONG AR50;
  740. ULONGLONG AR51;
  741. ULONGLONG AR52;
  742. ULONGLONG AR53;
  743. ULONGLONG AR54;
  744. ULONGLONG AR55;
  745. ULONGLONG AR56;
  746. ULONGLONG AR57;
  747. ULONGLONG AR58;
  748. ULONGLONG AR59;
  749. ULONGLONG AR60;
  750. ULONGLONG AR61;
  751. ULONGLONG AR62;
  752. ULONGLONG AR63;
  753. ULONGLONG PFS;
  754. ULONGLONG LC;
  755. ULONGLONG EC;
  756. ULONGLONG AR67;
  757. ULONGLONG AR68;
  758. ULONGLONG AR69;
  759. ULONGLONG AR70;
  760. ULONGLONG AR71;
  761. ULONGLONG AR72;
  762. ULONGLONG AR73;
  763. ULONGLONG AR74;
  764. ULONGLONG AR75;
  765. ULONGLONG AR76;
  766. ULONGLONG AR77;
  767. ULONGLONG AR78;
  768. ULONGLONG AR79;
  769. ULONGLONG AR80;
  770. ULONGLONG AR81;
  771. ULONGLONG AR82;
  772. ULONGLONG AR83;
  773. ULONGLONG AR84;
  774. ULONGLONG AR85;
  775. ULONGLONG AR86;
  776. ULONGLONG AR87;
  777. ULONGLONG AR88;
  778. ULONGLONG AR89;
  779. ULONGLONG AR90;
  780. ULONGLONG AR91;
  781. ULONGLONG AR92;
  782. ULONGLONG AR93;
  783. ULONGLONG AR94;
  784. ULONGLONG AR95;
  785. ULONGLONG AR96;
  786. ULONGLONG AR97;
  787. ULONGLONG AR98;
  788. ULONGLONG AR99;
  789. ULONGLONG AR100;
  790. ULONGLONG AR101;
  791. ULONGLONG AR102;
  792. ULONGLONG AR103;
  793. ULONGLONG AR104;
  794. ULONGLONG AR105;
  795. ULONGLONG AR106;
  796. ULONGLONG AR107;
  797. ULONGLONG AR108;
  798. ULONGLONG AR109;
  799. ULONGLONG AR110;
  800. ULONGLONG AR111;
  801. ULONGLONG AR112;
  802. ULONGLONG AR113;
  803. ULONGLONG AR114;
  804. ULONGLONG AR115;
  805. ULONGLONG AR116;
  806. ULONGLONG AR117;
  807. ULONGLONG AR118;
  808. ULONGLONG AR119;
  809. ULONGLONG AR120;
  810. ULONGLONG AR121;
  811. ULONGLONG AR122;
  812. ULONGLONG AR123;
  813. ULONGLONG AR124;
  814. ULONGLONG AR125;
  815. ULONGLONG AR126;
  816. ULONGLONG AR127;
  817. } PROCESSOR_APPLICATION_REGISTERS_IA64, *PPROCESSOR_APPLICATION_REGISTERS_IA64;
  818. #ifdef __cplusplus
  819. }
  820. #endif
  821. #endif