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.

190 lines
9.2 KiB

  1. #ifndef _ALPHA_DIS_
  2. #define _ALPHA_DIS_
  3. //
  4. // Bit manipulations for Alpha instructions
  5. //
  6. #define SHFT_OPCODE 26
  7. #define SHFT_RA 21
  8. #define SHFT_RB 16
  9. #define SHFT_JMP_FNC 14
  10. #define SHFT_OP_FNC 5
  11. #define SHFT_RBV_TYPE 12
  12. #define SHFT_LIT 13
  13. #define SHFT_FP_FNC 5
  14. #define WIDTH_OPCODE 6
  15. #define WIDTH_REG 5
  16. #define WIDTH_MEM_DISP 16
  17. #define WIDTH_HINT 14
  18. #define WIDTH_JMP_FNC 2
  19. #define WIDTH_BR_DISP 21
  20. #define WIDTH_OP_FNC 7
  21. #define WIDTH_LIT 8
  22. #define WIDTH_FP_FNC 11
  23. #define WIDTH_PAL_FNC 26
  24. #define BITS_OPCODE ~(-1 << WIDTH_OPCODE)
  25. #define BITS_REG ~(-1 << WIDTH_REG)
  26. #define BITS_MEM_DISP ~(-1 << WIDTH_MEM_DISP)
  27. #define BITS_HINT ~(-1 << WIDTH_HINT)
  28. #define BITS_JMP_FNC ~(-1 << WIDTH_JMP_FNC)
  29. #define BITS_BR_DISP ~(-1 << WIDTH_BR_DISP)
  30. #define BITS_OP_FNC ~(-1 << WIDTH_OP_FNC)
  31. #define BITS_LIT ~(-1 << WIDTH_LIT)
  32. #define BITS_FP_FNC ~(-1 << WIDTH_FP_FNC)
  33. #define BITS_PAL_FNC ~(-1 << WIDTH_PAL_FNC)
  34. #define OPCODE(a) ((BITS_OPCODE & (a)) << SHFT_OPCODE)
  35. #define REG_A(a) ((BITS_REG & (a)) << SHFT_RA)
  36. #define REG_B(a) ((BITS_REG & (a)) << SHFT_RB)
  37. #define REG_C(a) (BITS_REG & (a))
  38. #define MEM_DISP(a) (BITS_MEM_DISP & (a))
  39. #define MEM_FUNC(a) MEM_DISP(a)
  40. #define HINT(a) (BITS_HINT & (a))
  41. #define JMP_FNC(a) ((BITS_JMP_FNC & (a)) << SHFT_JMP_FNC)
  42. #define BR_DISP(a) (BITS_BR_DISP & (a))
  43. #define OP_FNC(a) ((BITS_OP_FNC & (a)) << SHFT_OP_FNC)
  44. #define RBV_TYPE(a) ((1 & (a)) << SHFT_RBV_TYPE)
  45. #define LIT(a) ((BITS_LIT & (a)) << SHFT_LIT)
  46. #define FP_FNC(a) ((BITS_FP_FNC & (a)) << SHFT_FP_FNC)
  47. #define PAL_FNC(a) (BITS_PAL_FNC & (a))
  48. #define MSK_OPCODE OPCODE(BITS_OPCODE)
  49. #define MSK_RA GET_RA(BITS_REG)
  50. #define MSK_RB REG_B(BITS_REG)
  51. #define MSK_RC REG_C(BITS_REG)
  52. #define MSK_MEM_DISP DISP(BITS_MEM_DISP)
  53. #define MSK_HINT HINT(BITS_HINT)
  54. #define MSK_JMP_FNC JMP_FNC(BITS_JMP_FNC)
  55. #define MSK_BR_DISP BR_DISP(BITS_BR_DISP)
  56. #define MSK_RBV_TYPE RBV_TYPE(1)
  57. #define MSK_LIT LIT(BITS_LIT)
  58. #define MSK_FP_FNC FP_FNC(BITS_FP_FNC)
  59. #define MSK_PAL_FNC PAL_FNC(BITS_PAL_FNC)
  60. #define EXTR_OPCODE(a) (((a) & MSK_OPCODE) >> SHFT_OPCODE)
  61. #define EXTR_RA(a) (((a) & MSK_RA) >> SHFT_RA)
  62. #define EXTR_RB(a) (((a) & MSK_RB) >> SHFT_RA)
  63. #define EXTR_RC(a) ((a) & MSK_RC)
  64. #define EXTR_MEM_DISP(a) ((a) & MSK_MEM_DISP)
  65. #define EXTR_HINT(a) ((a) & MSK_HINT)
  66. #define EXTR_JMP_FNC(a) (((a) & MSK_JMP_FNC) >> SHFT_JMP_FNC)
  67. #define EXTR_BR_DISP(a) ((a) & MSK_BR_DISP)
  68. #define EXTR_RBV_TYPE(a) (((a) & MSK_RBV_TYPE) >> SHFT_RBV_TYPE)
  69. #define EXTR_LIT(a) (((a) & MSK_LIT) >> SHFT_LIT)
  70. #define EXTR_FP_FNC(a) (((a) & MSK_FP_FNC) >> SHFT_FP_FNC)
  71. #define EXTR_PAL_FNC(a) ((a) & MSK_PAL_FNC)
  72. //
  73. // Bit manipulations for EV4 PAL mode instructions
  74. //
  75. #define SHFT_EV4_IBOX 5
  76. #define SHFT_EV4_ABOX 6
  77. #define SHFT_EV4_PALTEMP 7
  78. #define SHFT_EV4_QWORD 12
  79. #define SHFT_EV4_RWCHECK 13
  80. #define SHFT_EV4_ALT 14
  81. #define SHFT_EV4_PHYSICAL 15
  82. #define WIDTH_EV4_INDEX 5
  83. #define WIDTH_EV4_IBOX 1
  84. #define WIDTH_EV4_ABOX 1
  85. #define WIDTH_EV4_PALTEMP 1
  86. #define WIDTH_EV4_DISP 12
  87. #define WIDTH_EV4_QWORD 1
  88. #define WIDTH_EV4_RWCHECK 1
  89. #define WIDTH_EV4_ALT 1
  90. #define WIDTH_EV4_PHYSICAL 1
  91. #define BITS_EV4_INDEX ~(-1 << WIDTH_EV4_INDEX)
  92. #define BITS_EV4_IBOX ~(-1 << WIDTH_EV4_IBOX)
  93. #define BITS_EV4_ABOX ~(-1 << WIDTH_EV4_ABOX)
  94. #define BITS_EV4_PALTEMP ~(-1 << WIDTH_EV4_PALTEMP)
  95. #define BITS_EV4_DISP ~(-1 << WIDTH_EV4_DISP)
  96. #define BITS_EV4_QWORD ~(-1 << WIDTH_EV4_QWORD)
  97. #define BITS_EV4_RWCHECK ~(-1 << WIDTH_EV4_RWCHECK)
  98. #define BITS_EV4_ALT ~(-1 << WIDTH_EV4_ALT)
  99. #define BITS_EV4_PHYSICAL ~(-1 << WIDTH_EV4_PHYSICAL)
  100. #define EV4_INDEX(a) (BITS_EV4_INDEX & (a))
  101. #define EV4_IBOX(a) ((BITS_EV4_IBOX & (a)) << SHFT_EV4_IBOX)
  102. #define EV4_ABOX(a) ((BITS_EV4_ABOX & (a)) << SHFT_EV4_ABOX)
  103. #define EV4_PALTEMP(a) ((BITS_EV4_PALTEMP & (a)) << SHFT_EV4_PALTEMP)
  104. #define EV4_DISP(a) (BITS_EV4_DISP & (a))
  105. #define EV4_QWORD(a) ((BITS_EV4_QWORD & (a)) << SHFT_EV4_QWORD)
  106. #define EV4_RWCHECK(a) ((BITS_EV4_RWCHECK & (a)) << SHFT_EV4_RWCHECK)
  107. #define EV4_ALT(a) ((BITS_EV4_ALT & (a)) << SHFT_EV4_ALT)
  108. #define EV4_PHYSICAL(a) ((BITS_EV4_PHYSICAL & (a)) << SHFT_EV4_PHYSICAL)
  109. #define MSK_EV4_INDEX EV4_INDEX(BITS_EV4_INDEX)
  110. #define MSK_EV4_IBOX EV4_IBOX(BITS_EV4_IBOX)
  111. #define MSK_EV4_ABOX EV4_ABOX(BITS_EV4_ABOX)
  112. #define MSK_EV4_PALTEMP EV4_PALTEMP(BITS_EV4_PALTEMP)
  113. #define MSK_EV4_PR (MSK_EV4_INDEX | MSK_EV4_IBOX | MSK_EV4_ABOX | MSK_EV4_PALTEMP)
  114. #define MSK_EV4_DISP EV4_DISP(BITS_EV4_DISP)
  115. #define MSK_EV4_QWORD EV4_QWORD(BITS_EV4_QWORD)
  116. #define MSK_EV4_RWCHECK EV4_RWCHECK(BITS_EV4_RWCHECK)
  117. #define MSK_EV4_ALT EV4_ALT(BITS_EV4_ALT)
  118. #define MSK_EV4_PHYSICAL EV4_PHYSICAL(BITS_EV4_PHYSICAL)
  119. #define EXTR_EV4_INDEX(a) (MSK_EV4_INDEX & (a))
  120. #define EXTR_EV4_IBOX(a) ((MSK_EV4_IBOX & (a)) >> SHFT_EV4_IBOX)
  121. #define EXTR_EV4_ABOX(a) ((MSK_EV4_ABOX & (a)) >> SHFT_EV4_ABOX)
  122. #define EXTR_EV4_PALTEMP(a) ((MSK_EV4_PALTEMP & (a)) >> SHFT_EV4_PALTEMP)
  123. #define EXTR_EV4_DISP(a) (MSK_EV4_DISP & (a))
  124. #define EXTR_EV4_QWORD(a) ((MSK_EV4_QWORD & (a)) >> SHFT_EV4_QWORD)
  125. #define EXTR_EV4_RWCHECK(a) ((MSK_EV4_RWCHECK & (a)) >> SHFT_EV4_RWCHECK)
  126. #define EXTR_EV4_ALT(a) ((MSK_EV4_ALT & (a)) >> SHFT_EV4_ALT)
  127. #define EXTR_EV4_PHYSICAL(a) ((MSK_EV4_PHYSICAL & (a)) >> SHFT_EV4_PHYSICAL)
  128. #define EV4_TB_TAG (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(0))
  129. #define EV4_ITB_PTE (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(1))
  130. #define EV4_ICCSR (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(2))
  131. #define EV4_ITM_PTE_TEMP (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(3))
  132. #define EV4_EXC_ADDR (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(4))
  133. #define EV4_SL_RCV (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(5))
  134. #define EV4_ITBZAP (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(6))
  135. #define EV4_ITBASM (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(7))
  136. #define EV4_ITBIS (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(8))
  137. #define EV4_PS (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(9))
  138. #define EV4_EXC_SUM (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(10))
  139. #define EV4_PAL_BASE (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(11))
  140. #define EV4_HIRR (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(12))
  141. #define EV4_SIRR (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(13))
  142. #define EV4_ASTRR (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(14))
  143. #define EV4_HIER (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(16))
  144. #define EV4_SIER (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(17))
  145. #define EV4_ASTER (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(18))
  146. #define EV4_SL_CLR (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(19))
  147. #define EV4_SL_XMIT (EV4_PALTEMP(0) | EV4_ABOX(0) | EV4_IBOX(1) | EV4_INDEX(22))
  148. #define EV4_DTB_CTL (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(0))
  149. #define EV4_DTB_PTE (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(2))
  150. #define EV4_DTB_PTE_TEMP (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(3))
  151. #define EV4_MMCSR (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(4))
  152. #define EV4_VA (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(5))
  153. #define EV4_DTBZAP (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(6))
  154. #define EV4_DTASM (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(7))
  155. #define EV4_DTBIS (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(8))
  156. #define EV4_BIU_ADDR (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(9))
  157. #define EV4_BIU_STAT (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(10))
  158. #define EV4_DC_ADDR (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(11))
  159. #define EV4_DC_STAT (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(12))
  160. #define EV4_FILL_ADDR (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(13))
  161. #define EV4_ABOX_CTL (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(14))
  162. #define EV4_ALT_MODE (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(15))
  163. #define EV4_CC (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(16))
  164. #define EV4_CC_CTL (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(17))
  165. #define EV4_BIU_CTL (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(18))
  166. #define EV4_FILL_SYNDROME (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(19))
  167. #define EV4_BC_TAG (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(20))
  168. #define EV4_FLUSH_IC (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(21))
  169. #define EV4_FLUSH_IC_ASM (EV4_PALTEMP(0) | EV4_ABOX(1) | EV4_IBOX(0) | EV4_INDEX(23))
  170. #define EV4_PAL_TEMP(x) (EV4_PALTEMP(1) | EV4_ABOX(0) | EV4_IBOX(0) | EV4_INDEX(x))
  171. #endif