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.

205 lines
5.3 KiB

  1. //
  2. // Register bit constants.
  3. //
  4. #define X86_CR4_DEBUG_EXTENSIONS 0x8
  5. #define X86_DR6_BREAK_03 0xf
  6. #define X86_DR6_SINGLE_STEP 0x4000
  7. #define X86_DR7_LOCAL_EXACT_ENABLE 0x100
  8. #define X86_DR7_LEN0_SHIFT 18
  9. #define X86_DR7_RW0_EXECUTE 0x00000
  10. #define X86_DR7_RW0_WRITE 0x10000
  11. #define X86_DR7_RW0_IO 0x20000
  12. #define X86_DR7_RW0_READ_WRITE 0x30000
  13. #define X86_DR7_L0_ENABLE 0x1
  14. #define X86_DR7_ALL_ENABLES 0xff
  15. // All control bits used by breaks 0-3.
  16. #define X86_DR7_CTRL_03_MASK ((ULONG)0xffff00ff)
  17. #define X86_IS_VM86(x) ((unsigned short)(((x) >> 17) & 1))
  18. #define X86_BIT_FLAGOF (1 << 11)
  19. #define X86_BIT_FLAGDF (1 << 10)
  20. #define X86_BIT_FLAGIF (1 << 9)
  21. #define X86_BIT_FLAGTF (1 << 8)
  22. #define X86_BIT_FLAGSF (1 << 7)
  23. #define X86_BIT_FLAGZF (1 << 6)
  24. #define X86_BIT_FLAGAF (1 << 4)
  25. #define X86_BIT_FLAGPF (1 << 2)
  26. #define X86_BIT_FLAGCF (1 << 0)
  27. #define X86_BIT_FLAGVIP (1 << 20)
  28. #define X86_BIT_FLAGVIF (1 << 19)
  29. #define X86_BIT_FLAGIOPL 3
  30. #define X86_SHIFT_FLAGIOPL 12
  31. //
  32. // MSRs and their bits.
  33. //
  34. #define X86_MSR_DEBUG_CTL 0x1d9
  35. #define X86_DEBUG_CTL_LAST_BRANCH_RECORD 0x0001
  36. #define X86_DEBUG_CTL_BRANCH_TRACE 0x0002
  37. // P6 core last-branch MSRs.
  38. #define X86_MSR_LAST_BRANCH_FROM_IP 0x1db
  39. #define X86_MSR_LAST_BRANCH_TO_IP 0x1dc
  40. #define X86_MSR_LAST_EXCEPTION_FROM_IP 0x1dd
  41. #define X86_MSR_LAST_EXCEPTION_TO_IP 0x1de
  42. // PIV core last-branch MSRs. These are mostly
  43. // the same as the P6 but are interpreted differently.
  44. #define X86_MSR_LAST_BRANCH_TOS 0x1da
  45. #define X86_MSR_LAST_BRANCH_0 0x1db
  46. //
  47. // Native register values. These register values are shared
  48. // between plain X86 and AMD64. In IA32 intregs have 32-bit values,
  49. // in AMD64 they have 64-bit values.
  50. // Logically they are the same register, though, and the shared
  51. // disassembler uses them.
  52. //
  53. // 32/64 bit.
  54. #define X86_NAX 1
  55. #define X86_NBX 2
  56. #define X86_NCX 3
  57. #define X86_NDX 4
  58. #define X86_NSI 5
  59. #define X86_NDI 6
  60. #define X86_NSP 7
  61. #define X86_NBP 8
  62. #define X86_NIP 9
  63. // 32 bit.
  64. #define X86_NFL 10
  65. // 16 bit. These must be a group of consecutive values.
  66. #define X86_NCS 11
  67. #define X86_NDS 12
  68. #define X86_NES 13
  69. #define X86_NFS 14
  70. #define X86_NGS 15
  71. #define X86_NSS 16
  72. #define X86_NSEG_FIRST X86_NCS
  73. #define X86_NSEG_LAST X86_NSS
  74. //
  75. // IA32 definitions.
  76. //
  77. #define X86_GS X86_NGS
  78. #define X86_FS X86_NFS
  79. #define X86_ES X86_NES
  80. #define X86_DS X86_NDS
  81. #define X86_EDI X86_NDI
  82. #define X86_ESI X86_NSI
  83. #define X86_EBX X86_NBX
  84. #define X86_EDX X86_NDX
  85. #define X86_ECX X86_NCX
  86. #define X86_EAX X86_NAX
  87. #define X86_EBP X86_NBP
  88. #define X86_EIP X86_NIP
  89. #define X86_CS X86_NCS
  90. #define X86_EFL X86_NFL
  91. #define X86_ESP X86_NSP
  92. #define X86_SS X86_NSS
  93. #define X86_CR0 17
  94. #define X86_CR2 18
  95. #define X86_CR3 19
  96. #define X86_CR4 20
  97. #define X86_DR0 21
  98. #define X86_DR1 22
  99. #define X86_DR2 23
  100. #define X86_DR3 24
  101. #define X86_DR6 25
  102. #define X86_DR7 26
  103. #define X86_GDTR 27
  104. #define X86_GDTL 28
  105. #define X86_IDTR 29
  106. #define X86_IDTL 30
  107. #define X86_TR 31
  108. #define X86_LDTR 32
  109. // SSE registers:
  110. #define X86_MXCSR 50
  111. #define X86_XMM0 51
  112. #define X86_XMM1 52
  113. #define X86_XMM2 53
  114. #define X86_XMM3 54
  115. #define X86_XMM4 55
  116. #define X86_XMM5 56
  117. #define X86_XMM6 57
  118. #define X86_XMM7 58
  119. #define X86_XMM_FIRST X86_XMM0
  120. #define X86_XMM_LAST X86_XMM7
  121. // Floating-point registers:
  122. #define X86_FPCW 60
  123. #define X86_FPSW 61
  124. #define X86_FPTW 62
  125. #define X86_ST0 70
  126. #define X86_ST1 71
  127. #define X86_ST2 72
  128. #define X86_ST3 73
  129. #define X86_ST4 74
  130. #define X86_ST5 75
  131. #define X86_ST6 76
  132. #define X86_ST7 77
  133. #define X86_ST_FIRST X86_ST0
  134. #define X86_ST_LAST X86_ST7
  135. // MMX registers:
  136. #define X86_MM0 80
  137. #define X86_MM1 81
  138. #define X86_MM2 82
  139. #define X86_MM3 83
  140. #define X86_MM4 84
  141. #define X86_MM5 85
  142. #define X86_MM6 86
  143. #define X86_MM7 87
  144. #define X86_MM_FIRST X86_MM0
  145. #define X86_MM_LAST X86_MM7
  146. #define X86_FLAGBASE 100
  147. #define X86_DI 100
  148. #define X86_SI 101
  149. #define X86_BX 102
  150. #define X86_DX 103
  151. #define X86_CX 104
  152. #define X86_AX 105
  153. #define X86_BP 106
  154. #define X86_IP 107
  155. #define X86_FL 108
  156. #define X86_SP 109
  157. #define X86_BL 110
  158. #define X86_DL 111
  159. #define X86_CL 112
  160. #define X86_AL 113
  161. #define X86_BH 114
  162. #define X86_DH 115
  163. #define X86_CH 116
  164. #define X86_AH 117
  165. #define X86_IOPL 118
  166. #define X86_OF 119
  167. #define X86_DF 120
  168. #define X86_IF 121
  169. #define X86_TF 122
  170. #define X86_SF 123
  171. #define X86_ZF 124
  172. #define X86_AF 125
  173. #define X86_PF 126
  174. #define X86_CF 127
  175. #define X86_VIP 128
  176. #define X86_VIF 129