ia64.h
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 101k
Category:

Windows Develop

Development Platform:

Visual C++

  1. /*++
  2. Module Name:
  3.     ia64.h
  4. Abstract:
  5.     This module contains the IA64 hardware specific header file.
  6. Author:
  7.     David N. Cutler (davec) 31-Mar-1990
  8. Revision History:
  9.     Bernard Lint 6-Jun-1995: IA64 version based on MIPS version.
  10. --*/
  11. #ifndef _IA64H_
  12. #define _IA64H_
  13. //
  14. // Interruption history
  15. //
  16. // N.B. Currently the history records are saved in the 2nd half of the 8K 
  17. //      PCR page.  Therefore, we can only keep track of up to the latest
  18. //      128 interruption records, each of 32 bytes in size.  Also, the PCR
  19. //      structure cannot be greater than 4K.  In the future, the interruption
  20. //      history records may become part of the KPCR structure.
  21. //
  22. typedef struct _IHISTORY_RECORD {
  23.     ULONGLONG InterruptionType;
  24.     ULONGLONG IIP;
  25.     ULONGLONG IPSR;
  26.     ULONGLONG Extra0;
  27. } IHISTORY_RECORD;
  28. #define MAX_NUMBER_OF_IHISTORY_RECORDS  128
  29. //
  30. // For PSR bit field definitions
  31. //
  32. #include "kxia64.h"
  33. // begin_ntddk begin_wdm begin_nthal begin_ntndis
  34. #if defined(_IA64_)
  35. //
  36. // Types to use to contain PFNs and their counts.
  37. //
  38. typedef ULONG PFN_COUNT;
  39. typedef LONG_PTR SPFN_NUMBER, *PSPFN_NUMBER;
  40. typedef ULONG_PTR PFN_NUMBER, *PPFN_NUMBER;    
  41. //
  42. // Define maximum size of flush multiple TB request.
  43. //
  44. #define FLUSH_MULTIPLE_MAXIMUM 100
  45. //
  46. // Indicate that the IA64 compiler supports the pragma textout construct.
  47. //
  48. #define ALLOC_PRAGMA 1
  49. //
  50. // Define intrinsic calls and their prototypes
  51. //
  52. #include "ia64reg.h"
  53. // Please contact INTEL to get IA64-specific information
  54. // @@BEGIN_DDKSPLIT
  55. unsigned __int64 __getReg (int);         // Intel-IA64-Filler
  56. void __setReg (int, unsigned __int64);   // Intel-IA64-Filler
  57. void __isrlz (void);                     // Intel-IA64-Filler
  58. void __dsrlz (void);                     // Intel-IA64-Filler
  59. void __fwb (void);                       // Intel-IA64-Filler
  60. void __mf (void);                        // Intel-IA64-Filler
  61. void __mfa (void);                       // Intel-IA64-Filler
  62. void __synci (void);                     // Intel-IA64-Filler
  63. __int64 __thash (__int64);               // Intel-IA64-Filler
  64. __int64 __ttag (__int64);                // Intel-IA64-Filler
  65. void __ptcl (__int64, __int64);          // Intel-IA64-Filler
  66. void __ptcg (__int64, __int64);          // Intel-IA64-Filler
  67. void __ptcga (__int64, __int64);         // Intel-IA64-Filler
  68. void __ptri (__int64, __int64);          // Intel-IA64-Filler
  69. void __ptrd (__int64, __int64);          // Intel-IA64-Filler
  70. void __invalat (void);                   // Intel-IA64-Filler
  71. void __break (int);                      // Intel-IA64-Filler
  72. void __fc (__int64);                     // Intel-IA64-Filler
  73. void __sum (int);                        // Intel-IA64-Filler
  74. void __rsm (int);                        // Intel-IA64-Filler
  75. #ifdef _M_IA64
  76. #pragma intrinsic (__getReg)             // Intel-IA64-Filler
  77. #pragma intrinsic (__setReg)             // Intel-IA64-Filler
  78. #pragma intrinsic (__isrlz)              // Intel-IA64-Filler
  79. #pragma intrinsic (__dsrlz)              // Intel-IA64-Filler
  80. #pragma intrinsic (__fwb)                // Intel-IA64-Filler
  81. #pragma intrinsic (__mf)                 // Intel-IA64-Filler
  82. #pragma intrinsic (__mfa)                // Intel-IA64-Filler
  83. #pragma intrinsic (__synci)              // Intel-IA64-Filler
  84. #pragma intrinsic (__thash)              // Intel-IA64-Filler
  85. #pragma intrinsic (__ttag)               // Intel-IA64-Filler
  86. #pragma intrinsic (__ptcl)               // Intel-IA64-Filler
  87. #pragma intrinsic (__ptcg)               // Intel-IA64-Filler
  88. #pragma intrinsic (__ptcga)              // Intel-IA64-Filler
  89. #pragma intrinsic (__ptri)               // Intel-IA64-Filler
  90. #pragma intrinsic (__ptrd)               // Intel-IA64-Filler
  91. #pragma intrinsic (__invalat)            // Intel-IA64-Filler
  92. #pragma intrinsic (__break)              // Intel-IA64-Filler
  93. #pragma intrinsic (__fc)                 // Intel-IA64-Filler
  94. #pragma intrinsic (__sum)                // Intel-IA64-Filler
  95. #pragma intrinsic (__rsm)                // Intel-IA64-Filler
  96. #endif // _M_IA64
  97. // @@END_DDKSPLIT
  98. // end_wdm end_ntndis
  99. //
  100. // Define macro to generate import names.
  101. //
  102. #define IMPORT_NAME(name) __imp_##name
  103. // begin_wdm
  104. //
  105. // Define length of interrupt vector table.
  106. //
  107. // Please contact INTEL to get IA64-specific information
  108. #define MAXIMUM_VECTOR 256
  109. // end_wdm
  110. //
  111. // IA64 specific interlocked operation result values.
  112. //
  113. #define RESULT_ZERO 0
  114. #define RESULT_NEGATIVE 1
  115. #define RESULT_POSITIVE 2
  116. //
  117. // Interlocked result type is portable, but its values are machine specific.
  118. // Constants for values are in i386.h, mips.h, etc.
  119. //
  120. typedef enum _INTERLOCKED_RESULT {
  121.     ResultNegative = RESULT_NEGATIVE,
  122.     ResultZero     = RESULT_ZERO,
  123.     ResultPositive = RESULT_POSITIVE
  124. } INTERLOCKED_RESULT;
  125. //
  126. // Convert portable interlock interfaces to architecture specific interfaces.
  127. //
  128. #define ExInterlockedIncrementLong(Addend, Lock) 
  129.     ExIa64InterlockedIncrementLong(Addend)
  130. #define ExInterlockedDecrementLong(Addend, Lock) 
  131.     ExIa64InterlockedDecrementLong(Addend)
  132. #define ExInterlockedExchangeAddLargeInteger(Target, Value, Lock) 
  133.     ExpInterlockedExchangeAddLargeInteger(Target, Value)
  134. #define ExInterlockedExchangeUlong(Target, Value, Lock) 
  135.     ExIa64InterlockedExchangeUlong(Target, Value)
  136. NTKERNELAPI
  137. INTERLOCKED_RESULT
  138. ExIa64InterlockedIncrementLong (
  139.     IN PLONG Addend
  140.     );
  141. NTKERNELAPI
  142. INTERLOCKED_RESULT
  143. ExIa64InterlockedDecrementLong (
  144.     IN PLONG Addend
  145.     );
  146. NTKERNELAPI
  147. LARGE_INTEGER
  148. ExpInterlockedExchangeAddLargeInteger (
  149.     IN PLARGE_INTEGER Addend,
  150.     IN LARGE_INTEGER Increment
  151.     );
  152. NTKERNELAPI
  153. ULONG
  154. ExIa64InterlockedExchangeUlong (
  155.     IN PULONG Target,
  156.     IN ULONG Value
  157.     );
  158. // begin_wdm
  159. //
  160. // IA64 Interrupt Definitions.
  161. //
  162. // Define length of interrupt object dispatch code in longwords.
  163. //
  164. // Please contact INTEL to get IA64-specific information
  165. // @@BEGIN_DDKSPLIT
  166. #define DISPATCH_LENGTH 2*2               // Intel-IA64-Filler ; Length of dispatch code template in 32-bit words
  167. // @@END_DDKSPLIT
  168. //
  169. // Begin of a block of definitions that must be synchronized with kxia64.h.
  170. //
  171. //
  172. // Define Interrupt Request Levels.
  173. //
  174. #define PASSIVE_LEVEL            0      // Passive release level
  175. #define LOW_LEVEL                0      // Lowest interrupt level
  176. #define APC_LEVEL                1      // APC interrupt level
  177. #define DISPATCH_LEVEL           2      // Dispatcher level
  178. #define CMC_LEVEL                3      // Correctable machine check level
  179. #define DEVICE_LEVEL_BASE        4      // 4 - 11 - Device IRQLs
  180. #define PROFILE_LEVEL           12      // Profiling level
  181. #define PC_LEVEL                12      // Performance Counter IRQL
  182. #define SYNCH_LEVEL             (IPI_LEVEL-1)      // Synchronization level
  183. #define IPI_LEVEL               14      // IPI IRQL
  184. #define CLOCK_LEVEL             13      // Clock Timer IRQL
  185. #define POWER_LEVEL             15      // Power failure level
  186. #define HIGH_LEVEL              15      // Highest interrupt level
  187. // Please contact INTEL to get IA64-specific information
  188. // @@BEGIN_DDKSPLIT
  189. //
  190. // The current IRQL is maintained in the TPR.mic field. The         // Intel-IA64-Filler
  191. // shift count is the number of bits to shift right to extract the  // Intel-IA64-Filler
  192. // IRQL from the TPR. See the GET/SET_IRQL macros.                  // Intel-IA64-Filler
  193. //
  194. #define TPR_MIC        4                                            // Intel-IA64-Filler
  195. #define TPR_IRQL_SHIFT TPR_MIC                                      // Intel-IA64-Filler
  196. // To go from vector number <-> IRQL we just do a shift             // Intel-IA64-Filler
  197. #define VECTOR_IRQL_SHIFT TPR_IRQL_SHIFT                            // Intel-IA64-Filler
  198. //                                                                  // Intel-IA64-Filler
  199. // Interrupt Vector Definitions                                     // Intel-IA64-Filler
  200. //                                                                  // Intel-IA64-Filler
  201. #define APC_VECTOR          APC_LEVEL << VECTOR_IRQL_SHIFT          // Intel-IA64-Filler
  202. #define DISPATCH_VECTOR     DISPATCH_LEVEL << VECTOR_IRQL_SHIFT     // Intel-IA64-Filler
  203. // @@END_DDKSPLIT
  204. //
  205. // End of a block of definitions that must be synchronized with kxia64.h.
  206. //
  207. //
  208. // Define profile intervals.
  209. //
  210. #define DEFAULT_PROFILE_COUNT 0x40000000 // ~= 20 seconds @50mhz
  211. #define DEFAULT_PROFILE_INTERVAL (10 * 500) // 500 microseconds
  212. #define MAXIMUM_PROFILE_INTERVAL (10 * 1000 * 1000) // 1 second
  213. #define MINIMUM_PROFILE_INTERVAL (10 * 40) // 40 microseconds
  214. #if defined(_M_IA64) && !defined(RC_INVOKED)
  215. #define InterlockedAdd _InterlockedAdd
  216. #define InterlockedIncrement _InterlockedIncrement
  217. #define InterlockedDecrement _InterlockedDecrement
  218. #define InterlockedExchange _InterlockedExchange
  219. #define InterlockedExchangeAdd _InterlockedExchangeAdd
  220. #define InterlockedAdd64 _InterlockedAdd64
  221. #define InterlockedIncrement64 _InterlockedIncrement64
  222. #define InterlockedDecrement64 _InterlockedDecrement64
  223. #define InterlockedExchange64 _InterlockedExchange64
  224. #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
  225. #define InterlockedCompareExchange64 _InterlockedCompareExchange64
  226. #define InterlockedCompareExchange _InterlockedCompareExchange
  227. #define InterlockedExchangePointer _InterlockedExchangePointer
  228. #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
  229. LONG
  230. __cdecl
  231. InterlockedAdd (
  232.     LONG *Addend,
  233.     LONG Value
  234.     );
  235. LONGLONG
  236. __cdecl
  237. InterlockedAdd64 (
  238.     LONGLONG *Addend,
  239.     LONGLONG Value
  240.     );
  241. LONG
  242. __cdecl
  243. InterlockedIncrement(
  244.     IN OUT PLONG Addend
  245.     );
  246. LONG
  247. __cdecl
  248. InterlockedDecrement(
  249.     IN OUT PLONG Addend
  250.     );
  251. LONG
  252. __cdecl
  253. InterlockedExchange(
  254.     IN OUT PLONG Target,
  255.     IN LONG Value
  256.     );
  257. LONG
  258. __cdecl
  259. InterlockedExchangeAdd(
  260.     IN OUT PLONG Addend,
  261.     IN LONG Value
  262.     );
  263. LONG
  264. __cdecl
  265. InterlockedCompareExchange (
  266.     IN OUT PLONG Destination,
  267.     IN LONG ExChange,
  268.     IN LONG Comperand
  269.     );
  270. LONGLONG
  271. __cdecl
  272. InterlockedIncrement64(
  273.     IN OUT PLONGLONG Addend
  274.     );
  275. LONGLONG
  276. __cdecl
  277. InterlockedDecrement64(
  278.     IN OUT PLONGLONG Addend
  279.     );
  280. LONGLONG
  281. __cdecl
  282. InterlockedExchange64(
  283.     IN OUT PLONGLONG Target,
  284.     IN LONGLONG Value
  285.     );
  286. LONGLONG
  287. __cdecl
  288. InterlockedExchangeAdd64(
  289.     IN OUT PLONGLONG Addend,
  290.     IN LONGLONG Value
  291.     );
  292. LONGLONG
  293. __cdecl
  294. InterlockedCompareExchange64 (
  295.     IN OUT PLONGLONG Destination,
  296.     IN LONGLONG ExChange,
  297.     IN LONGLONG Comperand
  298.     );
  299. PVOID
  300. __cdecl
  301. InterlockedCompareExchangePointer (
  302.     IN OUT PVOID *Destination,
  303.     IN PVOID Exchange,
  304.     IN PVOID Comperand
  305.     );
  306. PVOID
  307. __cdecl
  308. InterlockedExchangePointer(
  309.     IN OUT PVOID *Target,
  310.     IN PVOID Value
  311.     );
  312. #pragma intrinsic(_InterlockedAdd)
  313. #pragma intrinsic(_InterlockedIncrement)
  314. #pragma intrinsic(_InterlockedDecrement)
  315. #pragma intrinsic(_InterlockedExchange)
  316. #pragma intrinsic(_InterlockedCompareExchange)
  317. #pragma intrinsic(_InterlockedExchangeAdd)
  318. #pragma intrinsic(_InterlockedAdd64)
  319. #pragma intrinsic(_InterlockedIncrement64)
  320. #pragma intrinsic(_InterlockedDecrement64)
  321. #pragma intrinsic(_InterlockedExchange64)
  322. #pragma intrinsic(_InterlockedCompareExchange64)
  323. #pragma intrinsic(_InterlockedExchangeAdd64)
  324. #pragma intrinsic(_InterlockedExchangePointer)
  325. #pragma intrinsic(_InterlockedCompareExchangePointer)
  326. #endif // defined(_M_IA64) && !defined(RC_INVOKED)
  327. // end_ntddk end_nthal end_wdm
  328. #define KiSynchIrql SYNCH_LEVEL         // enable portable code
  329. #define KiProfileIrql PROFILE_LEVEL     // enable portable code
  330. // Please contact INTEL to get IA64-specific information
  331. // @@BEGIN_DDKSPLIT
  332. //
  333. // Sanitize FPSR based on processor mode.
  334. //
  335. // If kernel mode, then
  336. //      let caller specify all bits, except reserved
  337. //
  338. // If user mode, then
  339. //      let the caller specify all bits, except reserved
  340. //
  341. #define SANITIZE_FSR(fsr, mode) (  /* Intel-IA64-Filler */ 
  342.     ((mode) == KernelMode ?  /* Intel-IA64-Filler */ 
  343.         ((0x0000000000000000UL) | ((fsr) & ~(MASK_IA64(FPSR_MBZ0,FPSR_MBZ0_V)))) :  /* Intel-IA64-Filler */ 
  344.         ((0x0000000000000000UL) | ((fsr) & ~(MASK_IA64(FPSR_MBZ0,FPSR_MBZ0_V))))  /* Intel-IA64-Filler */ 
  345.     )  /* Intel-IA64-Filler */ 
  346.                                 )  // Intel-IA64-Filler
  347. //
  348. // Define SANITIZE_PSR for IA64     // Intel-IA64-Filler
  349. //
  350. // If kernel mode, then     // Intel-IA64-Filler
  351. //      force clearing of BE, SP, CPL, MC, PK, DFL, reserved (MBZ)     // Intel-IA64-Filler
  352. //      force the setting of IC, DT, DFH, DI, LP, RT, IT      // Intel-IA64-Filler
  353. //      let caller specify UP, AC, I, BN, PP, SI, DB, TB, IS, ID, DA, DD, SS, RI, ED     // Intel-IA64-Filler
  354. //
  355. // If user mode, then     // Intel-IA64-Filler
  356. //      force clearing of MC, PK, LP, reserved     // Intel-IA64-Filler
  357. //      force the setting of BN, IC, I, DT, RT, CPL, IT     // Intel-IA64-Filler
  358. //      let caller specify BE, UP, PP, AC, DFL, DFH, SP, SI, DI, DB, TB, IS, ID, DA, DD, SS, RI, ED     // Intel-IA64-Filler
  359. //
  360. #define PSR_KERNEL_CLR  (MASK_IA64(PSR_BE,1i64) | MASK_IA64(PSR_SP,1i64) | MASK_IA64(PSR_PK,1i64) | /* Intel-IA64-Filler */ 
  361.                          MASK_IA64(PSR_CPL,0x3i64) | MASK_IA64(PSR_MC,1i64) | MASK_IA64(PSR_MBZ0,PSR_MBZ0_V) | /* Intel-IA64-Filler */ 
  362.                          MASK_IA64(PSR_MBZ1,PSR_MBZ1_V) | MASK_IA64(PSR_MBZ2,PSR_MBZ2) | /* Intel-IA64-Filler */ 
  363.                          MASK_IA64(PSR_DFL, 1i64)) // Intel-IA64-Filler
  364. #define PSR_KERNEL_SET  (MASK_IA64(PSR_IC,1i64) | MASK_IA64(PSR_DT,1i64) | MASK_IA64(PSR_DFH,1i64) | /* Intel-IA64-Filler */ 
  365.                          MASK_IA64(PSR_DI,1i64) | MASK_IA64(PSR_IT,1i64) | /* Intel-IA64-Filler */ 
  366.                          MASK_IA64(PSR_RT,1i64)) // Intel-IA64-Filler
  367. #define PSR_KERNEL_CPY  (MASK_IA64(PSR_UP,1i64) | MASK_IA64(PSR_AC,1i64) | /* Intel-IA64-Filler */ 
  368.                          MASK_IA64(PSR_I,1i64) | MASK_IA64(PSR_BN,1i64)  | /* Intel-IA64-Filler */ 
  369.                          MASK_IA64(PSR_PP,1i64) | MASK_IA64(PSR_SI,1i64) | MASK_IA64(PSR_DB,1i64) | /* Intel-IA64-Filler */ 
  370.                          MASK_IA64(PSR_TB,1i64) | MASK_IA64(PSR_IS,1i64) | MASK_IA64(PSR_ID,1i64) | /* Intel-IA64-Filler */ 
  371.                          MASK_IA64(PSR_DA,1i64) | MASK_IA64(PSR_DD,1i64) | MASK_IA64(PSR_SS,1i64) | /* Intel-IA64-Filler */ 
  372.                          MASK_IA64(PSR_RI,0x3i64) | MASK_IA64(PSR_ED,1i64) | MASK_IA64(PSR_LP,1i64)) // Intel-IA64-Filler
  373. #define PSR_USER_CLR    (MASK_IA64(PSR_MC,1i64) | /* Intel-IA64-Filler */ 
  374.                          MASK_IA64(PSR_MBZ0,PSR_MBZ0_V) | MASK_IA64(PSR_PK,1i64) | /* Intel-IA64-Filler */ 
  375.                          MASK_IA64(PSR_MBZ1,PSR_MBZ1_V) | MASK_IA64(PSR_MBZ2,PSR_MBZ2) | /* Intel-IA64-Filler */ 
  376.                          MASK_IA64(PSR_LP,1i64)) // Intel-IA64-Filler
  377. #define PSR_USER_SET    (MASK_IA64(PSR_IC,1i64) | MASK_IA64(PSR_I,1i64)  | /* Intel-IA64-Filler */ 
  378.                          MASK_IA64(PSR_DT,1i64) | MASK_IA64(PSR_BN,1i64) | /* Intel-IA64-Filler */ 
  379.                          MASK_IA64(PSR_RT,1i64) | /* Intel-IA64-Filler */ 
  380.                          MASK_IA64(PSR_CPL,0x3i64) | MASK_IA64(PSR_IT,1i64)) // Intel-IA64-Filler
  381. #define PSR_USER_CPY    (MASK_IA64(PSR_BE,1i64) | MASK_IA64(PSR_UP,1i64) | MASK_IA64(PSR_PP,1i64) |/* Intel-IA64-Filler */ 
  382.                          MASK_IA64(PSR_AC,1i64) | MASK_IA64(PSR_DFL,1i64) | MASK_IA64(PSR_DFH,1i64) | /* Intel-IA64-Filler */ 
  383.                          MASK_IA64(PSR_SP,1i64) | MASK_IA64(PSR_DI,1i64) | MASK_IA64(PSR_DB,1i64) | /* Intel-IA64-Filler */ 
  384.                          MASK_IA64(PSR_TB,1i64) | MASK_IA64(PSR_IS,1i64) | MASK_IA64(PSR_ID,1i64) | /* Intel-IA64-Filler */ 
  385.                          MASK_IA64(PSR_DA,1i64) | MASK_IA64(PSR_DD,1i64) | MASK_IA64(PSR_SS, 1i64) | /* Intel-IA64-Filler */ 
  386.                          MASK_IA64(PSR_RI,0x3i64) | MASK_IA64(PSR_ED,1i64) | MASK_IA64(PSR_SI,1i64)) /* Intel-IA64-Filler */
  387. #define PSR_DEBUG_SET   (MASK_IA64(PSR_DB,1i64) | MASK_IA64(PSR_SS,1i64) | MASK_IA64(PSR_TB,1i64) | /* Intel-IA64-Filler */ 
  388.                          MASK_IA64(PSR_ID,1i64) | MASK_IA64(PSR_DD,1i64)) // Intel-IA64-Filler
  389. #define SANITIZE_PSR(psr, mode) ( /* Intel-IA64-Filler */ 
  390.     ((mode) == KernelMode ? /* Intel-IA64-Filler */ 
  391.         (PSR_KERNEL_SET | ((psr) & (PSR_KERNEL_CPY | ~PSR_KERNEL_CLR))) : /* Intel-IA64-Filler */ 
  392.         (PSR_USER_SET | ((psr) & (PSR_USER_CPY | ~PSR_USER_CLR))) /* Intel-IA64-Filler */ 
  393.     ) /* Intel-IA64-Filler */ 
  394.                                 ) // Intel-IA64-Filler
  395. //
  396. // Define SANITIZE_IFS for IA64
  397. //
  398. #define SANITIZE_IFS(ifs, mode) ( /* Intel-IA64-Filler */ 
  399.     ((mode) == KernelMode ? /* Intel-IA64-Filler */ 
  400.         ((ifs) | (MASK_IA64(IFS_V,1i64))) : /* Intel-IA64-Filler */ 
  401.         (((ifs) | (MASK_IA64(IFS_V,1i64))) & (~MASK_IA64(IFS_MBZ0, (ULONGLONG)IFS_MBZ0_V))) /* Intel-IA64-Filler */ 
  402.     ) /* Intel-IA64-Filler */ 
  403.                                 ) // Intel-IA64-Filler
  404. #define SANITIZE_DCR(dcr, mode) /* Intel-IA64-Filler */ 
  405.     ((mode) == KernelMode ? dcr : USER_DCR_INITIAL) // Intel-IA64-Filler
  406. //
  407. // Macro to sanitize debug registers
  408. //
  409. #define SANITIZE_DR(dr, mode) /* Intel-IA64-Filler */ 
  410.     ((mode) == KernelMode ? /* Intel-IA64-Filler */ 
  411.         (dr) : /* Intel-IA64-Filler */ 
  412.         (dr & ~(0x7i64 << DR_PLM0)) /* disable pl 0-2 */ /* Intel-IA64-Filler */ 
  413.     ) /* Intel-IA64-Filler */
  414. // @@END_DDKSPLIT
  415. // begin_nthal
  416. // Please contact INTEL to get IA64-specific information
  417. // @@BEGIN_DDKSPLIT
  418. //
  419. // Define interrupt request physical address (maps to HAL virtual address)
  420. //
  421. #define INTERRUPT_REQUEST_PHYSICAL_ADDRESS  0xFFE00000 // Intel-IA64-Filler
  422. //
  423. // Define Address of Processor Control Registers. // Intel-IA64-Filler
  424. //
  425. // @@END_DDKSPLIT
  426. //
  427. // Define Pointer to Processor Control Registers.
  428. //
  429. #define KIPCR ((ULONG_PTR)(KADDRESS_BASE + 0xFFFF0000))            // kernel address of first PCR
  430. #define PCR ((volatile KPCR * const)KIPCR)
  431. // begin_ntddk begin_wdm
  432. #define KI_USER_SHARED_DATA ((ULONG_PTR)(KADDRESS_BASE + 0xFFFE0000))
  433. #define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
  434. //
  435. // Prototype for get current IRQL. **** TBD (read TPR)
  436. //
  437. NTKERNELAPI
  438. KIRQL
  439. KeGetCurrentIrql();
  440. // end_wdm
  441. //
  442. // Get address of current processor block.
  443. //
  444. #define KeGetCurrentPrcb() PCR->Prcb
  445. //
  446. // Get address of processor control region.
  447. //
  448. #define KeGetPcr() PCR
  449. //
  450. // Get address of current kernel thread object.
  451. //
  452. #define KeGetCurrentThread() PCR->CurrentThread
  453. //
  454. // Get current processor number.
  455. //
  456. #define KeGetCurrentProcessorNumber() PCR->Number
  457. //
  458. // Get data cache fill size.
  459. //
  460. #define KeGetDcacheFillSize() PCR->DcacheFillSize
  461. // end_ntddk end_nthal
  462. //
  463. // Get previous processor mode.
  464. //
  465. #define KeGetPreviousMode() (KPROCESSOR_MODE)PCR->CurrentThread->PreviousMode
  466. //
  467. // Test if executing a DPC.
  468. //
  469. #define KeIsExecutingDpc() (PCR->Prcb->DpcRoutineActive != 0)
  470. //
  471. // Save & Restore floating point state
  472. //
  473. // begin_ntddk begin_wdm
  474. #define KeSaveFloatingPointState(a)         STATUS_SUCCESS
  475. #define KeRestoreFloatingPointState(a)      STATUS_SUCCESS
  476. // end_ntddk end_wdm
  477. // begin_ntddk begin_nthal begin_ntndis begin_wdm
  478. //
  479. // Define the page size
  480. //
  481. #define PAGE_SIZE 0x2000
  482. //
  483. // Define the number of trailing zeroes in a page aligned virtual address.
  484. // This is used as the shift count when shifting virtual addresses to
  485. // virtual page numbers.
  486. //
  487. #define PAGE_SHIFT 13L
  488. // end_ntddk end_nthal end_ntndis end_wdm
  489. // begin_nthal
  490. //
  491. // IA64 hardware structures
  492. //
  493. // Please contact INTEL to get IA64-specific information
  494. // @@BEGIN_DDKSPLIT
  495. //
  496. // A Page Table Entry on an IA64 has the following definition.
  497. //
  498. #define _HARDWARE_PTE_WORKING_SET_BITS  11 // Intel-IA64-Filler
  499. typedef struct _HARDWARE_PTE {            // Intel-IA64-Filler
  500.     ULONG64 Valid : 1;                    // Intel-IA64-Filler
  501.     ULONG64 Rsvd0 : 1;                    // Intel-IA64-Filler
  502.     ULONG64 Cache : 3;                    // Intel-IA64-Filler
  503.     ULONG64 Accessed : 1;                 // Intel-IA64-Filler
  504.     ULONG64 Dirty : 1;                    // Intel-IA64-Filler
  505.     ULONG64 Owner : 2;                    // Intel-IA64-Filler
  506.     ULONG64 Execute : 1;                  // Intel-IA64-Filler
  507.     ULONG64 Write : 1;                    // Intel-IA64-Filler
  508.     ULONG64 Rsvd1 : PAGE_SHIFT - 12;      // Intel-IA64-Filler
  509.     ULONG64 CopyOnWrite : 1;              // Intel-IA64-Filler
  510.     ULONG64 PageFrameNumber : 50 - PAGE_SHIFT;  // Intel-IA64-Filler
  511.     ULONG64 Rsvd2 : 2;                    // Intel-IA64-Filler
  512.     ULONG64 Exception : 1;                // Intel-IA64-Filler
  513.     ULONGLONG SoftwareWsIndex : _HARDWARE_PTE_WORKING_SET_BITS; // Intel-IA64-Filler
  514. } HARDWARE_PTE, *PHARDWARE_PTE;           // Intel-IA64-Filler
  515. //
  516. // Fill TB entry // Intel-IA64-Filler
  517. //
  518. // Filling TB entry on demand by VHPT H/W seems faster than done by s/w. // Intel-IA64-Filler
  519. // Determining I/D side of TLB, disabling/enabling PSR.i and ic bits, // Intel-IA64-Filler
  520. // serialization, writing to IIP, IDA, IDTR and IITR seem just too much // Intel-IA64-Filler
  521. // compared to VHPT searching it automatically. // Intel-IA64-Filler
  522. //
  523. #define KiVhptEntry(va)  ((PVOID)__thash((__int64)va)) // Intel-IA64-Filler
  524. #define KiVhptEntryTag(va)  ((ULONGLONG)__ttag((__int64)va)) // Intel-IA64-Filler
  525. #define KiFlushSingleTb(Invalid, va)   /* Intel-IA64-Filler */                
  526.     __ptcl((__int64)va,PAGE_SHIFT << 2);  __isrlz() // Intel-IA64-Filler
  527. #define KeFillEntryTb(PointerPte, Virtual, Invalid) /* Intel-IA64-Filler */   
  528.     if (Invalid != FALSE) { /* Intel-IA64-Filler */
  529.        KiFlushSingleTb(0, Virtual);     /* Intel-IA64-Filler */               
  530.     } // Intel-IA64-Filler
  531. #define KiFlushFixedInstTb(Invalid, va)  /* Intel-IA64-Filler */ 
  532.     __ptri((__int64)va, PAGE_SHIFT << 2); __isrlz() // Intel-IA64-Filler
  533. #define KiFlushFixedDataTb(Invalid, va)  /* Intel-IA64-Filler */ 
  534.     __ptrd((__int64)va, PAGE_SHIFT << 2); __dsrlz() // Intel-IA64-Filler
  535. // @@END_DDKSPLIT
  536. NTKERNELAPI
  537. VOID
  538. KeFillLargeEntryTb (
  539.     IN HARDWARE_PTE Pte[2],
  540.     IN PVOID Virtual,
  541.     IN ULONG PageSize
  542.     );
  543. //
  544. // Fill TB fixed entry
  545. //
  546. NTKERNELAPI
  547. VOID
  548. KeFillFixedEntryTb (
  549.     IN HARDWARE_PTE Pte[2],
  550.     IN PVOID Virtual,
  551.     IN ULONG Index
  552.     );
  553. NTKERNELAPI
  554. VOID
  555. KeFillFixedLargeEntryTb (
  556.     IN HARDWARE_PTE Pte[2],
  557.     IN PVOID Virtual,
  558.     IN ULONG PageSize,
  559.     IN ULONG Index
  560.     );
  561. //
  562. // Fill Inst TB entry
  563. //
  564. NTKERNELAPI
  565. VOID
  566. KeFillInstEntryTb (
  567.     IN HARDWARE_PTE Pte,
  568.     IN PVOID Virtual
  569.     );
  570. //
  571. // Get a VHPT entry address
  572. //
  573. PVOID
  574. KiVhptEntry64(
  575.    IN ULONG VirtualPageNumber
  576.    );
  577. //
  578. // Get a VHPT entry TAG value
  579. //
  580. ULONGLONG
  581. KiVhptEntryTag64(
  582.     IN ULONG VirtualPageNumber
  583.     );
  584. //
  585. // Fill a VHPT entry
  586. //
  587. VOID
  588. KiFillEntryVhpt(
  589.    IN PHARDWARE_PTE PointerPte,
  590.    IN PVOID Virtual
  591.    );
  592. //
  593. // Flush the kernel portions of Tb
  594. //
  595. VOID
  596. KeFlushKernelTb(
  597.     IN BOOLEAN AllProcessors
  598.     );
  599. //
  600. // Flush the user portions of Tb
  601. //
  602. VOID
  603. KeFlushUserTb(
  604.     IN BOOLEAN AllProcessors
  605.     );
  606. //
  607. // Data cache, instruction cache, I/O buffer, and write buffer flush routine
  608. // prototypes.
  609. //
  610. NTKERNELAPI
  611. VOID
  612. KeChangeColorPage (
  613.     IN PVOID NewColor,
  614.     IN PVOID OldColor,
  615.     IN ULONG PageFrame
  616.     );
  617. NTKERNELAPI
  618. VOID
  619. KeSweepDcache (
  620.     IN BOOLEAN AllProcessors
  621.     );
  622. #define KeSweepCurrentDcache()
  623. NTKERNELAPI
  624. VOID
  625. KeSweepIcache (
  626.     IN BOOLEAN AllProcessors
  627.     );
  628. #define KeSweepCurrentIcache()
  629. NTKERNELAPI
  630. VOID
  631. KeSweepIcacheRange (
  632.     IN BOOLEAN AllProcessors,
  633.     IN PVOID BaseAddress,
  634.     IN ULONG Length
  635.     );
  636. NTKERNELAPI
  637. VOID
  638. KeSweepCacheRangeWithDrain (
  639.     IN BOOLEAN AllProcessors,
  640.     IN PVOID BaseAddress,
  641.     IN ULONG Length
  642.     );
  643. // begin_ntddk begin_ntndis begin_wdm
  644. //
  645. // Cache and write buffer flush functions.
  646. //
  647. NTKERNELAPI
  648. VOID
  649. KeFlushIoBuffers (
  650.     IN PMDL Mdl,
  651.     IN BOOLEAN ReadOperation,
  652.     IN BOOLEAN DmaOperation
  653.     );
  654. // end_ntddk end_ntndis end_wdm
  655. //
  656. // Clock, profile, and interprocessor interrupt functions.
  657. //
  658. struct _KEXCEPTION_FRAME;
  659. struct _KTRAP_FRAME;
  660. NTKERNELAPI
  661. VOID
  662. KeIpiInterrupt (
  663.     IN struct _KTRAP_FRAME *TrapFrame
  664.     );
  665. #define KeYieldProcessor()
  666. NTKERNELAPI
  667. VOID
  668. KeProfileInterrupt (
  669.     IN struct _KTRAP_FRAME *TrapFrame
  670.     );
  671. NTKERNELAPI
  672. VOID
  673. KeProfileInterruptWithSource (
  674.     IN struct _KTRAP_FRAME *TrapFrame,
  675.     IN KPROFILE_SOURCE ProfileSource
  676.     );
  677. NTKERNELAPI
  678. VOID
  679. KeUpdateRunTime (
  680.     IN struct _KTRAP_FRAME *TrapFrame
  681.     );
  682. NTKERNELAPI
  683. VOID
  684. KeUpdateSystemTime (
  685.     IN struct _KTRAP_FRAME *TrapFrame,
  686.     IN ULONG Increment
  687.     );
  688. //
  689. // The following function prototypes are exported for use in MP HALs.
  690. //
  691. #if defined(NT_UP)
  692. #define KiAcquireSpinLock(SpinLock)
  693. #else
  694. NTKERNELAPI
  695. VOID
  696. KiAcquireSpinLock (
  697.     IN PKSPIN_LOCK SpinLock
  698.     );
  699. #endif
  700. #if defined(NT_UP)
  701. #define KiReleaseSpinLock(SpinLock)
  702. #else
  703. #define KiReleaseSpinLock(SpinLock) _ReleaseSpinLock(SpinLock)
  704. #endif
  705. //
  706. // KeTestSpinLock may be used to spin at low IRQL until the lock is
  707. // available.  The IRQL must then be raised and the lock acquired with
  708. // KeTryToAcquireSpinLock.  If that fails, lower the IRQL and start again.
  709. //
  710. #if defined(NT_UP)
  711. #define KeTestSpinLock(SpinLock) (TRUE)
  712. #else
  713. BOOLEAN
  714. KeTestSpinLock (
  715.     IN PKSPIN_LOCK SpinLock
  716.     );
  717. #endif
  718. //
  719. // Define cache error routine type and prototype.
  720. //
  721. typedef
  722. VOID
  723. (*PKCACHE_ERROR_ROUTINE) (
  724.     VOID
  725.     );
  726. NTKERNELAPI
  727. VOID
  728. KeSetCacheErrorRoutine (
  729.     IN PKCACHE_ERROR_ROUTINE Routine
  730.     );
  731. // begin_ntddk begin_wdm
  732. //
  733. // Kernel breakin breakpoint
  734. //
  735. VOID
  736. KeBreakinBreakpoint (
  737.     VOID
  738.     );
  739. // end_ntddk end_nthal end_wdm
  740. //
  741. // Define executive macros for acquiring and releasing executive spinlocks.
  742. // These macros can ONLY be used by executive components and NOT by drivers.
  743. // Drivers MUST use the kernel interfaces since they must be MP enabled on
  744. // all systems.
  745. //
  746. #if defined(NT_UP) && !defined(_NTDDK_) && !defined(_NTIFS_)
  747. #define ExAcquireSpinLock(Lock, OldIrql) KeRaiseIrql(DISPATCH_LEVEL, (OldIrql))
  748. #define ExReleaseSpinLock(Lock, OldIrql) KeLowerIrql((OldIrql))
  749. #define ExAcquireSpinLockAtDpcLevel(Lock)
  750. #define ExReleaseSpinLockFromDpcLevel(Lock)
  751. #else
  752. // begin_wdm begin_ntddk
  753. #define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql))
  754. #define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql))
  755. #define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock)
  756. #define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock)
  757. // end_wdm end_ntddk
  758. #endif
  759. //
  760. // The acquire and release fast lock macros disable and enable interrupts
  761. // on UP nondebug systems. On MP or debug systems, the spinlock routines
  762. // are used.
  763. //
  764. // N.B. Extreme caution should be observed when using these routines.
  765. //
  766. #if defined(_M_IA64)
  767. VOID
  768. _disable (
  769.     VOID
  770.     );
  771. VOID
  772. _enable (
  773.     VOID
  774.     );
  775. #pragma intrinsic(_disable)
  776. #pragma intrinsic(_enable)
  777. #endif
  778. #if defined(NT_UP) && !DBG
  779. #define ExAcquireFastLock(Lock, OldIrql) _disable()
  780. #else
  781. #define ExAcquireFastLock(Lock, OldIrql) 
  782.     ExAcquireSpinLock(Lock, OldIrql)
  783. #endif
  784. #if defined(NT_UP) && !DBG
  785. #define ExReleaseFastLock(Lock, OldIrql) _enable()
  786. #else
  787. #define ExReleaseFastLock(Lock, OldIrql) 
  788.     ExReleaseSpinLock(Lock, OldIrql)
  789. #endif
  790. //
  791. // Data and instruction bus error function prototypes.
  792. //
  793. BOOLEAN
  794. KeBusError (
  795.     IN PEXCEPTION_RECORD ExceptionRecord,
  796.     IN struct _KEXCEPTION_FRAME *ExceptionFrame,
  797.     IN struct _KTRAP_FRAME *TrapFrame,
  798.     IN PVOID VirtualAddress,
  799.     IN PHYSICAL_ADDRESS PhysicalAddress
  800.     );
  801. VOID
  802. KiDataBusError (
  803.     IN PEXCEPTION_RECORD ExceptionRecord,
  804.     IN struct _KEXCEPTION_FRAME *ExceptionFrame,
  805.     IN struct _KTRAP_FRAME *TrapFrame
  806.     );
  807. VOID
  808. KiInstructionBusError (
  809.     IN PEXCEPTION_RECORD ExceptionRecord,
  810.     IN struct _KEXCEPTION_FRAME *ExceptionFrame,
  811.     IN struct _KTRAP_FRAME *TrapFrame
  812.     );
  813. //
  814. // Define query system time macro.
  815. //
  816. #define KiQuerySystemTime(CurrentTime)     
  817.     while (TRUE) {                                                             
  818.         (CurrentTime)->HighPart = SharedUserData->SystemHigh1Time;             
  819.         (CurrentTime)->LowPart = SharedUserData->SystemLowTime;                
  820.         if ((CurrentTime)->HighPart == SharedUserData->SystemHigh2Time) break; 
  821.     }
  822. //
  823. // Define query tick count macro.
  824. //
  825. // begin_ntddk begin_nthal
  826. #if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_)
  827. // begin_wdm
  828. #define KeQueryTickCount(CurrentCount ) 
  829.     *(PULONGLONG)(CurrentCount) = **((volatile ULONGLONG **)(&KeTickCount));
  830. // end_wdm
  831. #else
  832. #define KiQueryTickCount(CurrentCount) 
  833.     *(PULONGLONG)(CurrentCount) = KeTickCount;
  834. NTKERNELAPI
  835. VOID
  836. KeQueryTickCount (
  837.     OUT PLARGE_INTEGER CurrentCount
  838.     );
  839. #endif // defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_)
  840. // end_ntddk end_nthal
  841. #define KiQueryLowTickCount() (ULONG)KeTickCount
  842. //
  843. // Define query interrupt time macro.
  844. //
  845. #define KiQueryInterruptTime(CurrentTime) 
  846.     *(PULONGLONG)(CurrentTime) = SharedUserData->InterruptTime
  847. //
  848. // The following function prototypes must be in the module since they are
  849. // machine dependent.
  850. //
  851. ULONG
  852. KiEmulateBranch (
  853.     IN struct _KEXCEPTION_FRAME *ExceptionFrame,
  854.     IN struct _KTRAP_FRAME *TrapFrame
  855.     );
  856. BOOLEAN
  857. KiEmulateFloating (
  858.     IN OUT PEXCEPTION_RECORD ExceptionRecord,
  859.     IN OUT struct _KEXCEPTION_FRAME *ExceptionFrame,
  860.     IN OUT struct _KTRAP_FRAME *TrapFrame
  861.     );
  862. BOOLEAN
  863. KiEmulateReference (
  864.     IN OUT PEXCEPTION_RECORD ExceptionRecord,
  865.     IN OUT struct _KEXCEPTION_FRAME *ExceptionFrame,
  866.     IN OUT struct _KTRAP_FRAME *TrapFrame
  867.     );
  868. ULONGLONG
  869. KiGetRegisterValue (
  870.     IN ULONG Register,
  871.     IN struct _KEXCEPTION_FRAME *ExceptionFrame,
  872.     IN struct _KTRAP_FRAME *TrapFrame
  873.     );
  874. VOID
  875. KiSetRegisterValue (
  876.     IN ULONG Register,
  877.     IN ULONGLONG Value,
  878.     OUT struct _KEXCEPTION_FRAME *ExceptionFrame,
  879.     OUT struct _KTRAP_FRAME *TrapFrame
  880.     );
  881. FLOAT128
  882. KiGetFloatRegisterValue (
  883.     IN ULONG Register,
  884.     IN struct _KEXCEPTION_FRAME *ExceptionFrame,
  885.     IN struct _KTRAP_FRAME *TrapFrame
  886.     );
  887. VOID
  888. KiSetFloatRegisterValue (
  889.     IN ULONG Register,
  890.     IN FLOAT128 Value,
  891.     OUT struct _KEXCEPTION_FRAME *ExceptionFrame,
  892.     OUT struct _KTRAP_FRAME *TrapFrame
  893.     );
  894. VOID
  895. KiAdvanceInstPointer(
  896.     IN OUT struct _KTRAP_FRAME *TrapFrame
  897.     );
  898. VOID
  899. KiRequestSoftwareInterrupt (
  900.     KIRQL RequestIrql
  901.     );
  902. // begin_ntddk begin_nthal begin_ntndis begin_wdm
  903. //
  904. // I/O space read and write macros.
  905. //
  906. NTHALAPI
  907. UCHAR
  908. READ_PORT_UCHAR (
  909.     PUCHAR RegisterAddress
  910.     );
  911. NTHALAPI
  912. USHORT
  913. READ_PORT_USHORT (
  914.     PUSHORT RegisterAddress
  915.     );
  916. NTHALAPI
  917. ULONG
  918. READ_PORT_ULONG (
  919.     PULONG RegisterAddress
  920.     );
  921. NTHALAPI
  922. VOID
  923. READ_PORT_BUFFER_UCHAR (
  924.     PUCHAR portAddress,
  925.     PUCHAR readBuffer,
  926.     ULONG  readCount
  927.     );
  928. NTHALAPI
  929. VOID
  930. READ_PORT_BUFFER_USHORT (
  931.     PUSHORT portAddress,
  932.     PUSHORT readBuffer,
  933.     ULONG  readCount
  934.     );
  935. NTHALAPI
  936. VOID
  937. READ_PORT_BUFFER_ULONG (
  938.     PULONG portAddress,
  939.     PULONG readBuffer,
  940.     ULONG  readCount
  941.     );
  942. NTHALAPI
  943. VOID
  944. WRITE_PORT_UCHAR (
  945.     PUCHAR portAddress,
  946.     UCHAR  Data
  947.     );
  948. NTHALAPI
  949. VOID
  950. WRITE_PORT_USHORT (
  951.     PUSHORT portAddress,
  952.     USHORT  Data
  953.     );
  954. NTHALAPI
  955. VOID
  956. WRITE_PORT_ULONG (
  957.     PULONG portAddress,
  958.     ULONG  Data
  959.     );
  960. NTHALAPI
  961. VOID
  962. WRITE_PORT_BUFFER_UCHAR (
  963.     PUCHAR portAddress,
  964.     PUCHAR writeBuffer,
  965.     ULONG  writeCount
  966.     );
  967. NTHALAPI
  968. VOID
  969. WRITE_PORT_BUFFER_USHORT (
  970.     PUSHORT portAddress,
  971.     PUSHORT writeBuffer,
  972.     ULONG  writeCount
  973.     );
  974. NTHALAPI
  975. VOID
  976. WRITE_PORT_BUFFER_ULONG (
  977.     PULONG portAddress,
  978.     PULONG writeBuffer,
  979.     ULONG  writeCount
  980.     );
  981. #define READ_REGISTER_UCHAR(x) 
  982.     (__mf(), *(volatile UCHAR * const)(x))
  983. #define READ_REGISTER_USHORT(x) 
  984.     (__mf(), *(volatile USHORT * const)(x))
  985. #define READ_REGISTER_ULONG(x) 
  986.     (__mf(), *(volatile ULONG * const)(x))
  987. #define READ_REGISTER_BUFFER_UCHAR(x, y, z) {                           
  988.     PUCHAR registerBuffer = x;                                          
  989.     PUCHAR readBuffer = y;                                              
  990.     ULONG readCount;                                                    
  991.     __mf();                                                             
  992.     for (readCount = z; readCount--; readBuffer++, registerBuffer++) {  
  993.         *readBuffer = *(volatile UCHAR * const)(registerBuffer);        
  994.     }                                                                   
  995. }
  996. #define READ_REGISTER_BUFFER_USHORT(x, y, z) {                          
  997.     PUSHORT registerBuffer = x;                                         
  998.     PUSHORT readBuffer = y;                                             
  999.     ULONG readCount;                                                    
  1000.     __mf();                                                             
  1001.     for (readCount = z; readCount--; readBuffer++, registerBuffer++) {  
  1002.         *readBuffer = *(volatile USHORT * const)(registerBuffer);       
  1003.     }                                                                   
  1004. }
  1005. #define READ_REGISTER_BUFFER_ULONG(x, y, z) {                           
  1006.     PULONG registerBuffer = x;                                          
  1007.     PULONG readBuffer = y;                                              
  1008.     ULONG readCount;                                                    
  1009.     __mf();                                                             
  1010.     for (readCount = z; readCount--; readBuffer++, registerBuffer++) {  
  1011.         *readBuffer = *(volatile ULONG * const)(registerBuffer);        
  1012.     }                                                                   
  1013. }
  1014. #define WRITE_REGISTER_UCHAR(x, y) {    
  1015.     *(volatile UCHAR * const)(x) = y;   
  1016.     KeFlushWriteBuffer();               
  1017. }
  1018. #define WRITE_REGISTER_USHORT(x, y) {   
  1019.     *(volatile USHORT * const)(x) = y;  
  1020.     KeFlushWriteBuffer();               
  1021. }
  1022. #define WRITE_REGISTER_ULONG(x, y) {    
  1023.     *(volatile ULONG * const)(x) = y;   
  1024.     KeFlushWriteBuffer();               
  1025. }
  1026. #define WRITE_REGISTER_BUFFER_UCHAR(x, y, z) {                            
  1027.     PUCHAR registerBuffer = x;                                            
  1028.     PUCHAR writeBuffer = y;                                               
  1029.     ULONG writeCount;                                                     
  1030.     for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { 
  1031.         *(volatile UCHAR * const)(registerBuffer) = *writeBuffer;         
  1032.     }                                                                     
  1033.     KeFlushWriteBuffer();                                                 
  1034. }
  1035. #define WRITE_REGISTER_BUFFER_USHORT(x, y, z) {                           
  1036.     PUSHORT registerBuffer = x;                                           
  1037.     PUSHORT writeBuffer = y;                                              
  1038.     ULONG writeCount;                                                     
  1039.     for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { 
  1040.         *(volatile USHORT * const)(registerBuffer) = *writeBuffer;        
  1041.     }                                                                     
  1042.     KeFlushWriteBuffer();                                                 
  1043. }
  1044. #define WRITE_REGISTER_BUFFER_ULONG(x, y, z) {                            
  1045.     PULONG registerBuffer = x;                                            
  1046.     PULONG writeBuffer = y;                                               
  1047.     ULONG writeCount;                                                     
  1048.     for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { 
  1049.         *(volatile ULONG * const)(registerBuffer) = *writeBuffer;         
  1050.     }                                                                     
  1051.     KeFlushWriteBuffer();                                                 
  1052. }
  1053. // end_ntddk end_ntndis end_wdm
  1054. // Please contact INTEL to get IA64-specific information
  1055. // @@BEGIN_DDKSPLIT
  1056. //
  1057. // Higher FP volatile // Intel-IA64-Filler
  1058. //
  1059. //  This structure defines the higher FP volatile registers. // Intel-IA64-Filler
  1060. //
  1061. typedef struct _KHIGHER_FP_VOLATILE { // Intel-IA64-Filler
  1062.     // volatile higher floating registers f32 - f127 // Intel-IA64-Filler
  1063.     FLOAT128 FltF32; // Intel-IA64-Filler
  1064.     FLOAT128 FltF33; // Intel-IA64-Filler
  1065.     FLOAT128 FltF34; // Intel-IA64-Filler
  1066.     FLOAT128 FltF35; // Intel-IA64-Filler
  1067.     FLOAT128 FltF36; // Intel-IA64-Filler
  1068.     FLOAT128 FltF37; // Intel-IA64-Filler
  1069.     FLOAT128 FltF38; // Intel-IA64-Filler
  1070.     FLOAT128 FltF39; // Intel-IA64-Filler
  1071.     FLOAT128 FltF40; // Intel-IA64-Filler
  1072.     FLOAT128 FltF41; // Intel-IA64-Filler
  1073.     FLOAT128 FltF42; // Intel-IA64-Filler
  1074.     FLOAT128 FltF43; // Intel-IA64-Filler
  1075.     FLOAT128 FltF44; // Intel-IA64-Filler
  1076.     FLOAT128 FltF45; // Intel-IA64-Filler
  1077.     FLOAT128 FltF46; // Intel-IA64-Filler
  1078.     FLOAT128 FltF47; // Intel-IA64-Filler
  1079.     FLOAT128 FltF48; // Intel-IA64-Filler
  1080.     FLOAT128 FltF49; // Intel-IA64-Filler
  1081.     FLOAT128 FltF50; // Intel-IA64-Filler
  1082.     FLOAT128 FltF51; // Intel-IA64-Filler
  1083.     FLOAT128 FltF52; // Intel-IA64-Filler
  1084.     FLOAT128 FltF53; // Intel-IA64-Filler
  1085.     FLOAT128 FltF54; // Intel-IA64-Filler
  1086.     FLOAT128 FltF55; // Intel-IA64-Filler
  1087.     FLOAT128 FltF56; // Intel-IA64-Filler
  1088.     FLOAT128 FltF57; // Intel-IA64-Filler
  1089.     FLOAT128 FltF58; // Intel-IA64-Filler
  1090.     FLOAT128 FltF59; // Intel-IA64-Filler
  1091.     FLOAT128 FltF60; // Intel-IA64-Filler
  1092.     FLOAT128 FltF61; // Intel-IA64-Filler
  1093.     FLOAT128 FltF62; // Intel-IA64-Filler
  1094.     FLOAT128 FltF63; // Intel-IA64-Filler
  1095.     FLOAT128 FltF64; // Intel-IA64-Filler
  1096.     FLOAT128 FltF65; // Intel-IA64-Filler
  1097.     FLOAT128 FltF66; // Intel-IA64-Filler
  1098.     FLOAT128 FltF67; // Intel-IA64-Filler
  1099.     FLOAT128 FltF68; // Intel-IA64-Filler
  1100.     FLOAT128 FltF69; // Intel-IA64-Filler
  1101.     FLOAT128 FltF70; // Intel-IA64-Filler
  1102.     FLOAT128 FltF71; // Intel-IA64-Filler
  1103.     FLOAT128 FltF72; // Intel-IA64-Filler
  1104.     FLOAT128 FltF73; // Intel-IA64-Filler
  1105.     FLOAT128 FltF74; // Intel-IA64-Filler
  1106.     FLOAT128 FltF75; // Intel-IA64-Filler
  1107.     FLOAT128 FltF76; // Intel-IA64-Filler
  1108.     FLOAT128 FltF77; // Intel-IA64-Filler
  1109.     FLOAT128 FltF78; // Intel-IA64-Filler
  1110.     FLOAT128 FltF79; // Intel-IA64-Filler
  1111.     FLOAT128 FltF80; // Intel-IA64-Filler
  1112.     FLOAT128 FltF81; // Intel-IA64-Filler
  1113.     FLOAT128 FltF82; // Intel-IA64-Filler
  1114.     FLOAT128 FltF83; // Intel-IA64-Filler
  1115.     FLOAT128 FltF84; // Intel-IA64-Filler
  1116.     FLOAT128 FltF85; // Intel-IA64-Filler
  1117.     FLOAT128 FltF86; // Intel-IA64-Filler
  1118.     FLOAT128 FltF87; // Intel-IA64-Filler
  1119.     FLOAT128 FltF88; // Intel-IA64-Filler
  1120.     FLOAT128 FltF89; // Intel-IA64-Filler
  1121.     FLOAT128 FltF90; // Intel-IA64-Filler
  1122.     FLOAT128 FltF91; // Intel-IA64-Filler
  1123.     FLOAT128 FltF92; // Intel-IA64-Filler
  1124.     FLOAT128 FltF93; // Intel-IA64-Filler
  1125.     FLOAT128 FltF94; // Intel-IA64-Filler
  1126.     FLOAT128 FltF95; // Intel-IA64-Filler
  1127.     FLOAT128 FltF96; // Intel-IA64-Filler
  1128.     FLOAT128 FltF97; // Intel-IA64-Filler
  1129.     FLOAT128 FltF98; // Intel-IA64-Filler
  1130.     FLOAT128 FltF99; // Intel-IA64-Filler
  1131.     FLOAT128 FltF100; // Intel-IA64-Filler
  1132.     FLOAT128 FltF101; // Intel-IA64-Filler
  1133.     FLOAT128 FltF102; // Intel-IA64-Filler
  1134.     FLOAT128 FltF103; // Intel-IA64-Filler
  1135.     FLOAT128 FltF104; // Intel-IA64-Filler
  1136.     FLOAT128 FltF105; // Intel-IA64-Filler
  1137.     FLOAT128 FltF106; // Intel-IA64-Filler
  1138.     FLOAT128 FltF107; // Intel-IA64-Filler
  1139.     FLOAT128 FltF108; // Intel-IA64-Filler
  1140.     FLOAT128 FltF109; // Intel-IA64-Filler
  1141.     FLOAT128 FltF110; // Intel-IA64-Filler
  1142.     FLOAT128 FltF111; // Intel-IA64-Filler
  1143.     FLOAT128 FltF112; // Intel-IA64-Filler
  1144.     FLOAT128 FltF113; // Intel-IA64-Filler
  1145.     FLOAT128 FltF114; // Intel-IA64-Filler
  1146.     FLOAT128 FltF115; // Intel-IA64-Filler
  1147.     FLOAT128 FltF116; // Intel-IA64-Filler
  1148.     FLOAT128 FltF117; // Intel-IA64-Filler
  1149.     FLOAT128 FltF118; // Intel-IA64-Filler
  1150.     FLOAT128 FltF119; // Intel-IA64-Filler
  1151.     FLOAT128 FltF120; // Intel-IA64-Filler
  1152.     FLOAT128 FltF121; // Intel-IA64-Filler
  1153.     FLOAT128 FltF122; // Intel-IA64-Filler
  1154.     FLOAT128 FltF123; // Intel-IA64-Filler
  1155.     FLOAT128 FltF124; // Intel-IA64-Filler
  1156.     FLOAT128 FltF125; // Intel-IA64-Filler
  1157.     FLOAT128 FltF126; // Intel-IA64-Filler
  1158.     FLOAT128 FltF127; // Intel-IA64-Filler
  1159. } KHIGHER_FP_VOLATILE, *PKHIGHER_FP_VOLATILE; // Intel-IA64-Filler
  1160. //
  1161. // Debug registers // Intel-IA64-Filler
  1162. //
  1163. // This structure defines the hardware debug registers. // Intel-IA64-Filler
  1164. // We allow space for 4 pairs of instruction and 4 pairs of data debug registers // Intel-IA64-Filler
  1165. // The hardware may actually have more. // Intel-IA64-Filler
  1166. //
  1167. typedef struct _KDEBUG_REGISTERS { // Intel-IA64-Filler
  1168.     ULONGLONG DbI0; // Intel-IA64-Filler
  1169.     ULONGLONG DbI1; // Intel-IA64-Filler
  1170.     ULONGLONG DbI2; // Intel-IA64-Filler
  1171.     ULONGLONG DbI3; // Intel-IA64-Filler
  1172.     ULONGLONG DbI4; // Intel-IA64-Filler
  1173.     ULONGLONG DbI5; // Intel-IA64-Filler
  1174.     ULONGLONG DbI6; // Intel-IA64-Filler
  1175.     ULONGLONG DbI7; // Intel-IA64-Filler
  1176.     ULONGLONG DbD0; // Intel-IA64-Filler
  1177.     ULONGLONG DbD1; // Intel-IA64-Filler
  1178.     ULONGLONG DbD2; // Intel-IA64-Filler
  1179.     ULONGLONG DbD3; // Intel-IA64-Filler
  1180.     ULONGLONG DbD4; // Intel-IA64-Filler
  1181.     ULONGLONG DbD5; // Intel-IA64-Filler
  1182.     ULONGLONG DbD6; // Intel-IA64-Filler
  1183.     ULONGLONG DbD7; // Intel-IA64-Filler
  1184. } KDEBUG_REGISTERS, *PKDEBUG_REGISTERS; // Intel-IA64-Filler
  1185. //
  1186. // misc. application registers (mapped to IA-32 registers)
  1187. //
  1188. typedef struct _KAPPLICATION_REGISTERS {
  1189.     ULONGLONG Ar21;
  1190.     ULONGLONG Ar24;
  1191.     ULONGLONG Ar25;
  1192.     ULONGLONG Ar26;
  1193.     ULONGLONG Ar27;
  1194.     ULONGLONG Ar28;
  1195.     ULONGLONG Ar29;
  1196.     ULONGLONG Ar30;
  1197. } KAPPLICATION_REGISTERS, *PKAPPLICATION_REGISTERS;
  1198. //
  1199. // performance registers
  1200. //
  1201. typedef struct _KPERFORMANCE_REGISTERS {
  1202.     ULONGLONG Perfr0;
  1203.     ULONGLONG Perfr1;
  1204.     ULONGLONG Perfr2;
  1205.     ULONGLONG Perfr3;
  1206.     ULONGLONG Perfr4;
  1207.     ULONGLONG Perfr5;
  1208.     ULONGLONG Perfr6;
  1209.     ULONGLONG Perfr7;
  1210. } KPERFORMANCE_REGISTERS, *PKPERFORMANCE_REGISTERS;
  1211. //
  1212. // Thread State save area. Currently, beginning of Kernel Stack // Intel-IA64-Filler
  1213. //
  1214. // This structure defines the area for: // Intel-IA64-Filler
  1215. //
  1216. //      higher fp register save/restore // Intel-IA64-Filler
  1217. //      user debug register save/restore. // Intel-IA64-Filler
  1218. //
  1219. // The order of these area is significant.
  1220. //
  1221. typedef struct _KTHREAD_STATE_SAVEAREA { // Intel-IA64-Filler
  1222.     KAPPLICATION_REGISTERS AppRegisters;
  1223.     KPERFORMANCE_REGISTERS PerfRegisters;
  1224.     KHIGHER_FP_VOLATILE HigherFPVolatile; // Intel-IA64-Filler
  1225.     KDEBUG_REGISTERS DebugRegisters; // Intel-IA64-Filler
  1226. } KTHREAD_STATE_SAVEAREA, *PKTHREAD_STATE_SAVEAREA; // Intel-IA64-Filler
  1227. #define KTHREAD_STATE_SAVEAREA_LENGTH ((sizeof(KTHREAD_STATE_SAVEAREA) + 15) & ~((ULONG_PTR)15))
  1228. #define GET_HIGH_FLOATING_POINT_REGISTER_SAVEAREA()         
  1229.     (PKHIGHER_FP_VOLATILE) &(((PKTHREAD_STATE_SAVEAREA)(((ULONG_PTR)PCR->InitialStack - sizeof(KTHREAD_STATE_SAVEAREA)) & ~((ULONG_PTR)15)))->HigherFPVolatile)
  1230. #define GET_DEBUG_REGISTER_SAVEAREA()                       
  1231.     (PKDEBUG_REGISTERS) &(((PKTHREAD_STATE_SAVEAREA)(((ULONG_PTR)KeGetCurrentThread()->StackBase - sizeof(KTHREAD_STATE_SAVEAREA)) & ~((ULONG_PTR)15)))->DebugRegisters)
  1232. #define GET_APPLICATION_REGISTER_SAVEAREA(StackBase)     
  1233.     (PKAPPLICATION_REGISTERS) &(((PKTHREAD_STATE_SAVEAREA)(((ULONG_PTR)StackBase - sizeof(KTHREAD_STATE_SAVEAREA)) & ~((ULONG_PTR)15)))->AppRegisters)
  1234. // @@END_DDKSPLIT
  1235. //
  1236. // Exception frame
  1237. //
  1238. //  This frame is established when handling an exception. It provides a place
  1239. //  to save all preserved registers. The volatile registers will already
  1240. //  have been saved in a trap frame. Also used as part of switch frame built
  1241. //  at thread switch.
  1242. //
  1243. //  The frame is 16-byte aligned to maintain 16-byte alignment for the stack,
  1244. //
  1245. typedef struct _KEXCEPTION_FRAME {
  1246. // Please contact INTEL to get IA64-specific information
  1247. // @@BEGIN_DDKSPLIT
  1248.     // Preserved application registers // Intel-IA64-Filler
  1249.     ULONGLONG ApEC;       // epilogue count // Intel-IA64-Filler
  1250.     ULONGLONG ApLC;       // loop count // Intel-IA64-Filler
  1251.     ULONGLONG IntNats;    // Nats for S0-S3; i.e. ar.UNAT after spill // Intel-IA64-Filler
  1252.     // Preserved (saved) interger registers, s0-s3 // Intel-IA64-Filler
  1253.     ULONGLONG IntS0; // Intel-IA64-Filler
  1254.     ULONGLONG IntS1; // Intel-IA64-Filler
  1255.     ULONGLONG IntS2; // Intel-IA64-Filler
  1256.     ULONGLONG IntS3; // Intel-IA64-Filler
  1257.     // Preserved (saved) branch registers, bs0-bs4 // Intel-IA64-Filler
  1258.     ULONGLONG BrS0; // Intel-IA64-Filler
  1259.     ULONGLONG BrS1; // Intel-IA64-Filler
  1260.     ULONGLONG BrS2; // Intel-IA64-Filler
  1261.     ULONGLONG BrS3; // Intel-IA64-Filler
  1262.     ULONGLONG BrS4; // Intel-IA64-Filler
  1263.     // Preserved (saved) floating point registers, f2 - f5, f16 - f31 // Intel-IA64-Filler
  1264.     FLOAT128 FltS0; // Intel-IA64-Filler
  1265.     FLOAT128 FltS1; // Intel-IA64-Filler
  1266.     FLOAT128 FltS2; // Intel-IA64-Filler
  1267.     FLOAT128 FltS3; // Intel-IA64-Filler
  1268.     FLOAT128 FltS4; // Intel-IA64-Filler
  1269.     FLOAT128 FltS5; // Intel-IA64-Filler
  1270.     FLOAT128 FltS6; // Intel-IA64-Filler
  1271.     FLOAT128 FltS7; // Intel-IA64-Filler
  1272.     FLOAT128 FltS8; // Intel-IA64-Filler
  1273.     FLOAT128 FltS9; // Intel-IA64-Filler
  1274.     FLOAT128 FltS10; // Intel-IA64-Filler
  1275.     FLOAT128 FltS11; // Intel-IA64-Filler
  1276.     FLOAT128 FltS12; // Intel-IA64-Filler
  1277.     FLOAT128 FltS13; // Intel-IA64-Filler
  1278.     FLOAT128 FltS14; // Intel-IA64-Filler
  1279.     FLOAT128 FltS15; // Intel-IA64-Filler
  1280.     FLOAT128 FltS16; // Intel-IA64-Filler
  1281.     FLOAT128 FltS17; // Intel-IA64-Filler
  1282.     FLOAT128 FltS18; // Intel-IA64-Filler
  1283.     FLOAT128 FltS19; // Intel-IA64-Filler
  1284. // @@END_DDKSPLIT
  1285. } KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
  1286. // Please contact INTEL to get IA64-specific information
  1287. // @@BEGIN_DDKSPLIT
  1288. //
  1289. // Switch frame
  1290. //
  1291. //  This frame is established when doing a thread switch in SwapContext. It
  1292. //  provides a place to save the preserved kernel state at the point of the
  1293. //  switch registers.
  1294. //  The volatile registers are scratch across the call to SwapContext.
  1295. //
  1296. //  The frame is 16-byte aligned to maintain 16-byte alignment for the stack,
  1297. //
  1298. typedef struct _KSWITCH_FRAME { // Intel-IA64-Filler
  1299.     ULONGLONG SwitchPredicates; // Predicates for Switch // Intel-IA64-Filler
  1300.     ULONGLONG SwitchRp;         // return pointer for Switch // Intel-IA64-Filler
  1301.     ULONGLONG SwitchPFS;        // PFS for Switch // Intel-IA64-Filler
  1302.     ULONGLONG SwitchFPSR;   // ProcessorFP status at thread switch // Intel-IA64-Filler
  1303.     ULONGLONG SwitchBsp;                     // Intel-IA64-Filler
  1304.     ULONGLONG SwitchRnat;                     // Intel-IA64-Filler
  1305.     // ULONGLONG Pad;
  1306.     KEXCEPTION_FRAME SwitchExceptionFrame; // Intel-IA64-Filler
  1307. } KSWITCH_FRAME, *PKSWITCH_FRAME; // Intel-IA64-Filler
  1308. // Trap frame
  1309. //  This frame is established when handling a trap. It provides a place to
  1310. //  save all volatile registers. The nonvolatile registers are saved in an
  1311. //  exception frame or through the normal C calling conventions for saved
  1312. //  registers.  Its size must be a multiple of 16 bytes.
  1313. //
  1314. //  N.B - the 16-byte alignment is required to maintain the stack alignment.
  1315. //
  1316. #define KTRAP_FRAME_ARGUMENTS (8 * 8)       // up to 8 in-memory syscall args // Intel-IA64-Filler
  1317. // @@END_DDKSPLIT
  1318. typedef struct _KTRAP_FRAME {
  1319. // Please contact INTEL to get IA64-specific information
  1320. // @@BEGIN_DDKSPLIT
  1321.     //
  1322.     // Reserved for additional memory arguments and stack scratch area
  1323.     // The size of Reserved[] must be a multiple of 16 bytes.
  1324.     //
  1325.     ULONGLONG Reserved[(KTRAP_FRAME_ARGUMENTS+16)/8]; // Intel-IA64-Filler
  1326.     // Temporary (volatile) FP registers - f6-f15 (don't use f32+ in kernel) // Intel-IA64-Filler
  1327.     FLOAT128 FltT0; // Intel-IA64-Filler
  1328.     FLOAT128 FltT1; // Intel-IA64-Filler
  1329.     FLOAT128 FltT2; // Intel-IA64-Filler
  1330.     FLOAT128 FltT3; // Intel-IA64-Filler
  1331.     FLOAT128 FltT4; // Intel-IA64-Filler
  1332.     FLOAT128 FltT5; // Intel-IA64-Filler
  1333.     FLOAT128 FltT6; // Intel-IA64-Filler
  1334.     FLOAT128 FltT7; // Intel-IA64-Filler
  1335.     FLOAT128 FltT8; // Intel-IA64-Filler
  1336.     FLOAT128 FltT9; // Intel-IA64-Filler
  1337.     // Temporary (volatile) interger registers
  1338.     ULONGLONG IntGp;    // global pointer (r1) // Intel-IA64-Filler
  1339.     ULONGLONG IntT0; // Intel-IA64-Filler
  1340.     ULONGLONG IntT1; // Intel-IA64-Filler
  1341.                         // The following 4 registers fill in space of preserved  (S0-S3) to align Nats // Intel-IA64-Filler
  1342.     ULONGLONG ApUNAT;   // ar.UNAT on kernel entry // Intel-IA64-Filler
  1343.     ULONGLONG ApCCV;    // ar.CCV // Intel-IA64-Filler
  1344.     ULONGLONG ApDCR;    // DCR register on kernel entry // Intel-IA64-Filler
  1345.     ULONGLONG Preds;    // Predicates // Intel-IA64-Filler
  1346.     ULONGLONG IntV0;    // return value (r8) // Intel-IA64-Filler
  1347.     ULONGLONG IntT2; // Intel-IA64-Filler
  1348.     ULONGLONG IntT3; // Intel-IA64-Filler
  1349.     ULONGLONG IntT4; // Intel-IA64-Filler
  1350.     ULONGLONG IntSp;    // stack pointer (r12) // Intel-IA64-Filler
  1351.     ULONGLONG IntTeb;   // teb (r13) // Intel-IA64-Filler
  1352.     ULONGLONG IntT5; // Intel-IA64-Filler
  1353.     ULONGLONG IntT6; // Intel-IA64-Filler
  1354.     ULONGLONG IntT7; // Intel-IA64-Filler
  1355.     ULONGLONG IntT8; // Intel-IA64-Filler
  1356.     ULONGLONG IntT9; // Intel-IA64-Filler
  1357.     ULONGLONG IntT10; // Intel-IA64-Filler
  1358.     ULONGLONG IntT11; // Intel-IA64-Filler
  1359.     ULONGLONG IntT12; // Intel-IA64-Filler
  1360.     ULONGLONG IntT13; // Intel-IA64-Filler
  1361.     ULONGLONG IntT14; // Intel-IA64-Filler
  1362.     ULONGLONG IntT15; // Intel-IA64-Filler
  1363.     ULONGLONG IntT16; // Intel-IA64-Filler
  1364.     ULONGLONG IntT17; // Intel-IA64-Filler
  1365.     ULONGLONG IntT18; // Intel-IA64-Filler
  1366.     ULONGLONG IntT19; // Intel-IA64-Filler
  1367.     ULONGLONG IntT20; // Intel-IA64-Filler
  1368.     ULONGLONG IntT21; // Intel-IA64-Filler
  1369.     ULONGLONG IntT22; // Intel-IA64-Filler
  1370.     ULONGLONG IntNats;  // Temporary (volatile) registers' Nats directly from ar.UNAT at point of spill // Intel-IA64-Filler
  1371.     ULONGLONG BrRp;     // Return pointer on kernel entry // Intel-IA64-Filler
  1372.     ULONGLONG BrT0;     // Temporary (volatile) branch registers (b6-b7) // Intel-IA64-Filler
  1373.     ULONGLONG BrT1; // Intel-IA64-Filler
  1374.     // Register stack info // Intel-IA64-Filler
  1375.     ULONGLONG RsRSC;    // RSC on kernel entry // Intel-IA64-Filler
  1376.     ULONGLONG RsBSP;    // BSP on kernel entry // Intel-IA64-Filler
  1377.     ULONGLONG RsBSPSTORE; // User BSP Store at point of switch to kernel backing store // Intel-IA64-Filler
  1378.     ULONGLONG RsRNAT;   // old RNAT at point of switch to kernel backing store // Intel-IA64-Filler
  1379.     ULONGLONG RsPFS;    // PFS on kernel entry // Intel-IA64-Filler
  1380.     // Trap Status Information // Intel-IA64-Filler
  1381.     ULONGLONG StIPSR;   // Interruption Processor Status Register // Intel-IA64-Filler
  1382.     ULONGLONG StIIP;    // Interruption IP // Intel-IA64-Filler
  1383.     ULONGLONG StIFS;    // Interruption Function State // Intel-IA64-Filler
  1384.     ULONGLONG StFPSR;   // FP status // Intel-IA64-Filler
  1385.     ULONGLONG StISR;    // Interruption Status Register // Intel-IA64-Filler
  1386.     ULONGLONG StIFA;    // Interruption Data Address // Intel-IA64-Filler
  1387.     ULONGLONG StIIPA;   // Last executed bundle address // Intel-IA64-Filler
  1388.     ULONGLONG StIIM;    // Interruption Immediate // Intel-IA64-Filler
  1389.     ULONGLONG StIHA;    // Interruption Hash Address // Intel-IA64-Filler
  1390.     ULONG OldIrql;      // Previous Irql. // Intel-IA64-Filler
  1391.     ULONG PreviousMode; // Previous Mode. // Intel-IA64-Filler
  1392.     ULONGLONG TrapFrame;// Previous Trap Frame // Intel-IA64-Filler
  1393. // @@END_DDKSPLIT
  1394.     // Exception record
  1395.     UCHAR ExceptionRecord[(sizeof(EXCEPTION_RECORD) + 15) & (~15)];
  1396.     // End of frame marker (for debugging)
  1397.     ULONGLONG Handler;  // Handler for this trap
  1398.     ULONGLONG EOFMarker;
  1399. } KTRAP_FRAME, *PKTRAP_FRAME;
  1400. #define KTRAP_FRAME_LENGTH ((sizeof(KTRAP_FRAME) + 15) & (~15))
  1401. #define KTRAP_FRAME_ALIGN (16)
  1402. #define KTRAP_FRAME_ROUND (KTRAP_FRAME_ALIGN - 1)
  1403. #define KTRAP_FRAME_EOF 0xe0f0e0f0e0f0e000i64
  1404. //
  1405. // Use the lowest 4 bits of EOFMarker field to encode the trap frame type
  1406. //
  1407. #define SYSCALL_FRAME      0
  1408. #define INTERRUPT_FRAME    1
  1409. #define EXCEPTION_FRAME    2
  1410. #define CONTEXT_FRAME      10
  1411. #define TRAP_FRAME_TYPE(tf)  (tf->EOFMarker & 0xf)
  1412. //
  1413. // Define the kernel mode and user mode callback frame structures.
  1414. //
  1415. //
  1416. // The frame saved by KiCallUserMode is defined here to allow
  1417. // the kernel debugger to trace the entire kernel stack
  1418. // when usermode callouts are pending.
  1419. //
  1420. // N.B. The size of the following structure must be a multiple of 16 bytes
  1421. //      and it must be 16-byte aligned.
  1422. //
  1423. typedef struct _KCALLOUT_FRAME {
  1424. // Please contact INTEL to get IA64-specific information
  1425. // @@BEGIN_DDKSPLIT
  1426.     ULONGLONG   BrRp;       // Intel-IA64-Filler
  1427.     ULONGLONG   RsPFS;       // Intel-IA64-Filler
  1428.     ULONGLONG   Preds;       // Intel-IA64-Filler
  1429.     ULONGLONG   ApUNAT;       // Intel-IA64-Filler
  1430.     ULONGLONG   ApLC;       // Intel-IA64-Filler
  1431.     ULONGLONG   RsRNAT;       // Intel-IA64-Filler
  1432.     ULONGLONG   IntNats;       // Intel-IA64-Filler
  1433.     ULONGLONG   IntS0;       // Intel-IA64-Filler
  1434.     ULONGLONG   IntS1;       // Intel-IA64-Filler
  1435.     ULONGLONG   IntS2;       // Intel-IA64-Filler
  1436.     ULONGLONG   IntS3;       // Intel-IA64-Filler
  1437.     ULONGLONG   BrS0;       // Intel-IA64-Filler
  1438.     ULONGLONG   BrS1;       // Intel-IA64-Filler
  1439.     ULONGLONG   BrS2;       // Intel-IA64-Filler
  1440.     ULONGLONG   BrS3;       // Intel-IA64-Filler
  1441.     ULONGLONG   BrS4;       // Intel-IA64-Filler
  1442.     FLOAT128    FltS0;          // 16-byte aligned boundary       // Intel-IA64-Filler
  1443.     FLOAT128    FltS1;       // Intel-IA64-Filler
  1444.     FLOAT128    FltS2;       // Intel-IA64-Filler
  1445.     FLOAT128    FltS3;       // Intel-IA64-Filler
  1446.     FLOAT128    FltS4;       // Intel-IA64-Filler
  1447.     FLOAT128    FltS5;       // Intel-IA64-Filler
  1448.     FLOAT128    FltS6;       // Intel-IA64-Filler
  1449.     FLOAT128    FltS7;       // Intel-IA64-Filler
  1450.     FLOAT128    FltS8;       // Intel-IA64-Filler
  1451.     FLOAT128    FltS9;       // Intel-IA64-Filler
  1452.     FLOAT128    FltS10;       // Intel-IA64-Filler
  1453.     FLOAT128    FltS11;       // Intel-IA64-Filler
  1454.     FLOAT128    FltS12;       // Intel-IA64-Filler
  1455.     FLOAT128    FltS13;       // Intel-IA64-Filler
  1456.     FLOAT128    FltS14;       // Intel-IA64-Filler
  1457.     FLOAT128    FltS15;       // Intel-IA64-Filler
  1458.     FLOAT128    FltS16;       // Intel-IA64-Filler
  1459.     FLOAT128    FltS17;       // Intel-IA64-Filler
  1460.     FLOAT128    FltS18;       // Intel-IA64-Filler
  1461.     FLOAT128    FltS19;       // Intel-IA64-Filler
  1462.     ULONGLONG   A0;             // saved argument registers a0-a2       // Intel-IA64-Filler
  1463.     ULONGLONG   A1;       // Intel-IA64-Filler
  1464.     ULONGLONG   CbStk;          // saved callback stack address       // Intel-IA64-Filler
  1465.     ULONGLONG   InStack;        // saved initial stack address       // Intel-IA64-Filler
  1466.     ULONGLONG   CbBStore;       // saved callback stack address       // Intel-IA64-Filler
  1467.     ULONGLONG   InBStore;       // saved initial stack address       // Intel-IA64-Filler
  1468.     ULONGLONG   TrFrame;        // saved callback trap frame address       // Intel-IA64-Filler
  1469.     ULONGLONG   TrStIIP;        // saved continuation address       // Intel-IA64-Filler
  1470. // @@END_DDKSPLIT
  1471. } KCALLOUT_FRAME, *PKCALLOUT_FRAME;
  1472. typedef struct _UCALLOUT_FRAME {
  1473. // Please contact INTEL to get IA64-specific information
  1474. // @@BEGIN_DDKSPLIT
  1475.     PVOID Buffer;       // Intel-IA64-Filler
  1476.     ULONG Length;       // Intel-IA64-Filler
  1477.     ULONG ApiNumber;       // Intel-IA64-Filler
  1478.     ULONGLONG IntSp;       // Intel-IA64-Filler
  1479.     ULONGLONG RsPFS;       // Intel-IA64-Filler
  1480.     ULONGLONG BrRp;       // Intel-IA64-Filler
  1481.     ULONGLONG Pad;       // Intel-IA64-Filler
  1482. // @@END_DDKSPLIT
  1483. } UCALLOUT_FRAME, *PUCALLOUT_FRAME;
  1484. // end_nthal
  1485. // begin_ntddk begin_wdm
  1486. //
  1487. // Non-volatile floating point state
  1488. //
  1489. typedef struct _KFLOATING_SAVE {
  1490.     ULONG   Reserved;
  1491. } KFLOATING_SAVE, *PKFLOATING_SAVE;
  1492. // end_ntddk end_wdm
  1493. #define STATUS_IA64_INVALID_STACK     STATUS_BAD_STACK
  1494. //
  1495. // iA32 control bits definition
  1496. //
  1497. //
  1498. // Define constants to access the bits in CR0.
  1499. //
  1500. #define CR0_PG  0x80000000          // paging
  1501. #define CR0_ET  0x00000010          // extension type (80387)
  1502. #define CR0_TS  0x00000008          // task switched
  1503. #define CR0_EM  0x00000004          // emulate math coprocessor
  1504. #define CR0_MP  0x00000002          // math present
  1505. #define CR0_PE  0x00000001          // protection enable
  1506. //
  1507. // More CR0 bits; these only apply to the 80486.
  1508. //
  1509. #define CR0_CD  0x40000000          // cache disable
  1510. #define CR0_NW  0x20000000          // not write-through
  1511. #define CR0_AM  0x00040000          // alignment mask
  1512. #define CR0_WP  0x00010000          // write protect
  1513. #define CR0_NE  0x00000020          // numeric error
  1514. //
  1515. // Define constants to access CFLG bits
  1516. //
  1517. #define CFLG_IO 0x00000040          // IO bit map checking on
  1518. #define CFLG_IF 0x00000080          // EFLAG.if to control external interrupt
  1519. #define CFLG_II 0x00000100          // enable EFLAG.if interception
  1520. #define CFLG_NM 0x00000200          // NMI intercept
  1521. //
  1522. // CR4 bits;  These only apply to Pentium
  1523. //
  1524. #define CR4_VME 0x00000001          // V86 mode extensions
  1525. #define CR4_PVI 0x00000002          // Protected mode virtual interrupts
  1526. #define CR4_TSD 0x00000004          // Time stamp disable
  1527. #define CR4_DE  0x00000008          // Debugging Extensions
  1528. #define CR4_PSE 0x00000010          // Page size extensions
  1529. #define CR4_MCE 0x00000040          // Machine check enable
  1530. //
  1531. // Define constants to access ThNpxState
  1532. //
  1533. #define NPX_STATE_NOT_LOADED    (CR0_TS | CR0_MP)
  1534. #define NPX_STATE_LOADED        0
  1535. //
  1536. // begin_nthal begin_ntddk begin_wdm
  1537. //
  1538. // STATUS register for each MCA bank.
  1539. //
  1540. typedef union _MCI_STATS {
  1541.     struct {
  1542.         USHORT  McaCod;
  1543.         USHORT  MsCod;
  1544.         ULONG   OtherInfo : 25;
  1545.         ULONG   Damage : 1;
  1546.         ULONG   AddressValid : 1;
  1547.         ULONG   MiscValid : 1;
  1548.         ULONG   Enabled : 1;
  1549.         ULONG   UnCorrected : 1;
  1550.         ULONG   OverFlow : 1;
  1551.         ULONG   Valid : 1;
  1552.     } MciStats;
  1553.     ULONGLONG QuadPart;
  1554. } MCI_STATS, *PMCI_STATS;
  1555. // end_ntddk end_wdm
  1556. //
  1557. // Machine type definitions
  1558. // BUGBUG shielint These are temporary definitions.
  1559. //
  1560. #define MACHINE_TYPE_ISA 0
  1561. #define MACHINE_TYPE_EISA 1
  1562. #define MACHINE_TYPE_MCA 2
  1563. //
  1564. // PAL Interface
  1565. //
  1566. // iA-64 defined PAL function IDs in decimal format as in the PAL spec
  1567. // All PAL calls done through HAL. HAL may block some calls
  1568. //
  1569. #define PAL_CACHE_FLUSH                                       1I64
  1570. #define PAL_CACHE_INFO                                        2I64
  1571. #define PAL_CACHE_INIT                                        3I64
  1572. #define PAL_CACHE_SUMMARY                                     4I64
  1573. #define PAL_PTCE_INFO                                         6I64
  1574. #define PAL_MEM_ATTRIB                                        5I64
  1575. #define PAL_VM_INFO                                           7I64
  1576. #define PAL_VM_SUMMARY                                        8I64
  1577. #define PAL_BUS_GET_FEATURES                                  9I64
  1578. #define PAL_BUS_SET_FEATURES                                 10I64
  1579. #define PAL_DEBUG_INFO                                       11I64
  1580. #define PAL_FIXED_ADDR                                       12I64
  1581. #define PAL_FREQ_BASE                                        13I64
  1582. #define PAL_FREQ_RATIOS                                      14I64
  1583. #define PAL_PERF_MON_INFO                                    15I64
  1584. #define PAL_PLATFORM_ADDR                                    16I64
  1585. #define PAL_PROC_GET_FEATURES                                17I64
  1586. #define PAL_PROC_SET_FEATURES                                18I64
  1587. #define PAL_RSE_INFO                                         19I64
  1588. #define PAL_VERSION                                          20I64
  1589. #define PAL_MC_CLEAR_LOG                                     21I64
  1590. #define PAL_MC_DRAIN                                         22I64
  1591. #define PAL_MC_EXPECTED                                      23I64
  1592. #define PAL_MC_DYNAMIC_STATE                                 24I64
  1593. #define PAL_MC_ERROR_INFO                                    25I64
  1594. #define PAL_MC_RESUME                                        26I64
  1595. #define PAL_MC_REGISTER_MEM                                  27I64
  1596. #define PAL_HALT                                             28I64
  1597. #define PAL_HALT_LIGHT                                       29I64
  1598. #define PAL_COPY_INFO                                        30I64
  1599. #define PAL_CACHE_LINE_INIT                                  31I64
  1600. #define PAL_PMI_ENTRYPOINT                                   32I64
  1601. #define PAL_ENTER_IA_32_ENV                                  33I64
  1602. #define PAL_VM_PAGE_SIZE                                     34I64
  1603. #define PAL_MEM_FOR_TEST                                     37I64
  1604. #define PAL_CACHE_PROT_INFO                                  38I64
  1605. #define PAL_REGISTER_INFO                                    39I64
  1606. #define PAL_SHUTDOWN                                         44I64
  1607. #define PAL_PREFETCH_VISIBILITY                              41I64
  1608. #define PAL_COPY_PAL                                        256I64
  1609. #define PAL_HALT_INFO                                       257I64
  1610. #define PAL_TEST_PROC                                       258I64
  1611. #define PAL_CACHE_READ                                      259I64
  1612. #define PAL_CACHE_WRITE                                     260I64
  1613. #define PAL_VM_TR_READ                                      261I64
  1614. //
  1615. // iA-64 defined PAL return values
  1616. //
  1617. #define PAL_STATUS_INVALID_CACHELINE                          1I64
  1618. #define PAL_STATUS_SUPPORT_NOT_NEEDED                         1I64
  1619. #define PAL_STATUS_SUCCESS                                    0
  1620. #define PAL_STATUS_NOT_IMPLEMENTED                           -1I64
  1621. #define PAL_STATUS_INVALID_ARGUMENT                          -2I64
  1622. #define PAL_STATUS_ERROR                                     -3I64
  1623. #define PAL_STATUS_UNABLE_TO_INIT_CACHE_LEVEL_AND_TYPE       -4I64
  1624. #define PAL_STATUS_NOT_FOUND_IN_CACHE                        -5I64
  1625. #define PAL_STATUS_NO_ERROR_INFO_AVAILABLE                   -6I64
  1626. // end_nthal
  1627.                
  1628. //
  1629. // Define constants used in selector tests.
  1630. //
  1631. //  RPL_MASK is the real value for extracting RPL values.  IT IS THE WRONG
  1632. //  CONSTANT TO USE FOR MODE TESTING.
  1633. //
  1634. //  MODE_MASK is the value for deciding the current mode.
  1635. //  WARNING:    MODE_MASK assumes that all code runs at either ring-0
  1636. //              or ring-3.  Ring-1 or Ring-2 support will require changing
  1637. //              this value and all of the code that refers to it.
  1638. #define MODE_MASK    1
  1639. #define RPL_MASK     3
  1640. //
  1641. // SEGMENT_MASK is used to throw away trash part of segment.  Part always
  1642. // pushes or pops 32 bits to/from stack, but if it's a segment value,
  1643. // high order 16 bits are trash.
  1644. //
  1645. #define SEGMENT_MASK    0xffff
  1646. typedef struct _LDTINFORMATION {
  1647.     ULONG Size;
  1648.     ULONG AllocatedSize;
  1649.     PLDT_ENTRY Ldt;
  1650. } LDTINFORMATION, *PLDTINFORMATION;
  1651. //
  1652. // SetProcessInformation Structure for ProcessSetIoHandlers info class
  1653. //
  1654. typedef struct _PROCESS_IO_PORT_HANDLER_INFORMATION {
  1655.     BOOLEAN Install;            // true if handlers to be installed
  1656.     ULONG NumEntries;
  1657.     ULONG Context;
  1658.     PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries;
  1659. } PROCESS_IO_PORT_HANDLER_INFORMATION, *PPROCESS_IO_PORT_HANDLER_INFORMATION;
  1660. //
  1661. // GDT Entry
  1662. //
  1663. typedef struct _KGDTENTRY {
  1664.     USHORT  LimitLow;
  1665.     USHORT  BaseLow;
  1666.     union {
  1667.         struct {
  1668.             UCHAR   BaseMid;
  1669.             UCHAR   Flags1;     // Declare as bytes to avoid alignment
  1670.             UCHAR   Flags2;     // Problems.
  1671.             UCHAR   BaseHi;
  1672.         } Bytes;
  1673.         struct {
  1674.             ULONG   BaseMid : 8;
  1675.             ULONG   Type : 5;
  1676.             ULONG   Dpl : 2;
  1677.             ULONG   Pres : 1;
  1678.             ULONG   LimitHi : 4;
  1679.             ULONG   Sys : 1;
  1680.             ULONG   Reserved_0 : 1;
  1681.             ULONG   Default_Big : 1;
  1682.             ULONG   Granularity : 1;
  1683.             ULONG   BaseHi : 8;
  1684.         } Bits;
  1685.     } HighWord;
  1686. } KGDTENTRY, *PKGDTENTRY;
  1687. #define TYPE_TSS    0x01  // 01001 = NonBusy TSS
  1688. #define TYPE_LDT    0x02  // 00010 = LDT
  1689. //
  1690. // UnScrambled Descriptor format
  1691. //
  1692. typedef struct _KDESCRIPTOR_UNSCRAM {
  1693.     union {
  1694.         ULONGLONG  DescriptorWords;
  1695.         struct {
  1696.             ULONGLONG   Base : 32;
  1697.             ULONGLONG   Limit : 20;
  1698.             ULONGLONG   Type : 5;
  1699.             ULONGLONG   Dpl : 2;
  1700.             ULONGLONG   Pres : 1;
  1701.             ULONGLONG   Sys : 1;
  1702.             ULONGLONG   Reserved_0 : 1;
  1703.             ULONGLONG   Default_Big : 1;
  1704.             ULONGLONG   Granularity : 1;
  1705.          } Bits;
  1706.     } Words;
  1707. } KXDESCRIPTOR, *PKXDESCRIPTOR;
  1708. #define TYPE_CODE_USER                0x1A // 0x11011 = Code, Readable, Accessed
  1709. #define TYPE_DATA_USER                0x13 // 0x10011 = Data, ReadWrite, Accessed
  1710. #define DESCRIPTOR_EXPAND_DOWN        0x14
  1711. #define DESCRIPTOR_DATA_READWRITE     (0x8|0x2) // Data, Read/Write
  1712. #define DPL_USER    3
  1713. #define DPL_SYSTEM  0
  1714. #define GRAN_BYTE   0
  1715. #define GRAN_PAGE   1
  1716. #define SELECTOR_TABLE_INDEX 0x04
  1717. //
  1718. // Entry of Interrupt Descriptor Table (IDTENTRY)
  1719. //
  1720. typedef struct _KIDTENTRY {
  1721.    USHORT Offset;
  1722.    USHORT Selector;
  1723.    USHORT Access;
  1724.    USHORT ExtendedOffset;
  1725. } KIDTENTRY;
  1726. typedef KIDTENTRY *PKIDTENTRY;
  1727. //
  1728. // User mode, then
  1729. //      let caller specify Carry, Parity, AuxCarry, Zero, Sign, Trap,
  1730. //      Direction, Overflow, AlignCheck.
  1731. //      force Interrupts on.
  1732. //
  1733. #define EFLAGS_DF_MASK        0x00000400L
  1734. #define EFLAGS_INTERRUPT_MASK 0x00000200L
  1735. #define EFLAGS_V86_MASK       0x00020000L
  1736. #define EFLAGS_ALIGN_CHECK    0x00040000L
  1737. #define EFLAGS_IOPL_MASK      0x00003000L
  1738. #define EFLAGS_VIF            0x00080000L
  1739. #define EFLAGS_VIP            0x00100000L
  1740. #define EFLAGS_USER_SANITIZE  0x003e0dd7L
  1741. #define SANITIZE_FLAGS(eFlags, mode) (
  1742.     ((mode) == KernelMode ? 
  1743.         ((0x00000000L) | ((eFlags) & 0x003e0fd7)) : 
  1744.         ((EFLAGS_INTERRUPT_MASK) | ((eFlags) & EFLAGS_USER_SANITIZE))))
  1745. //
  1746. // Definitions that used by CSD and SSD
  1747. //
  1748. #define USER_CODE_DESCRIPTOR  0xCFBFFFFF00000000i64
  1749. #define USER_DATA_DESCRIPTOR  0xCF3FFFFF00000000i64
  1750. //
  1751. // Macros for Emulx86.c and VDM files
  1752. //
  1753. //
  1754. // Prefix Flags
  1755. //
  1756. // Copied from .../ntos/vdm/i386/vdm.inc
  1757. // The bottom byte originally corresponded to the number of prefixes seen
  1758. // which is effectively the length of the instruction...
  1759. //
  1760. #define PREFIX_ES               0x00000100
  1761. #define PREFIX_CS               0x00000200
  1762. #define PREFIX_SS               0x00000400
  1763. #define PREFIX_DS               0x00000800
  1764. #define PREFIX_FS               0x00001000
  1765. #define PREFIX_GS               0x00002000
  1766. #define PREFIX_OPER32           0x00004000
  1767. #define PREFIX_ADDR32           0x00008000
  1768. #define PREFIX_LOCK             0x00010000
  1769. #define PREFIX_REPNE            0x00020000
  1770. #define PREFIX_REP              0x00040000
  1771. #define PREFIX_SEG_ALL          0x00003f00
  1772. //
  1773. // Masks for Dr7 and sanitize macros for various Dr registers.
  1774. //
  1775. #define DR6_LEGAL   0x0000e00f
  1776. #define DR7_LEGAL   0xffff0155  // R/W, LEN for Dr0-Dr4,
  1777.                                 // Local enable for Dr0-Dr4,
  1778.                                 // Le for "perfect" trapping
  1779. #define DR7_ACTIVE  0x00000055  // If any of these bits are set, a Dr is active
  1780. #define SANITIZE_DR6(Dr6, mode) ((Dr6 & DR6_LEGAL));
  1781. #define SANITIZE_DR7(Dr7, mode) ((Dr7 & DR7_LEGAL));
  1782. #define SANITIZE_DRADDR(DrReg, mode) (          
  1783.     (mode) == KernelMode ?                      
  1784.         (DrReg) :                               
  1785.         (((PVOID)DrReg <= MM_HIGHEST_USER_ADDRESS) ?   
  1786.             (DrReg) :                           
  1787.             (0)                                 
  1788.         )                                       
  1789.     )
  1790. // begin_windbgkd
  1791. #ifdef _IA64_
  1792. // begin_nthal
  1793. //
  1794. // Stack Registers for IA64
  1795. //
  1796. typedef struct _STACK_REGISTERS {
  1797. // Please contact INTEL to get IA64-specific information
  1798. // @@BEGIN_DDKSPLIT
  1799.     ULONGLONG IntR32;       // Intel-IA64-Filler
  1800.     ULONGLONG IntR33;       // Intel-IA64-Filler
  1801.     ULONGLONG IntR34;       // Intel-IA64-Filler
  1802.     ULONGLONG IntR35;       // Intel-IA64-Filler
  1803.     ULONGLONG IntR36;       // Intel-IA64-Filler
  1804.     ULONGLONG IntR37;       // Intel-IA64-Filler
  1805.     ULONGLONG IntR38;       // Intel-IA64-Filler
  1806.     ULONGLONG IntR39;       // Intel-IA64-Filler
  1807.     ULONGLONG IntR40;       // Intel-IA64-Filler
  1808.     ULONGLONG IntR41;       // Intel-IA64-Filler
  1809.     ULONGLONG IntR42;       // Intel-IA64-Filler
  1810.     ULONGLONG IntR43;       // Intel-IA64-Filler
  1811.     ULONGLONG IntR44;       // Intel-IA64-Filler
  1812.     ULONGLONG IntR45;       // Intel-IA64-Filler
  1813.     ULONGLONG IntR46;       // Intel-IA64-Filler
  1814.     ULONGLONG IntR47;       // Intel-IA64-Filler
  1815.     ULONGLONG IntR48;       // Intel-IA64-Filler
  1816.     ULONGLONG IntR49;       // Intel-IA64-Filler
  1817.     ULONGLONG IntR50;       // Intel-IA64-Filler
  1818.     ULONGLONG IntR51;       // Intel-IA64-Filler
  1819.     ULONGLONG IntR52;       // Intel-IA64-Filler
  1820.     ULONGLONG IntR53;       // Intel-IA64-Filler
  1821.     ULONGLONG IntR54;       // Intel-IA64-Filler
  1822.     ULONGLONG IntR55;       // Intel-IA64-Filler
  1823.     ULONGLONG IntR56;       // Intel-IA64-Filler
  1824.     ULONGLONG IntR57;       // Intel-IA64-Filler
  1825.     ULONGLONG IntR58;       // Intel-IA64-Filler
  1826.     ULONGLONG IntR59;       // Intel-IA64-Filler
  1827.     ULONGLONG IntR60;       // Intel-IA64-Filler
  1828.     ULONGLONG IntR61;       // Intel-IA64-Filler
  1829.     ULONGLONG IntR62;       // Intel-IA64-Filler
  1830.     ULONGLONG IntR63;       // Intel-IA64-Filler
  1831.     ULONGLONG IntR64;       // Intel-IA64-Filler
  1832.     ULONGLONG IntR65;       // Intel-IA64-Filler
  1833.     ULONGLONG IntR66;       // Intel-IA64-Filler
  1834.     ULONGLONG IntR67;       // Intel-IA64-Filler
  1835.     ULONGLONG IntR68;       // Intel-IA64-Filler
  1836.     ULONGLONG IntR69;       // Intel-IA64-Filler
  1837.     ULONGLONG IntR70;       // Intel-IA64-Filler
  1838.     ULONGLONG IntR71;       // Intel-IA64-Filler
  1839.     ULONGLONG IntR72;       // Intel-IA64-Filler
  1840.     ULONGLONG IntR73;       // Intel-IA64-Filler
  1841.     ULONGLONG IntR74;       // Intel-IA64-Filler
  1842.     ULONGLONG IntR75;       // Intel-IA64-Filler
  1843.     ULONGLONG IntR76;       // Intel-IA64-Filler
  1844.     ULONGLONG IntR77;       // Intel-IA64-Filler
  1845.     ULONGLONG IntR78;       // Intel-IA64-Filler
  1846.     ULONGLONG IntR79;       // Intel-IA64-Filler
  1847.     ULONGLONG IntR80;       // Intel-IA64-Filler
  1848.     ULONGLONG IntR81;       // Intel-IA64-Filler
  1849.     ULONGLONG IntR82;       // Intel-IA64-Filler
  1850.     ULONGLONG IntR83;       // Intel-IA64-Filler
  1851.     ULONGLONG IntR84;       // Intel-IA64-Filler
  1852.     ULONGLONG IntR85;       // Intel-IA64-Filler
  1853.     ULONGLONG IntR86;       // Intel-IA64-Filler
  1854.     ULONGLONG IntR87;       // Intel-IA64-Filler
  1855.     ULONGLONG IntR88;       // Intel-IA64-Filler
  1856.     ULONGLONG IntR89;       // Intel-IA64-Filler
  1857.     ULONGLONG IntR90;       // Intel-IA64-Filler
  1858.     ULONGLONG IntR91;       // Intel-IA64-Filler
  1859.     ULONGLONG IntR92;       // Intel-IA64-Filler
  1860.     ULONGLONG IntR93;       // Intel-IA64-Filler
  1861.     ULONGLONG IntR94;       // Intel-IA64-Filler
  1862.     ULONGLONG IntR95;       // Intel-IA64-Filler
  1863.     ULONGLONG IntR96;       // Intel-IA64-Filler
  1864.     ULONGLONG IntR97;       // Intel-IA64-Filler
  1865.     ULONGLONG IntR98;       // Intel-IA64-Filler
  1866.     ULONGLONG IntR99;       // Intel-IA64-Filler
  1867.     ULONGLONG IntR100;       // Intel-IA64-Filler
  1868.     ULONGLONG IntR101;       // Intel-IA64-Filler
  1869.     ULONGLONG IntR102;       // Intel-IA64-Filler
  1870.     ULONGLONG IntR103;       // Intel-IA64-Filler
  1871.     ULONGLONG IntR104;       // Intel-IA64-Filler
  1872.     ULONGLONG IntR105;       // Intel-IA64-Filler
  1873.     ULONGLONG IntR106;       // Intel-IA64-Filler
  1874.     ULONGLONG IntR107;       // Intel-IA64-Filler
  1875.     ULONGLONG IntR108;       // Intel-IA64-Filler
  1876.     ULONGLONG IntR109;       // Intel-IA64-Filler
  1877.     ULONGLONG IntR110;       // Intel-IA64-Filler
  1878.     ULONGLONG IntR111;       // Intel-IA64-Filler
  1879.     ULONGLONG IntR112;       // Intel-IA64-Filler
  1880.     ULONGLONG IntR113;       // Intel-IA64-Filler
  1881.     ULONGLONG IntR114;       // Intel-IA64-Filler
  1882.     ULONGLONG IntR115;       // Intel-IA64-Filler
  1883.     ULONGLONG IntR116;       // Intel-IA64-Filler
  1884.     ULONGLONG IntR117;       // Intel-IA64-Filler
  1885.     ULONGLONG IntR118;       // Intel-IA64-Filler
  1886.     ULONGLONG IntR119;       // Intel-IA64-Filler
  1887.     ULONGLONG IntR120;       // Intel-IA64-Filler
  1888.     ULONGLONG IntR121;       // Intel-IA64-Filler
  1889.     ULONGLONG IntR122;       // Intel-IA64-Filler
  1890.     ULONGLONG IntR123;       // Intel-IA64-Filler
  1891.     ULONGLONG IntR124;       // Intel-IA64-Filler
  1892.     ULONGLONG IntR125;       // Intel-IA64-Filler
  1893.     ULONGLONG IntR126;       // Intel-IA64-Filler
  1894.     ULONGLONG IntR127;       // Intel-IA64-Filler
  1895.                                  // Nat bits for stack registers       // Intel-IA64-Filler
  1896.     ULONGLONG IntNats2;          // r32-r95 in bit positions 1 to 63       // Intel-IA64-Filler
  1897.     ULONGLONG IntNats3;          // r96-r127 in bit position 1 to 31       // Intel-IA64-Filler
  1898. // @@END_DDKSPLIT
  1899. } STACK_REGISTERS, *PSTACK_REGISTERS;
  1900. // Please contact INTEL to get IA64-specific information
  1901. // @@BEGIN_DDKSPLIT
  1902. //
  1903. // Special Registers for IA64  // Intel-IA64-Filler
  1904. //
  1905. typedef struct _KSPECIAL_REGISTERS {  // Intel-IA64-Filler
  1906.     // Kernel debug breakpoint registers       // Intel-IA64-Filler
  1907.     ULONGLONG KernelDbI0;         // Instruction debug registers       // Intel-IA64-Filler
  1908.     ULONGLONG KernelDbI1;       // Intel-IA64-Filler
  1909.     ULONGLONG KernelDbI2;       // Intel-IA64-Filler
  1910.     ULONGLONG KernelDbI3;       // Intel-IA64-Filler
  1911.     ULONGLONG KernelDbI4;       // Intel-IA64-Filler
  1912.     ULONGLONG KernelDbI5;       // Intel-IA64-Filler
  1913.     ULONGLONG KernelDbI6;       // Intel-IA64-Filler
  1914.     ULONGLONG KernelDbI7;       // Intel-IA64-Filler
  1915.     ULONGLONG KernelDbD0;         // Data debug registers       // Intel-IA64-Filler
  1916.     ULONGLONG KernelDbD1;       // Intel-IA64-Filler
  1917.     ULONGLONG KernelDbD2;       // Intel-IA64-Filler
  1918.     ULONGLONG KernelDbD3;       // Intel-IA64-Filler
  1919.     ULONGLONG KernelDbD4;       // Intel-IA64-Filler
  1920.     ULONGLONG KernelDbD5;       // Intel-IA64-Filler
  1921.     ULONGLONG KernelDbD6;       // Intel-IA64-Filler
  1922.     ULONGLONG KernelDbD7;       // Intel-IA64-Filler
  1923.     // Kernel performance monitor registers       // Intel-IA64-Filler
  1924.     ULONGLONG KernelPfC0;         // Performance configuration registers       // Intel-IA64-Filler
  1925.     ULONGLONG KernelPfC1;       // Intel-IA64-Filler
  1926.     ULONGLONG KernelPfC2;       // Intel-IA64-Filler
  1927.     ULONGLONG KernelPfC3;       // Intel-IA64-Filler
  1928.     ULONGLONG KernelPfC4;       // Intel-IA64-Filler
  1929.     ULONGLONG KernelPfC5;       // Intel-IA64-Filler
  1930.     ULONGLONG KernelPfC6;       // Intel-IA64-Filler
  1931.     ULONGLONG KernelPfC7;       // Intel-IA64-Filler
  1932.     ULONGLONG KernelPfD0;         // Performance data registers       // Intel-IA64-Filler
  1933.     ULONGLONG KernelPfD1;       // Intel-IA64-Filler
  1934.     ULONGLONG KernelPfD2;       // Intel-IA64-Filler
  1935.     ULONGLONG KernelPfD3;       // Intel-IA64-Filler
  1936.     ULONGLONG KernelPfD4;       // Intel-IA64-Filler
  1937.     ULONGLONG KernelPfD5;       // Intel-IA64-Filler
  1938.     ULONGLONG KernelPfD6;       // Intel-IA64-Filler
  1939.     ULONGLONG KernelPfD7;       // Intel-IA64-Filler
  1940.     // kernel bank shadow (hidden) registers       // Intel-IA64-Filler
  1941.     ULONGLONG IntH16;       // Intel-IA64-Filler
  1942.     ULONGLONG IntH17;       // Intel-IA64-Filler
  1943.     ULONGLONG IntH18;       // Intel-IA64-Filler
  1944.     ULONGLONG IntH19;       // Intel-IA64-Filler
  1945.     ULONGLONG IntH20;       // Intel-IA64-Filler
  1946.     ULONGLONG IntH21;       // Intel-IA64-Filler
  1947.     ULONGLONG IntH22;       // Intel-IA64-Filler
  1948.     ULONGLONG IntH23;       // Intel-IA64-Filler
  1949.     ULONGLONG IntH24;       // Intel-IA64-Filler
  1950.     ULONGLONG IntH25;       // Intel-IA64-Filler
  1951.     ULONGLONG IntH26;       // Intel-IA64-Filler
  1952.     ULONGLONG IntH27;       // Intel-IA64-Filler
  1953.     ULONGLONG IntH28;       // Intel-IA64-Filler
  1954.     ULONGLONG IntH29;       // Intel-IA64-Filler
  1955.     ULONGLONG IntH30;       // Intel-IA64-Filler
  1956.     ULONGLONG IntH31;       // Intel-IA64-Filler
  1957.     // Application Registers       // Intel-IA64-Filler
  1958.     //       - CPUID Registers - AR       // Intel-IA64-Filler
  1959.     ULONGLONG ApCPUID0; // Cpuid Register 0       // Intel-IA64-Filler
  1960.     ULONGLONG ApCPUID1; // Cpuid Register 1       // Intel-IA64-Filler
  1961.     ULONGLONG ApCPUID2; // Cpuid Register 2       // Intel-IA64-Filler
  1962.     ULONGLONG ApCPUID3; // Cpuid Register 3       // Intel-IA64-Filler
  1963.     ULONGLONG ApCPUID4; // Cpuid Register 4       // Intel-IA64-Filler
  1964.     ULONGLONG ApCPUID5; // Cpuid Register 5       // Intel-IA64-Filler
  1965.     ULONGLONG ApCPUID6; // Cpuid Register 6       // Intel-IA64-Filler
  1966.     ULONGLONG ApCPUID7; // Cpuid Register 7       // Intel-IA64-Filler
  1967.     //       - Kernel Registers - AR       // Intel-IA64-Filler
  1968.     ULONGLONG ApKR0;    // Kernel Register 0 (User RO)       // Intel-IA64-Filler
  1969.     ULONGLONG ApKR1;    // Kernel Register 1 (User RO)       // Intel-IA64-Filler
  1970.     ULONGLONG ApKR2;    // Kernel Register 2 (User RO)       // Intel-IA64-Filler
  1971.     ULONGLONG ApKR3;    // Kernel Register 3 (User RO)       // Intel-IA64-Filler
  1972.     ULONGLONG ApKR4;    // Kernel Register 4       // Intel-IA64-Filler
  1973.     ULONGLONG ApKR5;    // Kernel Register 5       // Intel-IA64-Filler
  1974.     ULONGLONG ApKR6;    // Kernel Register 6       // Intel-IA64-Filler
  1975.     ULONGLONG ApKR7;    // Kernel Register 7       // Intel-IA64-Filler
  1976.     ULONGLONG ApITC;    // Interval Timer Counter       // Intel-IA64-Filler
  1977.     // Global control registers       // Intel-IA64-Filler
  1978.     ULONGLONG ApITM;    // Interval Timer Match register       // Intel-IA64-Filler
  1979.     ULONGLONG ApIVA;    // Interrupt Vector Address       // Intel-IA64-Filler
  1980.     ULONGLONG ApPTA;    // Page Table Address       // Intel-IA64-Filler
  1981.     ULONGLONG ApGPTA;   // ia32 Page Table Address       // Intel-IA64-Filler
  1982.     ULONGLONG StISR;    // Interrupt status       // Intel-IA64-Filler
  1983.     ULONGLONG StIFA;    // Interruption Faulting Address       // Intel-IA64-Filler
  1984.     ULONGLONG StITIR;   // Interruption TLB Insertion Register       // Intel-IA64-Filler
  1985.     ULONGLONG StIIPA;   // Interruption Instruction Previous Address (RO)       // Intel-IA64-Filler
  1986.     ULONGLONG StIIM;    // Interruption Immediate register (RO)       // Intel-IA64-Filler
  1987.     ULONGLONG StIHA;    // Interruption Hash Address (RO)       // Intel-IA64-Filler
  1988.     //       - External Interrupt control registers (SAPIC)       // Intel-IA64-Filler
  1989.     ULONGLONG SaLID;    // Local SAPIC ID       // Intel-IA64-Filler
  1990.     ULONGLONG SaIVR;    // Interrupt Vector Register (RO)       // Intel-IA64-Filler
  1991.     ULONGLONG SaTPR;    // Task Priority Register       // Intel-IA64-Filler
  1992.     ULONGLONG SaEOI;    // End Of Interrupt       // Intel-IA64-Filler
  1993.     ULONGLONG SaIRR0;   // Interrupt Request Register 0 (RO)       // Intel-IA64-Filler
  1994.     ULONGLONG SaIRR1;   // Interrupt Request Register 1 (RO)       // Intel-IA64-Filler
  1995.     ULONGLONG SaIRR2;   // Interrupt Request Register 2 (RO)       // Intel-IA64-Filler
  1996.     ULONGLONG SaIRR3;   // Interrupt Request Register 3 (RO)       // Intel-IA64-Filler
  1997.     ULONGLONG SaITV;    // Interrupt Timer Vector       // Intel-IA64-Filler
  1998.     ULONGLONG SaPMV;    // Performance Monitor Vector       // Intel-IA64-Filler
  1999.     ULONGLONG SaCMCV;   // Corrected Machine Check Vector       // Intel-IA64-Filler
  2000.     ULONGLONG SaLRR0;   // Local Interrupt Redirection Vector 0       // Intel-IA64-Filler
  2001.     ULONGLONG SaLRR1;   // Local Interrupt Redirection Vector 1       // Intel-IA64-Filler
  2002.     // System Registers       // Intel-IA64-Filler
  2003.     //       - Region registers       // Intel-IA64-Filler
  2004.     ULONGLONG Rr0;  // Region register 0       // Intel-IA64-Filler
  2005.     ULONGLONG Rr1;  // Region register 1       // Intel-IA64-Filler
  2006.     ULONGLONG Rr2;  // Region register 2       // Intel-IA64-Filler
  2007.     ULONGLONG Rr3;  // Region register 3       // Intel-IA64-Filler
  2008.     ULONGLONG Rr4;  // Region register 4       // Intel-IA64-Filler
  2009.     ULONGLONG Rr5;  // Region register 5       // Intel-IA64-Filler
  2010.     ULONGLONG Rr6;  // Region register 6       // Intel-IA64-Filler
  2011.     ULONGLONG Rr7;  // Region register 7       // Intel-IA64-Filler
  2012.     //      - Protection Key registers  // Intel-IA64-Filler
  2013.     ULONGLONG Pkr0;     // Protection Key register 0  // Intel-IA64-Filler
  2014.     ULONGLONG Pkr1;     // Protection Key register 1  // Intel-IA64-Filler
  2015.     ULONGLONG Pkr2;     // Protection Key register 2  // Intel-IA64-Filler
  2016.     ULONGLONG Pkr3;     // Protection Key register 3  // Intel-IA64-Filler
  2017.     ULONGLONG Pkr4;     // Protection Key register 4  // Intel-IA64-Filler
  2018.     ULONGLONG Pkr5;     // Protection Key register 5  // Intel-IA64-Filler
  2019.     ULONGLONG Pkr6;     // Protection Key register 6  // Intel-IA64-Filler
  2020.     ULONGLONG Pkr7;     // Protection Key register 7  // Intel-IA64-Filler
  2021.     ULONGLONG Pkr8;     // Protection Key register 8  // Intel-IA64-Filler
  2022.     ULONGLONG Pkr9;     // Protection Key register 9  // Intel-IA64-Filler
  2023.     ULONGLONG Pkr10;    // Protection Key register 10  // Intel-IA64-Filler
  2024.     ULONGLONG Pkr11;    // Protection Key register 11  // Intel-IA64-Filler
  2025.     ULONGLONG Pkr12;    // Protection Key register 12  // Intel-IA64-Filler
  2026.     ULONGLONG Pkr13;    // Protection Key register 13  // Intel-IA64-Filler
  2027.     ULONGLONG Pkr14;    // Protection Key register 14  // Intel-IA64-Filler
  2028.     ULONGLONG Pkr15;    // Protection Key register 15  // Intel-IA64-Filler
  2029.     //      -  Translation Lookaside buffers  // Intel-IA64-Filler
  2030.     ULONGLONG TrI0;     // Instruction Translation Register 0  // Intel-IA64-Filler
  2031.     ULONGLONG TrI1;     // Instruction Translation Register 1  // Intel-IA64-Filler
  2032.     ULONGLONG TrI2;     // Instruction Translation Register 2  // Intel-IA64-Filler
  2033.     ULONGLONG TrI3;     // Instruction Translation Register 3  // Intel-IA64-Filler
  2034.     ULONGLONG TrI4;     // Instruction Translation Register 4  // Intel-IA64-Filler
  2035.     ULONGLONG TrI5;     // Instruction Translation Register 5  // Intel-IA64-Filler
  2036.     ULONGLONG TrI6;     // Instruction Translation Register 6  // Intel-IA64-Filler
  2037.     ULONGLONG TrI7;     // Instruction Translation Register 7  // Intel-IA64-Filler
  2038.     ULONGLONG TrD0;     // Data Translation Register 0  // Intel-IA64-Filler
  2039.     ULONGLONG TrD1;     // Data Translation Register 1  // Intel-IA64-Filler
  2040.     ULONGLONG TrD2;     // Data Translation Register 2  // Intel-IA64-Filler
  2041.     ULONGLONG TrD3;     // Data Translation Register 3  // Intel-IA64-Filler
  2042.     ULONGLONG TrD4;     // Data Translation Register 4  // Intel-IA64-Filler
  2043.     ULONGLONG TrD5;     // Data Translation Register 5  // Intel-IA64-Filler
  2044.     ULONGLONG TrD6;     // Data Translation Register 6  // Intel-IA64-Filler
  2045.     ULONGLONG TrD7;     // Data Translation Register 7  // Intel-IA64-Filler
  2046.     //      -  Machine Specific Registers  // Intel-IA64-Filler
  2047.     ULONGLONG SrMSR0;   // Machine Specific Register 0  // Intel-IA64-Filler
  2048.     ULONGLONG SrMSR1;   // Machine Specific Register 1  // Intel-IA64-Filler
  2049.     ULONGLONG SrMSR2;   // Machine Specific Register 2  // Intel-IA64-Filler
  2050.     ULONGLONG SrMSR3;   // Machine Specific Register 3  // Intel-IA64-Filler
  2051.     ULONGLONG SrMSR4;   // Machine Specific Register 4  // Intel-IA64-Filler
  2052.     ULONGLONG SrMSR5;   // Machine Specific Register 5  // Intel-IA64-Filler
  2053.     ULONGLONG SrMSR6;   // Machine Specific Register 6  // Intel-IA64-Filler
  2054.     ULONGLONG SrMSR7;   // Machine Specific Register 7  // Intel-IA64-Filler
  2055. } KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS;  // Intel-IA64-Filler
  2056. //
  2057. // Processor State structure.
  2058. //
  2059. typedef struct _KPROCESSOR_STATE {  // Intel-IA64-Filler
  2060.     struct _CONTEXT ContextFrame;  // Intel-IA64-Filler
  2061.     struct _KSPECIAL_REGISTERS SpecialRegisters;  // Intel-IA64-Filler
  2062. } KPROCESSOR_STATE, *PKPROCESSOR_STATE;  // Intel-IA64-Filler
  2063. // @@END_DDKSPLIT
  2064. // end_nthal
  2065. #endif // _IA64_
  2066. // end_windbgkd
  2067. // begin_nthal begin_ntddk
  2068. //
  2069. // Processor Control Block (PRCB)
  2070. //
  2071. #define PRCB_MINOR_VERSION 1
  2072. #define PRCB_MAJOR_VERSION 1
  2073. #define PRCB_BUILD_DEBUG        0x0001
  2074. #define PRCB_BUILD_UNIPROCESSOR 0x0002
  2075. struct _RESTART_BLOCK;
  2076. typedef struct _KPRCB {
  2077. //
  2078. // Major and minor version numbers of the PCR.
  2079. //
  2080.     USHORT MinorVersion;
  2081.     USHORT MajorVersion;
  2082. //
  2083. // Start of the architecturally defined section of the PRCB. This section
  2084. // may be directly addressed by vendor/platform specific HAL code and will
  2085. // not change from version to version of NT.
  2086. //
  2087. //
  2088.     struct _KTHREAD *CurrentThread;
  2089.     struct _KTHREAD *RESTRICTED_POINTER NextThread;
  2090.     struct _KTHREAD *IdleThread;
  2091.     CCHAR Number;
  2092.     CCHAR Reserved;
  2093.     USHORT BuildType;
  2094.     KAFFINITY SetMember;
  2095.     struct _RESTART_BLOCK *RestartBlock;
  2096.     ULONG_PTR PcrPage;
  2097.     ULONG Spares1[4];
  2098. //
  2099. // Space reserved for the system.
  2100. //
  2101.     ULONGLONG SystemReserved[8];
  2102. //
  2103. // Space reserved for the HAL.
  2104. //
  2105.     ULONGLONG HalReserved[16];
  2106. //
  2107. // End of the architecturally defined section of the PRCB.
  2108. // end_nthal end_ntddk
  2109. //
  2110.     ULONG DpcTime;
  2111.     ULONG InterruptTime;
  2112.     ULONG KernelTime;
  2113.     ULONG UserTime;
  2114.     ULONG InterruptCount;
  2115.     ULONG DispatchInterruptCount;
  2116.     ULONG ApcBypassCount;
  2117.     ULONG DpcBypassCount;
  2118.     ULONG Spare0[4];
  2119. //
  2120. // MP information.
  2121. //
  2122.     PVOID Spare1;
  2123.     PVOID Spare2;
  2124.     PVOID Spare3;
  2125.     volatile ULONG IpiFrozen;
  2126.     struct _KPROCESSOR_STATE ProcessorState;
  2127. //
  2128. //  Per-processor data for various hot code which resides in the
  2129. //  kernel image. Each processor is given it's own copy of the data
  2130. //  to lessen the cache impact of sharing the data between multiple
  2131. //  processors.
  2132. //
  2133. //
  2134. //  Spares (formerly fsrtl filelock free lists)
  2135. //
  2136.     PVOID SpareHotData[2];
  2137. //
  2138. //  Cache manager performance counters.
  2139. //
  2140.     ULONG CcFastReadNoWait;
  2141.     ULONG CcFastReadWait;
  2142.     ULONG CcFastReadNotPossible;
  2143.     ULONG CcCopyReadNoWait;
  2144.     ULONG CcCopyReadWait;
  2145.     ULONG CcCopyReadNoWaitMiss;
  2146. //
  2147. // Kernel performance counters.
  2148. //
  2149.     ULONG KeAlignmentFixupCount;
  2150.     ULONG KeContextSwitches;
  2151.     ULONG KeDcacheFlushCount;
  2152.     ULONG KeExceptionDispatchCount;
  2153.     ULONG KeFirstLevelTbFills;
  2154.     ULONG KeFloatingEmulationCount;
  2155.     ULONG KeIcacheFlushCount;
  2156.     ULONG KeSecondLevelTbFills;
  2157.     ULONG KeSystemCalls;
  2158. //
  2159. //  Reserved for future counters.
  2160. //
  2161.     ULONG ReservedCounter[8];
  2162. //
  2163. // I/O system per processor single entry lookaside lists.
  2164. //
  2165.     PVOID SmallIrpFreeEntry;
  2166.     PVOID LargeIrpFreeEntry;
  2167.     PVOID MdlFreeEntry;
  2168. //
  2169. // Object manager per processor single entry lookaside lists.
  2170. //
  2171.     PVOID CreateInfoFreeEntry;
  2172.     PVOID NameBufferFreeEntry;
  2173. //
  2174. // Cache manager per processor single entry lookaside lists.
  2175. //
  2176.     PVOID SharedCacheMapEntry;
  2177. //
  2178. //  Spares (formerly fsrtl filelock free lists)
  2179. //
  2180.     PVOID MoreSpareHotData[2];
  2181. //
  2182. // Nonpaged per processor lookaside lists.
  2183. //
  2184.     PP_LOOKASIDE_LIST PPLookasideList[16];
  2185. //
  2186. // Nonpaged per processor small pool lookaside lists.
  2187. //
  2188.     PP_LOOKASIDE_LIST PPNPagedLookasideList[POOL_SMALL_LISTS];
  2189. //
  2190. // Paged per processor small pool lookaside lists.
  2191. //
  2192.     PP_LOOKASIDE_LIST PPPagedLookasideList[POOL_SMALL_LISTS];
  2193. //
  2194. // Per processor lock queue entries.
  2195. //
  2196.     KSPIN_LOCK_QUEUE LockQueue[16];
  2197. //
  2198. // MP interprocessor request packet and summary.
  2199. //
  2200. // N.B. This is carefully aligned to be on a cache line boundary.
  2201. //
  2202.     volatile PVOID CurrentPacket[3];
  2203.     volatile KAFFINITY TargetSet;
  2204.     volatile PKIPI_WORKER WorkerRoutine;
  2205.     ULONGLONG CachePad1[11];
  2206. //
  2207. // N.B. These two longwords must be on a quadword boundary and adjacent.
  2208. //
  2209.     volatile ULONG RequestSummary;
  2210.     volatile struct _KPRCB *SignalDone;
  2211. //
  2212. // Spare counters.
  2213. //
  2214.     ULONGLONG Spare4[14];
  2215. //
  2216. // DPC interrupt requested.
  2217. //
  2218.     ULONG DpcInterruptRequested;
  2219.     ULONGLONG Spare5[15];
  2220.     ULONG MaximumDpcQueueDepth;
  2221.     ULONG MinimumDpcRate;
  2222.     ULONG AdjustDpcThreshold;
  2223.     ULONG DpcRequestRate;
  2224.     LARGE_INTEGER StartCount;
  2225. //
  2226. // DPC list head, spinlock, and count.
  2227. //
  2228.     LIST_ENTRY DpcListHead;
  2229.     KSPIN_LOCK DpcLock;
  2230.     ULONG DpcCount;
  2231.     ULONG DpcLastCount;
  2232.     ULONG QuantumEnd;
  2233.     ULONG DpcRoutineActive;
  2234.     ULONG DpcQueueDepth;
  2235.     BOOLEAN SkipTick;
  2236. //
  2237. // Address of MP interprocessor operation counters.
  2238. //
  2239.     PKIPI_COUNTS IpiCounts;
  2240. //
  2241. // Processors power state
  2242. //
  2243.     PROCESSOR_POWER_STATE PowerState;
  2244. // begin_nthal begin_ntddk
  2245. } KPRCB, *PKPRCB, *RESTRICTED_POINTER PRKPRCB;
  2246. // begin_ntndis
  2247. //
  2248. // Define Processor Control Region Structure.
  2249. //
  2250. #define PCR_MINOR_VERSION 1
  2251. #define PCR_MAJOR_VERSION 1
  2252. typedef struct _KPCR {
  2253. //
  2254. // Major and minor version numbers of the PCR.
  2255. //
  2256.     ULONG MinorVersion;
  2257.     ULONG MajorVersion;
  2258. //
  2259. // Start of the architecturally defined section of the PCR. This section
  2260. // may be directly addressed by vendor/platform specific HAL code and will
  2261. // not change from version to version of NT.
  2262. //
  2263. //
  2264. // First and second level cache parameters.
  2265. //
  2266.     ULONG FirstLevelDcacheSize;
  2267.     ULONG FirstLevelDcacheFillSize;
  2268.     ULONG FirstLevelIcacheSize;
  2269.     ULONG FirstLevelIcacheFillSize;
  2270.     ULONG SecondLevelDcacheSize;
  2271.     ULONG SecondLevelDcacheFillSize;
  2272.     ULONG SecondLevelIcacheSize;
  2273.     ULONG SecondLevelIcacheFillSize;
  2274. //
  2275. // Data cache alignment and fill size used for cache flushing and alignment.
  2276. // These fields are set to the larger of the first and second level data
  2277. // cache fill sizes.
  2278. //
  2279.     ULONG DcacheAlignment;
  2280.     ULONG DcacheFillSize;
  2281. //
  2282. // Instruction cache alignment and fill size used for cache flushing and
  2283. // alignment. These fields are set to the larger of the first and second
  2284. // level data cache fill sizes.
  2285. //
  2286.     ULONG IcacheAlignment;
  2287.     ULONG IcacheFillSize;
  2288. //
  2289. // Processor identification from PrId register.
  2290. //
  2291.     ULONG ProcessorId;
  2292. //
  2293. // Profiling data.
  2294. //
  2295.     ULONG ProfileInterval;
  2296.     ULONG ProfileCount;
  2297. //
  2298. // Stall execution count and scale factor.
  2299. //
  2300.     ULONG StallExecutionCount;
  2301.     ULONG StallScaleFactor;
  2302.     ULONG InterruptionCount;
  2303. //
  2304. // Space reserved for the system.
  2305. //
  2306.     ULONGLONG   SystemReserved[6];
  2307. //
  2308. // Space reserved for the HAL
  2309. //
  2310.     ULONGLONG   HalReserved[64];
  2311. //
  2312. // IRQL mapping tables.
  2313. //
  2314.     UCHAR IrqlMask[64];
  2315.     UCHAR IrqlTable[64];
  2316. //
  2317. // External Interrupt vectors.
  2318. //
  2319.     PKINTERRUPT_ROUTINE InterruptRoutine[MAXIMUM_VECTOR];
  2320. //
  2321. // Reserved interrupt vector mask.
  2322. //
  2323.     ULONG ReservedVectors;
  2324. //
  2325. // Processor affinity mask.
  2326. //
  2327.     KAFFINITY SetMember;
  2328. //
  2329. // Complement of the processor affinity mask.
  2330. //
  2331.     KAFFINITY NotMember;
  2332. //
  2333. // Pointer to processor control block.
  2334. //
  2335.     struct _KPRCB *Prcb;
  2336. //
  2337. //  Shadow copy of Prcb->CurrentThread for fast access
  2338. //
  2339.     struct _KTHREAD *CurrentThread;
  2340. //
  2341. // Processor number.
  2342. //
  2343.     CCHAR Number;                        // Processor Number
  2344.     UCHAR DebugActive;                   // debug register active in user flag
  2345.     UCHAR KernelDebugActive;             // debug register active in kernel flag
  2346.     UCHAR CurrentIrql;                   // Current IRQL
  2347.     union {
  2348.         USHORT SoftwareInterruptPending; // Software Interrupt Pending Flag
  2349.         struct {
  2350.             UCHAR ApcInterrupt;          // 0x01 if APC int pending
  2351.             UCHAR DispatchInterrupt;     // 0x01 if dispatch int pending
  2352.         };
  2353.     };
  2354. //
  2355. // End of the architecturally defined section of the PCR. This section
  2356. // may be directly addressed by vendor/platform specific HAL code and will
  2357. // not change from version to version of NT.
  2358. //
  2359. // end_nthal end_ntddk
  2360. //
  2361. // OS Part
  2362. //
  2363. // Please contact INTEL to get IA64-specific information
  2364. // @@BEGIN_DDKSPLIT
  2365. //  Per processor kernel (ntoskrnl.exe) global pointer - gp (swizzled) // Intel-IA64-Filler
  2366.     ULONGLONG   KernelGP; // Intel-IA64-Filler
  2367. //  Per processor initial kernel stack for current thread (swizzled) // Intel-IA64-Filler
  2368.     ULONGLONG   InitialStack; // Intel-IA64-Filler
  2369. //  Per processor pointer to kernel BSP (swizzled) // Intel-IA64-Filler
  2370.     ULONGLONG   InitialBStore; // Intel-IA64-Filler
  2371. //  Per processor kernel stack limit (swizzled) // Intel-IA64-Filler
  2372.     ULONGLONG   StackLimit; // Intel-IA64-Filler
  2373. //  Per processor kernel backing store limit (swizzled) // Intel-IA64-Filler
  2374.     ULONGLONG   BStoreLimit; // Intel-IA64-Filler
  2375. //  Per processor panic kernel stack (swizzled) // Intel-IA64-Filler
  2376.     ULONGLONG   PanicStack; // Intel-IA64-Filler
  2377. //
  2378. //  Save area for kernel entry/exit
  2379. //
  2380.     ULONGLONG   SavedIIM; // Intel-IA64-Filler
  2381.     ULONGLONG   SavedIFA; // Intel-IA64-Filler
  2382.     ULONGLONG   ForwardProgressBuffer[16]; // Intel-IA64-Filler
  2383. // @@END_DDKSPLIT
  2384. // begin_nthal begin_ntddk
  2385. } KPCR, *PKPCR;
  2386. // end_nthal end_ntddk
  2387. // begin_nthal
  2388. // Please contact INTEL to get IA64-specific information
  2389. // @@BEGIN_DDKSPLIT
  2390. //
  2391. // Define the number of bits to shift to right justify the Page Table Index
  2392. // field of a PTE.
  2393. //
  2394. #define PTI_SHIFT PAGE_SHIFT // Intel-IA64-Filler
  2395. //
  2396. // Define the number of bits to shift to right justify the Page Directory Index
  2397. // field of a PTE.
  2398. //
  2399. #define PDI_SHIFT (PTI_SHIFT + PAGE_SHIFT - PTE_SHIFT)  // Intel-IA64-Filler
  2400. #define PDI1_SHIFT (PDI_SHIFT + PAGE_SHIFT - PTE_SHIFT) // Intel-IA64-Filler
  2401. #define PDI_MASK ((1 << (PAGE_SHIFT - PTE_SHIFT)) - 1)  // Intel-IA64-Filler
  2402. //
  2403. // Define the number of bits to shift to left to produce page table offset
  2404. // from page table index.
  2405. //
  2406. #define PTE_SHIFT 3 // Intel-IA64-Filler
  2407. //
  2408. // Define the number of bits to shift to the right justify the Page Directory
  2409. // Table Entry field.
  2410. //
  2411. #define VHPT_PDE_BITS 40 // Intel-IA64-Filler
  2412. //
  2413. // Define the RID for IO Port Space. // Intel-IA64-Filler
  2414. //
  2415. #define RR_IO_PORT 6 // Intel-IA64-Filler
  2416. // @@END_DDKSPLIT
  2417. // begin_ntddk
  2418. //
  2419. // The highest user address reserves 64K bytes for a guard page. This
  2420. // the probing of address from kernel mode to only have to check the
  2421. // starting address for structures of 64k bytes or less.
  2422. //
  2423. #define MM_HIGHEST_USER_ADDRESS (PVOID) (ULONG_PTR)((UADDRESS_BASE + 0x3FFFFFEFFFF)) // highest user address
  2424. #define MM_USER_PROBE_ADDRESS ((ULONG_PTR)(UADDRESS_BASE + 0x3FFFFFF0000UI64)) // starting address of guard page
  2425. #define MM_SYSTEM_RANGE_START (PVOID) (KSEG0_BASE) // start of system space
  2426. //
  2427. // The following definitions are required for the debugger data block.
  2428. //
  2429. extern PVOID MmHighestUserAddress;
  2430. extern PVOID MmSystemRangeStart;
  2431. extern ULONG_PTR MmUserProbeAddress;
  2432. //
  2433. // The lowest user address reserves the low 64k.
  2434. //
  2435. #define MM_LOWEST_USER_ADDRESS  (PVOID)((ULONG_PTR)(UADDRESS_BASE+0x00010000))
  2436. // begin_wdm
  2437. #define MmGetProcedureAddress(Address) (Address)
  2438. #define MmLockPagableCodeSection(PLabelAddress) 
  2439.     MmLockPagableDataSection((PVOID)(*((PULONGLONG)PLabelAddress)))
  2440. // end_ntddk end_wdm
  2441. //
  2442. // Define the page table base and the page directory base for
  2443. // the TB miss routines and memory management.
  2444. //
  2445. #define VA_SIGN    0x0002000000000000UI64    // MSB of implemented virtual address
  2446. #define VA_FILL    0x1FFC000000000000UI64    // singed fill for unimplemented virtual address
  2447. #define VRN_MASK   0xE000000000000000UI64    // Virtual Region Number mask
  2448. #define PTA_BASE0  0x1FFC000000000000UI64    // Page Table Address BASE 0
  2449. #define PTA_SIGN   (VA_SIGN >> (PAGE_SHIFT - PTE_SHIFT)) // MSB of VPN offset
  2450. #define PTA_FILL   (VA_FILL >> (PAGE_SHIFT - PTE_SHIFT)) // signed fill for PTA base0
  2451. #define PTA_BASE   (PTA_BASE0|PTA_FILL)      // PTA_BASE address
  2452. //
  2453. // user/kernel page table base and top addresses
  2454. //
  2455. #define SADDRESS_BASE 0x2000000000000000UI64  // session base address
  2456. #define PTE_UBASE  (UADDRESS_BASE|PTA_BASE)
  2457. #define PTE_KBASE  (KADDRESS_BASE|PTA_BASE)
  2458. #define PTE_SBASE  (SADDRESS_BASE|PTA_BASE)
  2459. #define PTE_UTOP (PTE_UBASE|(((ULONG_PTR)1 << PDI1_SHIFT) - 1)) // top level PDR address (user)
  2460. #define PTE_KTOP (PTE_KBASE|(((ULONG_PTR)1 << PDI1_SHIFT) - 1)) // top level PDR address (kernel)
  2461. #define PTE_STOP (PTE_SBASE|(((ULONG_PTR)1 << PDI1_SHIFT) - 1)) // top level PDR address (session)
  2462. //
  2463. // Second level user and kernel PDR address
  2464. //
  2465. #define PDE_UBASE  (PTE_UBASE|(PTE_UBASE>>(PTI_SHIFT-PTE_SHIFT)))
  2466. #define PDE_KBASE  (PTE_KBASE|(PTE_KBASE>>(PTI_SHIFT-PTE_SHIFT)))
  2467. #define PDE_SBASE  (PTE_SBASE|(PTE_SBASE>>(PTI_SHIFT-PTE_SHIFT)))
  2468. #define PDE_UTOP (PDE_UBASE|(((ULONG_PTR)1 << PDI_SHIFT) - 1)) // second level PDR address (user)
  2469. #define PDE_KTOP (PDE_KBASE|(((ULONG_PTR)1 << PDI_SHIFT) - 1)) // second level PDR address (kernel)
  2470. #define PDE_STOP (PDE_SBASE|(((ULONG_PTR)1 << PDI_SHIFT) - 1)) // second level PDR address (session)
  2471. //
  2472. // 8KB first level user and kernel PDR address
  2473. //
  2474. #define PDE_UTBASE (PTE_UBASE|(PDE_UBASE>>(PTI_SHIFT-PTE_SHIFT)))
  2475. #define PDE_KTBASE (PTE_KBASE|(PDE_KBASE>>(PTI_SHIFT-PTE_SHIFT)))
  2476. #define PDE_STBASE (PTE_SBASE|(PDE_SBASE>>(PTI_SHIFT-PTE_SHIFT)))
  2477. #define PDE_USELFMAP (PDE_UTBASE|(PAGE_SIZE - (1<<PTE_SHIFT))) // self mapped PPE address (user)
  2478. #define PDE_KSELFMAP (PDE_KTBASE|(PAGE_SIZE - (1<<PTE_SHIFT))) // self mapped PPE address (kernel)
  2479. #define PDE_SSELFMAP (PDE_STBASE|(PAGE_SIZE - (1<<PTE_SHIFT))) // self mapped PPE address (kernel)
  2480. #define PTE_BASE    PTE_UBASE
  2481. #define PDE_BASE    PDE_UBASE
  2482. #define PDE_TBASE   PDE_UTBASE
  2483. #define PDE_SELFMAP PDE_USELFMAP
  2484. #define KSEG3_BASE 0x8000000000000000UI64
  2485. #define KSEG3_LIMIT 0x8000100000000000UI64
  2486. //
  2487. //++
  2488. //PVOID
  2489. //KSEG_ADDRESS (
  2490. //    IN ULONG PAGE
  2491. //    );
  2492. //
  2493. // Routine Description:
  2494. //
  2495. //    This macro returns a KSEG virtual address which maps the page.
  2496. //
  2497. // Arguments:
  2498. //
  2499. //    PAGE - Supplies the physical page frame number
  2500. //
  2501. // Return Value:
  2502. //
  2503. //    The address of the KSEG address
  2504. //
  2505. //--
  2506. #define KSEG_ADDRESS(PAGE) ((PVOID)(KSEG3_BASE | ((ULONG_PTR)(PAGE) << PAGE_SHIFT)))
  2507. #define MAXIMUM_FWP_BUFFER_ENTRY 8
  2508. typedef struct _REGION_MAP_INFO {
  2509.     ULONG RegionId;
  2510.     ULONG PageSize;
  2511.     ULONGLONG SequenceNumber;
  2512. } REGION_MAP_INFO, *PREGION_MAP_INFO;
  2513. // begin_ntddk begin_wdm
  2514. //
  2515. // The lowest address for system space.
  2516. //
  2517. #define MM_LOWEST_SYSTEM_ADDRESS ((PVOID)((ULONG_PTR)(KADDRESS_BASE + 0xC0C00000)))
  2518. // end_nthal end_ntddk end_wdm
  2519. #define SYSTEM_BASE (KADDRESS_BASE + 0xC3000000)          // start of system space (no typecast)
  2520. //
  2521. // Define macro to initialize directory table base.
  2522. //
  2523. // Please contact INTEL to get IA64-specific information
  2524. // @@BEGIN_DDKSPLIT
  2525. #define INITIALIZE_DIRECTORY_TABLE_BASE(dirbase, pfn)  /* Intel-IA64-Filler */ 
  2526.     *((PULONGLONG)(dirbase)) = 0;                      /* Intel-IA64-Filler */ 
  2527.     ((PHARDWARE_PTE)(dirbase))->PageFrameNumber = pfn; /* Intel-IA64-Filler */ 
  2528.     ((PHARDWARE_PTE)(dirbase))->Accessed = 1;          /* Intel-IA64-Filler */ 
  2529.     ((PHARDWARE_PTE)(dirbase))->Dirty = 1;             /* Intel-IA64-Filler */ 
  2530.     ((PHARDWARE_PTE)(dirbase))->Cache = 0;             /* Intel-IA64-Filler */ 
  2531.     ((PHARDWARE_PTE)(dirbase))->Write = 1;             /* Intel-IA64-Filler */ 
  2532.     ((PHARDWARE_PTE)(dirbase))->Valid = 1;             // Intel-IA64-Filler
  2533. // @@END_DDKSPLIT
  2534. //
  2535. // IA64 function definitions
  2536. //
  2537. //++
  2538. //
  2539. // BOOLEAN
  2540. // KiIsThreadNumericStateSaved(
  2541. //     IN PKTHREAD Address
  2542. //     )
  2543. //
  2544. //  This call is used on a not running thread to see if it's numeric
  2545. //  state has been saved in it's context information.  On IA64 the
  2546. //  numeric state is always saved.
  2547. //
  2548. //--
  2549. #define KiIsThreadNumericStateSaved(a) TRUE
  2550. //++
  2551. //
  2552. // VOID
  2553. // KiRundownThread(
  2554. //     IN PKTHREAD Address
  2555. //     )
  2556. //
  2557. //--
  2558. #define KiRundownThread(a)
  2559. //
  2560. // Define macro to test if x86 feature is present.
  2561. //
  2562. // N.B. All x86 features test TRUE on IA64 systems.
  2563. //
  2564. #define Isx86FeaturePresent(_f_) TRUE
  2565. // begin_nthal begin_ntddk begin_ntndis begin_wdm
  2566. #endif // defined(_IA64_)
  2567. // end_nthal end_ntddk end_ntndis end_wdm
  2568. #endif // _IA64H_