Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1092 lines
26 KiB

  1. #include "kxalpha.h"
  2. //
  3. // Process State Enumerated Type Values
  4. //
  5. #define ProcessInMemory 0x0
  6. #define ProcessOutOfMemory 0x1
  7. #define ProcessInTransition 0x2
  8. //
  9. // Thread State Enumerated Type Values
  10. //
  11. #define Initialized 0x0
  12. #define Ready 0x1
  13. #define Running 0x2
  14. #define Standby 0x3
  15. #define Terminated 0x4
  16. #define Waiting 0x5
  17. //
  18. // Wait Reason Enumerated Type Values
  19. //
  20. #define WrEventPair 0xe
  21. //
  22. // Apc State Structure Offset Definitions
  23. //
  24. #define AsApcListHead 0x0
  25. #define AsProcess 0x10
  26. #define AsKernelApcInProgress 0x14
  27. #define AsKernelApcPending 0x15
  28. #define AsUserApcPending 0x16
  29. //
  30. // Critical Section Structure Offset Definitions
  31. //
  32. #define CsLockCount 0x4
  33. #define CsRecursionCount 0x8
  34. #define CsOwningThread 0xc
  35. //
  36. // Dispatcher Context Structure Offset Definitions
  37. //
  38. #define DcControlPc 0x0
  39. #define DcFunctionEntry 0x4
  40. #define DcEstablisherFrame 0x8
  41. #define DcContextRecord 0xc
  42. //
  43. // Exception Record Offset, Flag, and Enumerated Type Definitions
  44. //
  45. #define EXCEPTION_NONCONTINUABLE 0x1
  46. #define EXCEPTION_UNWINDING 0x2
  47. #define EXCEPTION_EXIT_UNWIND 0x4
  48. #define EXCEPTION_STACK_INVALID 0x8
  49. #define EXCEPTION_NESTED_CALL 0x10
  50. #define EXCEPTION_TARGET_UNWIND 0x20
  51. #define EXCEPTION_COLLIDED_UNWIND 0x40
  52. #define EXCEPTION_UNWIND 0x66
  53. #define ExceptionContinueExecution 0x0
  54. #define ExceptionContinueSearch 0x1
  55. #define ExceptionNestedException 0x2
  56. #define ExceptionCollidedUnwind 0x3
  57. #define ErExceptionCode 0x0
  58. #define ErExceptionFlags 0x4
  59. #define ErExceptionRecord 0x8
  60. #define ErExceptionAddress 0xc
  61. #define ErNumberParameters 0x10
  62. #define ErExceptionInformation 0x14
  63. #define ExceptionRecordLength 0x50
  64. //
  65. // Fast Mutex Structure Offset Definitions
  66. //
  67. #define FmCount 0x0
  68. #define FmOwner 0x4
  69. #define FmContention 0x8
  70. #define FmEvent 0xc
  71. #define FmOldIrql 0x1c
  72. //
  73. // Large Integer Structure Offset Definitions
  74. //
  75. #define LiLowPart 0x0
  76. #define LiHighPart 0x4
  77. //
  78. // List Entry Structure Offset Definitions
  79. //
  80. #define LsFlink 0x0
  81. #define LsBlink 0x4
  82. //
  83. // String Structure Offset Definitions
  84. //
  85. #define StrLength 0x0
  86. #define StrMaximumLength 0x2
  87. #define StrBuffer 0x4
  88. //
  89. // Processor Control Registers Structure Offset Definitions
  90. //
  91. #define PCR_MINOR_VERSION 0x1
  92. #define PCR_MAJOR_VERSION 0x1
  93. #define PcMinorVersion 0x0
  94. #define PcMajorVersion 0x4
  95. #define PcPalBaseAddress 0x8
  96. #define PcPalMajorVersion 0x10
  97. #define PcPalMinorVersion 0x14
  98. #define PcPalSequenceVersion 0x18
  99. #define PcPalMajorSpecification 0x1c
  100. #define PcPalMinorSpecification 0x20
  101. #define PcFirmwareRestartAddress 0x28
  102. #define PcRestartBlock 0x30
  103. #define PcPalReserved 0x38
  104. #define PcPanicStack 0xc38
  105. #define PcProcessorType 0xc3c
  106. #define PcProcessorRevision 0xc40
  107. #define PcPhysicalAddressBits 0xc44
  108. #define PcMaximumAddressSpaceNumber 0xc48
  109. #define PcPageSize 0xc4c
  110. #define PcFirstLevelDcacheSize 0xc50
  111. #define PcFirstLevelDcacheFillSize 0xc54
  112. #define PcFirstLevelIcacheSize 0xc58
  113. #define PcFirstLevelIcacheFillSize 0xc5c
  114. #define PcFirmwareRevisionId 0xc60
  115. #define PcSystemType 0xc64
  116. #define PcSystemVariant 0xc6c
  117. #define PcSystemRevision 0xc70
  118. #define PcSystemSerialNumber 0xc74
  119. #define PcCycleClockPeriod 0xc84
  120. #define PcSecondLevelCacheSize 0xc88
  121. #define PcSecondLevelCacheFillSize 0xc8c
  122. #define PcThirdLevelCacheSize 0xc90
  123. #define PcThirdLevelCacheFillSize 0xc94
  124. #define PcFourthLevelCacheSize 0xc98
  125. #define PcFourthLevelCacheFillSize 0xc9c
  126. #define PcPrcb 0xca0
  127. #define PcNumber 0xca4
  128. #define PcSetMember 0xca8
  129. #define PcHalReserved 0xcb0
  130. #define PcIrqlTable 0xeb0
  131. #define PcIrqlMask 0xed0
  132. #define PcInterruptRoutine 0x10e0
  133. #define PcReservedVectors 0x14e0
  134. #define PcMachineCheckError 0x14f0
  135. #define PcDpcStack 0x14f4
  136. #define PcNotMember 0x14e4
  137. #define PcCurrentPid 0x14fc
  138. #define PcSystemServiceDispatchStart 0x1504
  139. #define PcSystemServiceDispatchEnd 0x1508
  140. #define PcIdleThread 0x150c
  141. #define ProcessorControlRegisterLength 0x1510
  142. #define SharedUserData 0xff000000
  143. #define UsTickCountLow 0x0
  144. #define UsTickCountMultiplier 0x4
  145. #define UsInterruptTime 0x8
  146. #define UsSystemTime 0x10
  147. //
  148. // Processor Block Structure Offset Definitions
  149. //
  150. #define PRCB_MINOR_VERSION 0x1
  151. #define PRCB_MAJOR_VERSION 0x2
  152. #define PbMinorVersion 0x0
  153. #define PbMajorVersion 0x2
  154. #define PbCurrentThread 0x4
  155. #define PbNextThread 0x8
  156. #define PbIdleThread 0xc
  157. #define PbNumber 0x10
  158. #define PbBuildType 0x12
  159. #define PbSetMember 0x14
  160. #define PbRestartBlock 0x18
  161. #define PbInterruptCount 0x1c
  162. #define PbDpcTime 0x20
  163. #define PbInterruptTime 0x24
  164. #define PbKernelTime 0x28
  165. #define PbUserTime 0x2c
  166. #define PbQuantumEndDpc 0x30
  167. #define PbIpiFrozen 0x5c
  168. #define PbIpiCounts 0x310
  169. #define PbProcessorState 0x60
  170. #define PbAlignmentFixupCount 0x334
  171. #define PbContextSwitches 0x338
  172. #define PbDcacheFlushCount 0x33c
  173. #define PbExceptionDispatchcount 0x340
  174. #define PbFirstLevelTbFills 0x344
  175. #define PbFloatingEmulationCount 0x348
  176. #define PbIcacheFlushCount 0x34c
  177. #define PbSecondLevelTbFills 0x350
  178. #define PbSystemCalls 0x354
  179. #define PbCurrentPacket 0x380
  180. #define PbTargetSet 0x38c
  181. #define PbWorkerRoutine 0x390
  182. #define PbRequestSummary 0x3c0
  183. #define PbSignalDone 0x3c4
  184. #define PbDpcListHead 0x468
  185. #define PbDpcLock 0x470
  186. #define PbDpcCount 0x474
  187. #define PbLastDpcCount 0x290
  188. #define PbQuantumEnd 0x478
  189. #define PbStartCount 0x460
  190. #define PbSoftwareInterrupts 0x298
  191. #define PbInterruptActive 0x29c
  192. #define PbDpcRoutineActive 0x47c
  193. #define PbDpcQueueDepth 0x480
  194. #define PbDpcRequestRate 0x45c
  195. #define PbDpcBypassCount 0x294
  196. #define PbApcBypassCount 0x2a0
  197. #define PbDispatchInterruptCount 0x2a4
  198. #define PbDpcInterruptRequested 0x400
  199. #define PbMaximumDpcQueueDepth 0x450
  200. #define PbMinimumDpcRate 0x454
  201. #define PbAdjustDpcThreshold 0x458
  202. #define ProcessorBlockLength 0x490
  203. //
  204. // Immediate Interprocessor Command Definitions
  205. //
  206. #define IPI_APC 0x1
  207. #define IPI_DPC 0x2
  208. #define IPI_FREEZE 0x4
  209. #define IPI_PACKET_READY 0x8
  210. //
  211. // Interprocessor Interrupt Count Structure Offset Definitions
  212. //
  213. #define IcFreeze 0x0
  214. #define IcPacket 0x4
  215. #define IcDPC 0x8
  216. #define IcAPC 0xc
  217. #define IcFlushSingleTb 0x10
  218. #define IcFlushEntireTb 0x18
  219. #define IcChangeColor 0x20
  220. #define IcSweepDcache 0x24
  221. #define IcSweepIcache 0x28
  222. #define IcSweepIcacheRange 0x2c
  223. #define IcFlushIoBuffers 0x30
  224. //
  225. // Thread Environment Block Structure Offset Definitions
  226. //
  227. #define TeStackBase 0x4
  228. #define TeStackLimit 0x8
  229. #define TeEnvironmentPointer 0x1c
  230. #define TeClientId 0x20
  231. #define TeActiveRpcHandle 0x28
  232. #define TeThreadLocalStoragePointer 0x2c
  233. #define TePeb 0x30
  234. #define TeSoftFpcr 0xc8
  235. #define TeCsrQlpcStack 0x44
  236. #define TeGdiClientPID 0x6f4
  237. #define TeGdiClientTID 0x6f8
  238. #define TeGdiThreadLocalInfo 0x6fc
  239. #define TeglDispatchTable 0x714
  240. #define TeglSectionInfo 0xbe0
  241. #define TeglSection 0xbe4
  242. #define TeglTable 0xbe8
  243. #define TeglCurrentRC 0xbec
  244. #define TeglContext 0xbf0
  245. #define PebKernelCallbackTable 0x2c
  246. //
  247. // Time Structure Offset Definitions
  248. //
  249. #define TmLowTime 0x0
  250. #define TmHighTime 0x4
  251. //
  252. // APC object Structure Offset Definitions
  253. //
  254. #define ApType 0x0
  255. #define ApSize 0x2
  256. #define ApThread 0x8
  257. #define ApApcListEntry 0xc
  258. #define ApKernelRoutine 0x14
  259. #define ApRundownRoutine 0x18
  260. #define ApNormalRoutine 0x1c
  261. #define ApNormalContext 0x20
  262. #define ApSystemArgument1 0x24
  263. #define ApSystemArgument2 0x28
  264. #define ApApcStateIndex 0x2c
  265. #define ApApcMode 0x2d
  266. #define ApInserted 0x2e
  267. //
  268. // DPC object Structure Offset Definitions
  269. //
  270. #define DpType 0x0
  271. #define DpDpcListEntry 0x4
  272. #define DpDeferredRoutine 0xc
  273. #define DpDeferredContext 0x10
  274. #define DpSystemArgument1 0x14
  275. #define DpSystemArgument2 0x18
  276. #define DpLock 0x1c
  277. //
  278. // Device object Structure Offset Definitions
  279. //
  280. #define DvType 0x0
  281. #define DvSize 0x2
  282. #define DvDeviceListHead 0x4
  283. #define DvSpinLock 0xc
  284. #define DvBusy 0x10
  285. //
  286. // Device queue entry Structure Offset Definitions
  287. //
  288. #define DeDeviceListEntry 0x0
  289. #define DeSortKey 0x8
  290. #define DeInserted 0xc
  291. //
  292. // Event Structure Offset Definitions
  293. //
  294. #define EvType 0x0
  295. #define EvSize 0x2
  296. #define EvSignalState 0x4
  297. #define EvWaitListHead 0x8
  298. //
  299. // Event Pair Structure Offset Definitions
  300. //
  301. #define EpType 0x0
  302. #define EpSize 0x2
  303. #define EpEventLow 0x4
  304. #define EpEventHigh 0x14
  305. //
  306. // Interrupt Object Structure Offset Definitions
  307. //
  308. #define InType 0x0
  309. #define InSize 0x2
  310. #define InInterruptListEntry 0x4
  311. #define InServiceRoutine 0xc
  312. #define InServiceContext 0x10
  313. #define InSpinLock 0x14
  314. #define InActualLock 0x18
  315. #define InDispatchAddress 0x1c
  316. #define InVector 0x20
  317. #define InIrql 0x24
  318. #define InSynchronizeIrql 0x25
  319. #define InMode 0x2c
  320. #define InNumber 0x28
  321. #define InFloatingSave 0x26
  322. #define InConnected 0x27
  323. #define InDispatchCode 0x34
  324. #define InLevelSensitive 0x0
  325. #define InLatched 0x1
  326. //
  327. // Process Object Structure Offset Definitions
  328. //
  329. #define PrProfileListHead 0x10
  330. #define PrReadyListHead 0x2c
  331. #define PrSwapListEntry 0x34
  332. #define PrThreadListHead 0x3c
  333. #define PrKernelTime 0x24
  334. #define PrUserTime 0x28
  335. #define PrDirectoryTableBase 0x18
  336. #define PrActiveProcessors 0x20
  337. #define PrAffinity 0x48
  338. #define PrStackCount 0x4c
  339. #define PrAutoAlignment 0x50
  340. #define PrBasePriority 0x4e
  341. #define PrState 0x51
  342. #define PrThreadQuantum 0x4f
  343. #define ProcessObjectLength 0x60
  344. //
  345. // Queue Object Structure Offset Definitions
  346. //
  347. #define QuEntryListHead 0x10
  348. #define QuThreadListHead 0x10
  349. #define QuCurrentCount 0x18
  350. #define QuMaximumCount 0x1c
  351. //
  352. // Profile Object Structure Offset Definitions
  353. //
  354. #define PfType 0x0
  355. #define PfSize 0x2
  356. #define PfProfileListEntry 0x4
  357. #define PfProcess 0xc
  358. #define PfRangeBase 0x10
  359. #define PfRangeLimit 0x14
  360. #define PfBucketShift 0x18
  361. #define PfBuffer 0x1c
  362. #define PfStarted 0x2a
  363. #define PfSource 0x28
  364. #define PfAffinity 0x24
  365. //
  366. // Thread Object Structure Offset Definitions
  367. //
  368. #define EeKernelEventPair 0x0
  369. #define EtEventPair 0x224
  370. #define EtPerformanceCountLow 0x204
  371. #define EtPerformanceCountHigh 0x23c
  372. #define EtEthreadLength 0x240
  373. #define ThMutantListHead 0x10
  374. #define ThInitialStack 0x18
  375. #define ThStackLimit 0x1c
  376. #define ThKernelStack 0x20
  377. #define ThTeb 0x24
  378. #define ThDebugActive 0x28
  379. #define ThState 0x29
  380. #define ThAlerted 0x2a
  381. #define ThApcState 0x30
  382. #define ThContextSwitches 0x48
  383. #define ThWaitStatus 0x4c
  384. #define ThWaitIrql 0x50
  385. #define ThWaitMode 0x51
  386. #define ThWaitNext 0x52
  387. #define ThWaitReason 0x53
  388. #define ThWaitBlockList 0x54
  389. #define ThWaitListEntry 0x58
  390. #define ThWaitTime 0x60
  391. #define ThBasePriority 0x64
  392. #define ThDecrementCount 0x65
  393. #define ThPriorityDecrement 0x66
  394. #define ThQuantum 0x67
  395. #define ThWaitBlock 0x68
  396. #define ThQueue 0xe0
  397. #define ThTimer 0xe8
  398. #define ThQueueListEntry 0x110
  399. #define ThAffinity 0x118
  400. #define ThPreempted 0x11c
  401. #define ThProcessReadyQueue 0x11d
  402. #define ThKernelStackResident 0x11e
  403. #define ThNextProcessor 0x11f
  404. #define ThCallbackStack 0x120
  405. #define ThWin32Thread 0x124
  406. #define ThTrapFrame 0x128
  407. #define ThApcStatePointer 0x12c
  408. #define ThKernelApcDisable 0x134
  409. #define ThLargeStack 0x135
  410. #define ThPriority 0x2f
  411. #define ThPreviousMode 0x137
  412. #define ThKernelTime 0x138
  413. #define ThUserTime 0x13c
  414. #define ThSavedApcState 0x140
  415. #define ThAlertable 0x158
  416. #define ThApcStateIndex 0x159
  417. #define ThApcQueueable 0x15a
  418. #define ThAutoAlignment 0x15b
  419. #define ThStackBase 0x15c
  420. #define ThSuspendApc 0x160
  421. #define ThSuspendSemaphore 0x190
  422. #define ThThreadListEntry 0x1a4
  423. #define ThFreezeCount 0x1ac
  424. #define ThSuspendCount 0x1ad
  425. #define ThreadObjectLength 0x1b0
  426. #define EVENT_WAIT_BLOCK_OFFSET 0xb0
  427. //
  428. // Timer object Structure Offset Definitions
  429. //
  430. #define TiDueTime 0x10
  431. #define TiTimerListEntry 0x18
  432. #define TiDpc 0x20
  433. #define TiInserted 0x24
  434. #define TIMER_TABLE_SIZE 0x80
  435. //
  436. // Wait Block Structure Offset Definitions
  437. //
  438. #define WbWaitListEntry 0x0
  439. #define WbThread 0x8
  440. #define WbObject 0xc
  441. #define WbNextWaitBlock 0x10
  442. #define WbWaitKey 0x14
  443. #define WbWaitType 0x16
  444. //
  445. // Context Frame Offset and Flag Definitions
  446. //
  447. #define CONTEXT_FULL 0x20007
  448. #define CONTEXT_CONTROL 0x20001
  449. #define CONTEXT_FLOATING_POINT 0x20002
  450. #define CONTEXT_INTEGER 0x20004
  451. #define CxFltF0 0x0
  452. #define CxFltF1 0x8
  453. #define CxFltF2 0x10
  454. #define CxFltF3 0x18
  455. #define CxFltF4 0x20
  456. #define CxFltF5 0x28
  457. #define CxFltF6 0x30
  458. #define CxFltF7 0x38
  459. #define CxFltF8 0x40
  460. #define CxFltF9 0x48
  461. #define CxFltF10 0x50
  462. #define CxFltF11 0x58
  463. #define CxFltF12 0x60
  464. #define CxFltF13 0x68
  465. #define CxFltF14 0x70
  466. #define CxFltF15 0x78
  467. #define CxFltF16 0x80
  468. #define CxFltF17 0x88
  469. #define CxFltF18 0x90
  470. #define CxFltF19 0x98
  471. #define CxFltF20 0xa0
  472. #define CxFltF21 0xa8
  473. #define CxFltF22 0xb0
  474. #define CxFltF23 0xb8
  475. #define CxFltF24 0xc0
  476. #define CxFltF25 0xc8
  477. #define CxFltF26 0xd0
  478. #define CxFltF27 0xd8
  479. #define CxFltF28 0xe0
  480. #define CxFltF29 0xe8
  481. #define CxFltF30 0xf0
  482. #define CxFltF31 0xf8
  483. #define CxIntV0 0x100
  484. #define CxIntT0 0x108
  485. #define CxIntT1 0x110
  486. #define CxIntT2 0x118
  487. #define CxIntT3 0x120
  488. #define CxIntT4 0x128
  489. #define CxIntT5 0x130
  490. #define CxIntT6 0x138
  491. #define CxIntT7 0x140
  492. #define CxIntS0 0x148
  493. #define CxIntS1 0x150
  494. #define CxIntS2 0x158
  495. #define CxIntS3 0x160
  496. #define CxIntS4 0x168
  497. #define CxIntS5 0x170
  498. #define CxIntFp 0x178
  499. #define CxIntA0 0x180
  500. #define CxIntA1 0x188
  501. #define CxIntA2 0x190
  502. #define CxIntA3 0x198
  503. #define CxIntA4 0x1a0
  504. #define CxIntA5 0x1a8
  505. #define CxIntT8 0x1b0
  506. #define CxIntT9 0x1b8
  507. #define CxIntT10 0x1c0
  508. #define CxIntT11 0x1c8
  509. #define CxIntRa 0x1d0
  510. #define CxIntT12 0x1d8
  511. #define CxIntAt 0x1e0
  512. #define CxIntGp 0x1e8
  513. #define CxIntSp 0x1f0
  514. #define CxIntZero 0x1f8
  515. #define CxFpcr 0x200
  516. #define CxSoftFpcr 0x208
  517. #define CxFir 0x210
  518. #define CxPsr 0x218
  519. #define CxContextFlags 0x21c
  520. #define ContextFrameLength 0x230
  521. //
  522. // Exception Frame Offset Definitions and Length
  523. //
  524. #define ExFltF2 0x8
  525. #define ExFltF3 0x10
  526. #define ExFltF4 0x18
  527. #define ExFltF5 0x20
  528. #define ExFltF6 0x28
  529. #define ExFltF7 0x30
  530. #define ExFltF8 0x38
  531. #define ExFltF9 0x40
  532. #define ExIntS0 0x48
  533. #define ExIntS1 0x50
  534. #define ExIntS2 0x58
  535. #define ExIntS3 0x60
  536. #define ExIntS4 0x68
  537. #define ExIntS5 0x70
  538. #define ExIntFp 0x78
  539. #define ExPsr 0x88
  540. #define ExSwapReturn 0x80
  541. #define ExIntRa 0x0
  542. #define ExceptionFrameLength 0xa0
  543. //
  544. // Jump Offset Definitions and Length
  545. //
  546. #define JbFp 0x0
  547. #define JbPc 0x4
  548. #define JbSeb 0x8
  549. #define JbType 0xc
  550. #define JbFltF2 0x10
  551. #define JbFltF3 0x18
  552. #define JbFltF4 0x20
  553. #define JbFltF5 0x28
  554. #define JbFltF6 0x30
  555. #define JbFltF7 0x38
  556. #define JbFltF8 0x40
  557. #define JbFltF9 0x48
  558. #define JbIntS0 0x50
  559. #define JbIntS1 0x58
  560. #define JbIntS2 0x60
  561. #define JbIntS3 0x68
  562. #define JbIntS4 0x70
  563. #define JbIntS5 0x78
  564. #define JbIntS6 0x80
  565. #define JbIntSp 0x88
  566. #define JbFir 0x90
  567. //
  568. // Trap Frame Offset Definitions and Length
  569. //
  570. #define TrFltF0 0x128
  571. #define TrFltF1 0x138
  572. #define TrFltF10 0x140
  573. #define TrFltF11 0x148
  574. #define TrFltF12 0x150
  575. #define TrFltF13 0x158
  576. #define TrFltF14 0x160
  577. #define TrFltF15 0x168
  578. #define TrFltF16 0x170
  579. #define TrFltF17 0x178
  580. #define TrFltF18 0x180
  581. #define TrFltF19 0x188
  582. #define TrFltF20 0x190
  583. #define TrFltF21 0x198
  584. #define TrFltF22 0x1a0
  585. #define TrFltF23 0x1a8
  586. #define TrFltF24 0x1b0
  587. #define TrFltF25 0x1b8
  588. #define TrFltF26 0x1c0
  589. #define TrFltF27 0x1c8
  590. #define TrFltF28 0x1d0
  591. #define TrFltF29 0x1d8
  592. #define TrFltF30 0x1e0
  593. #define TrIntV0 0xa0
  594. #define TrIntT0 0xa8
  595. #define TrIntT1 0xb0
  596. #define TrIntT2 0xb8
  597. #define TrIntT3 0xc0
  598. #define TrIntT4 0xc8
  599. #define TrIntT5 0xd0
  600. #define TrIntT6 0xd8
  601. #define TrIntT7 0xe0
  602. #define TrIntFp 0x18
  603. #define TrIntA0 0x20
  604. #define TrIntA1 0x28
  605. #define TrIntA2 0x30
  606. #define TrIntA3 0x38
  607. #define TrIntA4 0x118
  608. #define TrIntA5 0x120
  609. #define TrIntT8 0xe8
  610. #define TrIntT9 0xf0
  611. #define TrIntT10 0xf8
  612. #define TrIntT11 0x100
  613. #define TrIntT12 0x108
  614. #define TrIntAt 0x110
  615. #define TrIntGp 0x48
  616. #define TrIntSp 0x0
  617. #define TrFpcr 0x130
  618. #define TrPsr 0x10
  619. #define TrPreviousKsp 0x14
  620. #define TrFir 0x8
  621. #define TrExceptionRecord 0x50
  622. #define TrOldIrql 0x1e8
  623. #define TrPreviousMode 0x1ec
  624. #define TrIntRa 0x40
  625. #define TrTrapFrame 0x1f0
  626. #define TrapFrameLength 0x200
  627. //
  628. // Loader Parameter Block Offset Definitions
  629. //
  630. #define LpbLoadOrderListHead 0x0
  631. #define LpbMemoryDescriptorListHead 0x8
  632. #define LpbKernelStack 0x18
  633. #define LpbPrcb 0x1c
  634. #define LpbProcess 0x20
  635. #define LpbThread 0x24
  636. #define LpbRegistryLength 0x28
  637. #define LpbRegistryBase 0x2c
  638. #define LpbDpcStack 0x60
  639. #define LpbFirstLevelDcacheSize 0x64
  640. #define LpbFirstLevelDcacheFillSize 0x68
  641. #define LpbFirstLevelIcacheSize 0x6c
  642. #define LpbFirstLevelIcacheFillSize 0x70
  643. #define LpbGpBase 0x74
  644. #define LpbPanicStack 0x78
  645. #define LpbPcrPage 0x7c
  646. #define LpbPdrPage 0x80
  647. #define LpbSecondLevelDcacheSize 0x84
  648. #define LpbSecondLevelDcacheFillSize 0x88
  649. #define LpbSecondLevelIcacheSize 0x8c
  650. #define LpbSecondLevelIcacheFillSize 0x90
  651. #define LpbPhysicalAddressBits 0x94
  652. #define LpbMaximumAddressSpaceNumber 0x98
  653. #define LpbSystemSerialNumber 0x9c
  654. #define LpbSystemType 0xac
  655. #define LpbSystemVariant 0xb4
  656. #define LpbSystemRevision 0xb8
  657. #define LpbProcessorType 0xbc
  658. #define LpbProcessorRevision 0xc0
  659. #define LpbCycleClockPeriod 0xc4
  660. #define LpbPageSize 0xc8
  661. #define LpbRestartBlock 0xcc
  662. #define LpbFirmwareRestartAddress 0xd0
  663. #define LpbFirmwareRevisionId 0xd8
  664. #define LpbPalBaseAddress 0xdc
  665. //
  666. // Client/Server data structure definitions.
  667. //
  668. #define CidUniqueProcess 0x0
  669. #define CidUniqueThread 0x4
  670. #define CsrlClientThread 0x0
  671. #define CsrlMessageStack 0xc
  672. //
  673. // System Service Descriptor Table structure definitions.
  674. //
  675. #define NUMBER_SERVICE_TABLES 0x2
  676. #define SERVICE_NUMBER_MASK 0xfff
  677. #define SERVICE_TABLE_SHIFT 0x8
  678. #define SERVICE_TABLE_MASK 0x10
  679. #define SdBase 0x0
  680. #define SdCount 0x4
  681. #define SdLimit 0x8
  682. #define SdNumber 0xc
  683. //
  684. // Restart Block Structure Definitions
  685. //
  686. #define RbSignature 0x0
  687. #define RbLength 0x4
  688. #define RbVersion 0x8
  689. #define RbRevision 0xa
  690. #define RbNextRestartBlock 0xc
  691. #define RbRestartAddress 0x10
  692. #define RbBootMasterId 0x14
  693. #define RbProcessorId 0x18
  694. #define RbBootStatus 0x1c
  695. #define RbCheckSum 0x20
  696. #define RbSaveAreaLength 0x24
  697. #define RbSaveArea 0x28
  698. #define RbHaltReason 0x28
  699. #define RbLogoutFrame 0x2c
  700. #define RbPalBase 0x30
  701. #define RbIntV0 0x38
  702. #define RbIntT0 0x40
  703. #define RbIntT1 0x48
  704. #define RbIntT2 0x50
  705. #define RbIntT3 0x58
  706. #define RbIntT4 0x60
  707. #define RbIntT5 0x68
  708. #define RbIntT6 0x70
  709. #define RbIntT7 0x78
  710. #define RbIntS0 0x80
  711. #define RbIntS1 0x88
  712. #define RbIntS2 0x90
  713. #define RbIntS3 0x98
  714. #define RbIntS4 0xa0
  715. #define RbIntS5 0xa8
  716. #define RbIntFp 0xb0
  717. #define RbIntA0 0xb8
  718. #define RbIntA1 0xc0
  719. #define RbIntA2 0xc8
  720. #define RbIntA3 0xd0
  721. #define RbIntA4 0xd8
  722. #define RbIntA5 0xe0
  723. #define RbIntT8 0xe8
  724. #define RbIntT9 0xf0
  725. #define RbIntT10 0xf8
  726. #define RbIntT11 0x100
  727. #define RbIntRa 0x108
  728. #define RbIntT12 0x110
  729. #define RbIntAT 0x118
  730. #define RbIntGp 0x120
  731. #define RbIntSp 0x128
  732. #define RbIntZero 0x130
  733. #define RbFpcr 0x138
  734. #define RbFltF0 0x140
  735. #define RbFltF1 0x148
  736. #define RbFltF2 0x150
  737. #define RbFltF3 0x158
  738. #define RbFltF4 0x160
  739. #define RbFltF5 0x168
  740. #define RbFltF6 0x170
  741. #define RbFltF7 0x178
  742. #define RbFltF8 0x180
  743. #define RbFltF9 0x188
  744. #define RbFltF10 0x190
  745. #define RbFltF11 0x198
  746. #define RbFltF12 0x1a0
  747. #define RbFltF13 0x1a8
  748. #define RbFltF14 0x1b0
  749. #define RbFltF15 0x1b8
  750. #define RbFltF16 0x1c0
  751. #define RbFltF17 0x1c8
  752. #define RbFltF18 0x1d0
  753. #define RbFltF19 0x1d8
  754. #define RbFltF20 0x1e0
  755. #define RbFltF21 0x1e8
  756. #define RbFltF22 0x1f0
  757. #define RbFltF23 0x1f8
  758. #define RbFltF24 0x200
  759. #define RbFltF25 0x208
  760. #define RbFltF26 0x210
  761. #define RbFltF27 0x218
  762. #define RbFltF28 0x220
  763. #define RbFltF29 0x228
  764. #define RbFltF30 0x230
  765. #define RbFltF31 0x238
  766. #define RbAsn 0x240
  767. #define RbGeneralEntry 0x244
  768. #define RbIksp 0x248
  769. #define RbInterruptEntry 0x24c
  770. #define RbKgp 0x250
  771. #define RbMces 0x254
  772. #define RbMemMgmtEntry 0x258
  773. #define RbPanicEntry 0x25c
  774. #define RbPcr 0x260
  775. #define RbPdr 0x264
  776. #define RbPsr 0x268
  777. #define RbReiRestartAddress 0x26c
  778. #define RbSirr 0x270
  779. #define RbSyscallEntry 0x274
  780. #define RbTeb 0x278
  781. #define RbThread 0x27c
  782. #define RbPerProcessorState 0x280
  783. //
  784. // Address Space Layout Definitions
  785. //
  786. #define KSEG0_BASE 0x80000000
  787. #define KSEG2_BASE 0xc0000000
  788. #define SYSTEM_BASE 0xc0800000
  789. #define PDE_BASE 0xc0180000
  790. #define PTE_BASE 0xc0000000
  791. //
  792. // Page Table and Directory Entry Definitions
  793. //
  794. #define PAGE_SIZE 0x2000
  795. #define PAGE_SHIFT 0xd
  796. #define PDI_SHIFT 0x18
  797. #define PTI_SHIFT 0xd
  798. //
  799. // Interrupt Priority Request Level Definitions
  800. //
  801. #define APC_LEVEL 0x1
  802. #define DISPATCH_LEVEL 0x2
  803. #define IPI_LEVEL 0x6
  804. #define POWER_LEVEL 0x7
  805. #define HIGH_LEVEL 0x7
  806. //
  807. // Bug Check Code Definitions
  808. //
  809. #define DATA_BUS_ERROR 0x2e
  810. #define INSTRUCTION_BUS_ERROR 0x2f
  811. #define INTERRUPT_EXCEPTION_NOT_HANDLED 0x3d
  812. #define INTERRUPT_UNWIND_ATTEMPTED 0x3c
  813. #define INVALID_DATA_ACCESS_TRAP 0x4
  814. #define IRQL_NOT_LESS_OR_EQUAL 0xa
  815. #define NO_USER_MODE_CONTEXT 0xe
  816. #define PANIC_STACK_SWITCH 0x2b
  817. #define SYSTEM_EXIT_OWNED_MUTEX 0x39
  818. #define SYSTEM_SERVICE_EXCEPTION 0x3b
  819. #define SYSTEM_UNWIND_PREVIOUS_USER 0x3a
  820. #define TRAP_CAUSE_UNKNOWN 0x12
  821. //
  822. // Breakpoint Definitions
  823. //
  824. #define USER_BREAKPOINT 0x0
  825. #define KERNEL_BREAKPOINT 0x1
  826. #define BREAKIN_BREAKPOINT 0x19
  827. #define DEBUG_PRINT_BREAKPOINT 0x14
  828. #define DEBUG_PROMPT_BREAKPOINT 0x15
  829. #define DEBUG_STOP_BREAKPOINT 0x16
  830. #define DEBUG_LOAD_SYMBOLS_BREAKPOINT 0x17
  831. #define DEBUG_UNLOAD_SYMBOLS_BREAKPOINT 0x18
  832. //
  833. // Trap Code Definitions
  834. //
  835. #define GENTRAP_INTEGER_OVERFLOW 0xffffffff
  836. #define GENTRAP_INTEGER_DIVIDE_BY_ZERO 0xfffffffe
  837. #define GENTRAP_FLOATING_OVERFLOW 0xfffffffd
  838. #define GENTRAP_FLOATING_DIVIDE_BY_ZERO 0xfffffffc
  839. #define GENTRAP_FLOATING_UNDERFLOW 0xfffffffb
  840. #define GENTRAP_FLOATING_INVALID_OPERAND 0xfffffffa
  841. #define GENTRAP_FLOATING_INEXACT_RESULT 0xfffffff9
  842. //
  843. // Status Code Definitions
  844. //
  845. #define STATUS_SUCCESS 0x0
  846. #define STATUS_ALPHA_MACHINE_CHECK 0xdfff002e
  847. #define STATUS_ACCESS_VIOLATION 0xc0000005
  848. #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
  849. #define STATUS_STACK_OVERFLOW 0xc00000fd
  850. #define STATUS_IN_PAGE_ERROR 0xc0000006
  851. #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
  852. #define STATUS_INVALID_OWNER 0xc000005a
  853. #define STATUS_INVALID_SYSTEM_SERVICE 0xc000001c
  854. #define STATUS_ILLEGAL_INSTRUCTION 0xc000001d
  855. #define STATUS_KERNEL_APC 0x100
  856. #define STATUS_BREAKPOINT 0x80000003
  857. #define STATUS_SINGLE_STEP 0x80000004
  858. #define STATUS_INTEGER_OVERFLOW 0xc0000095
  859. #define STATUS_INVALID_LOCK_SEQUENCE 0xc000001e
  860. #define STATUS_INSTRUCTION_MISALIGNMENT 0xc00000aa
  861. #define STATUS_FLOAT_STACK_CHECK 0xc0000092
  862. #define STATUS_NO_EVENT_PAIR 0xc000014e
  863. #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xc0000094
  864. #define STATUS_INVALID_PARAMETER_1 0xc00000ef
  865. #define STATUS_UNWIND 0xc0000027
  866. #define STATUS_ALPHA_FLOATING_NOT_IMPLEMENTED 0xc000014a
  867. #define STATUS_ALPHA_ARITHMETIC_EXCEPTION 0xc0000092
  868. #define STATUS_ALPHA_GENTRAP 0xc00000aa
  869. #define STATUS_ALPHA_BAD_VIRTUAL_ADDRESS 0xc0000005
  870. #define STATUS_NO_CALLBACK_ACTIVE 0xc0000258
  871. #define STATUS_BAD_COMPRESSION_BUFFER 0xc0000242
  872. //
  873. // Miscellaneous Definitions
  874. //
  875. #define Executive 0x0
  876. #define KernelMode 0x0
  877. #define FALSE 0x0
  878. #define TRUE 0x1
  879. #define BASE_PRIORITY_THRESHOLD 0x8
  880. #define EVENT_PAIR_INCREMENT 0x1
  881. #define LOW_REALTIME_PRIORITY 0x10
  882. #define MM_USER_PROBE_ADDRESS 0x7fff0000
  883. #define KERNEL_STACK_SIZE 0x4000
  884. #define KERNEL_LARGE_STACK_COMMIT 0x4000
  885. #define SET_LOW_WAIT_HIGH 0xfffffffe
  886. #define SET_HIGH_WAIT_LOW 0xffffffff
  887. #define THREAD_QUANTUM 0x2
  888. #define PROCESSOR_ALPHA_21064 0x5248
  889. #define PROCESSOR_ALPHA_21164 0x52ac
  890. #define PROCESSOR_ALPHA_21066 0x524a
  891. #define PROCESSOR_ALPHA_21068 0x524c
  892. #define PTE_VALID_MASK 0x1
  893. #define PTE_VALID 0x0
  894. #define PTE_OWNER_MASK 0x2
  895. #define PTE_OWNER 0x1
  896. #define PTE_DIRTY_MASK 0x4
  897. #define PTE_DIRTY 0x2
  898. #define PTE_GLOBAL_MASK 0x10
  899. #define PTE_GLOBAL 0x4
  900. #define PTE_WRITE_MASK 0x80
  901. #define PTE_WRITE 0x7
  902. #define PTE_COPYONWRITE_MASK 0x100
  903. #define PTE_COPYONWRITE 0x8
  904. #define PTE_PFN_MASK 0xfffffe00
  905. #define PTE_PFN 0x9
  906. #define PSR_MODE_MASK 0x1
  907. #define PSR_USER_MODE 0x1
  908. #define PSR_MODE 0x0
  909. #define PSR_IE_MASK 0x2
  910. #define PSR_IE 0x1
  911. #define PSR_IRQL_MASK 0x1c
  912. #define PSR_IRQL 0x2
  913. #define IE_SFW_MASK 0x3
  914. #define IE_SFW 0x0
  915. #define IE_HDW_MASK 0xfc
  916. #define IE_HDW 0x2
  917. #define MCHK_CORRECTABLE_MASK 0x1
  918. #define MCHK_CORRECTABLE 0x0
  919. #define MCHK_RETRYABLE_MASK 0x2
  920. #define MCHK_RETRYABLE 0x1
  921. #define MCES_MCK_MASK 0x1
  922. #define MCES_MCK 0x0
  923. #define MCES_SCE_MASK 0x2
  924. #define MCES_SCE 0x1
  925. #define MCES_PCE_MASK 0x4
  926. #define MCES_PCE 0x2
  927. #define MCES_DPC_MASK 0x8
  928. #define MCES_DPC 0x3
  929. #define MCES_DSC_MASK 0x10
  930. #define MCES_DSC 0x4
  931. #define MCES_DMCK_MASK 0x20
  932. #define MCES_DMCK 0x5
  933. #define EXCSUM_SWC_MASK 0x1
  934. #define EXCSUM_SWC 0x0
  935. #define EXCSUM_INV_MASK 0x2
  936. #define EXCSUM_INV 0x1
  937. #define EXCSUM_DZE_MASK 0x4
  938. #define EXCSUM_DZE 0x2
  939. #define EXCSUM_OVF_MASK 0x8
  940. #define EXCSUM_OVF 0x3
  941. #define EXCSUM_UNF_MASK 0x10
  942. #define EXCSUM_UNF 0x4
  943. #define EXCSUM_INE_MASK 0x20
  944. #define EXCSUM_INE 0x5
  945. #define EXCSUM_IOV_MASK 0x40
  946. #define EXCSUM_IOV 0x6
  947. //
  948. // Call PAL mnemonics
  949. //
  950. // begin callpal
  951. #define bpt 0x80
  952. #define callsys 0x83
  953. #define imb 0x86
  954. #define gentrap 0xaa
  955. #define rdteb 0xab
  956. #define kbpt 0xac
  957. #define callkd 0xad
  958. #define halt 0x0
  959. #define restart 0x1
  960. #define draina 0x2
  961. #define reboot 0x3
  962. #define initpal 0x4
  963. #define wrentry 0x5
  964. #define swpirql 0x6
  965. #define rdirql 0x7
  966. #define di 0x8
  967. #define ei 0x9
  968. #define swppal 0xa
  969. #define ssir 0xc
  970. #define csir 0xd
  971. #define rfe 0xe
  972. #define retsys 0xf
  973. #define swpctx 0x10
  974. #define swpprocess 0x11
  975. #define rdmces 0x12
  976. #define wrmces 0x13
  977. #define tbia 0x14
  978. #define tbis 0x15
  979. #define tbisasn 0x17
  980. #define dtbis 0x16
  981. #define rdksp 0x18
  982. #define swpksp 0x19
  983. #define rdpsr 0x1a
  984. #define rdpcr 0x1c
  985. #define rdthread 0x1e
  986. #define tbim 0x20
  987. #define tbimasn 0x21
  988. #define rdcounters 0x30
  989. #define rdstate 0x31
  990. #define wrperfmon 0x32
  991. #define initpcr 0x38
  992. // end callpal