Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
4.9 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. #define X86_MSR_LAST_BRANCH_FROM_IP 0x1db
  38. #define X86_MSR_LAST_BRANCH_TO_IP 0x1dc
  39. #define X86_MSR_LAST_EXCEPTION_FROM_IP 0x1dd
  40. #define X86_MSR_LAST_EXCEPTION_TO_IP 0x1de
  41. //
  42. // Native register values. These register values are shared
  43. // between plain X86 and AMD64. In IA32 intregs have 32-bit values,
  44. // in AMD64 they have 64-bit values.
  45. // Logically they are the same register, though, and the shared
  46. // disassembler uses them.
  47. //
  48. // 32/64 bit.
  49. #define X86_NAX 1
  50. #define X86_NBX 2
  51. #define X86_NCX 3
  52. #define X86_NDX 4
  53. #define X86_NSI 5
  54. #define X86_NDI 6
  55. #define X86_NSP 7
  56. #define X86_NBP 8
  57. #define X86_NIP 9
  58. // 32 bit.
  59. #define X86_NFL 10
  60. // 16 bit. These must be a group of consecutive values.
  61. #define X86_NCS 11
  62. #define X86_NDS 12
  63. #define X86_NES 13
  64. #define X86_NFS 14
  65. #define X86_NGS 15
  66. #define X86_NSS 16
  67. #define X86_NSEG_FIRST X86_NCS
  68. #define X86_NSEG_LAST X86_NSS
  69. //
  70. // IA32 definitions.
  71. //
  72. #define X86_GS X86_NGS
  73. #define X86_FS X86_NFS
  74. #define X86_ES X86_NES
  75. #define X86_DS X86_NDS
  76. #define X86_EDI X86_NDI
  77. #define X86_ESI X86_NSI
  78. #define X86_EBX X86_NBX
  79. #define X86_EDX X86_NDX
  80. #define X86_ECX X86_NCX
  81. #define X86_EAX X86_NAX
  82. #define X86_EBP X86_NBP
  83. #define X86_EIP X86_NIP
  84. #define X86_CS X86_NCS
  85. #define X86_EFL X86_NFL
  86. #define X86_ESP X86_NSP
  87. #define X86_SS X86_NSS
  88. #define X86_CR0 17
  89. #define X86_CR2 18
  90. #define X86_CR3 19
  91. #define X86_CR4 20
  92. #define X86_DR0 21
  93. #define X86_DR1 22
  94. #define X86_DR2 23
  95. #define X86_DR3 24
  96. #define X86_DR6 25
  97. #define X86_DR7 26
  98. #define X86_GDTR 27
  99. #define X86_GDTL 28
  100. #define X86_IDTR 29
  101. #define X86_IDTL 30
  102. #define X86_TR 31
  103. #define X86_LDTR 32
  104. // SSE registers:
  105. #define X86_MXCSR 50
  106. #define X86_XMM0 51
  107. #define X86_XMM1 52
  108. #define X86_XMM2 53
  109. #define X86_XMM3 54
  110. #define X86_XMM4 55
  111. #define X86_XMM5 56
  112. #define X86_XMM6 57
  113. #define X86_XMM7 58
  114. #define X86_XMM_FIRST X86_XMM0
  115. #define X86_XMM_LAST X86_XMM7
  116. // Floating-point registers:
  117. #define X86_FPCW 60
  118. #define X86_FPSW 61
  119. #define X86_FPTW 62
  120. #define X86_ST0 70
  121. #define X86_ST1 71
  122. #define X86_ST2 72
  123. #define X86_ST3 73
  124. #define X86_ST4 74
  125. #define X86_ST5 75
  126. #define X86_ST6 76
  127. #define X86_ST7 77
  128. #define X86_ST_FIRST X86_ST0
  129. #define X86_ST_LAST X86_ST7
  130. // MMX registers:
  131. #define X86_MM0 80
  132. #define X86_MM1 81
  133. #define X86_MM2 82
  134. #define X86_MM3 83
  135. #define X86_MM4 84
  136. #define X86_MM5 85
  137. #define X86_MM6 86
  138. #define X86_MM7 87
  139. #define X86_MM_FIRST X86_MM0
  140. #define X86_MM_LAST X86_MM7
  141. #define X86_FLAGBASE 100
  142. #define X86_DI 100
  143. #define X86_SI 101
  144. #define X86_BX 102
  145. #define X86_DX 103
  146. #define X86_CX 104
  147. #define X86_AX 105
  148. #define X86_BP 106
  149. #define X86_IP 107
  150. #define X86_FL 108
  151. #define X86_SP 109
  152. #define X86_BL 110
  153. #define X86_DL 111
  154. #define X86_CL 112
  155. #define X86_AL 113
  156. #define X86_BH 114
  157. #define X86_DH 115
  158. #define X86_CH 116
  159. #define X86_AH 117
  160. #define X86_IOPL 118
  161. #define X86_OF 119
  162. #define X86_DF 120
  163. #define X86_IF 121
  164. #define X86_TF 122
  165. #define X86_SF 123
  166. #define X86_ZF 124
  167. #define X86_AF 125
  168. #define X86_PF 126
  169. #define X86_CF 127
  170. #define X86_VIP 128
  171. #define X86_VIF 129