home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / sdk / winh / winnt / alphaops.h next >
Encoding:
C/C++ Source or Header  |  1995-07-11  |  41.5 KB  |  1,218 lines

  1. /*++
  2.  
  3. Copyright (c) 1992-1995  Digital Equipment Corporation
  4.  
  5. Module Name:
  6.  
  7.     alphaops.h
  8.  
  9. Abstract:
  10.  
  11.     Alpha AXP instruction and floating constant definitions.
  12.  
  13. Author:
  14.  
  15. Revision History:
  16.  
  17. --*/
  18.  
  19. #ifndef _ALPHAOPS_
  20. #define _ALPHAOPS_
  21.  
  22. //
  23. // Instruction types.
  24. //      The Alpha architecture does not number the instruction types,
  25. //      this numbering is for software decoding only.
  26. //
  27.  
  28. #define ALPHA_UNKNOWN           0       // Reserved or illegal
  29. #define ALPHA_MEMORY            1       // Memory (load/store)
  30. #define ALPHA_FP_MEMORY         2       // Floating point Memory
  31. #define ALPHA_MEMSPC            3       // Memory special
  32. #define ALPHA_JUMP              4       // Jump (memory formation)
  33. #define ALPHA_BRANCH            5       // Branch
  34. #define ALPHA_FP_BRANCH         6       // Floating Point Branch
  35. #define ALPHA_OPERATE           7       // Register-register operate
  36. #define ALPHA_LITERAL           8       // Literal-register operate
  37. #define ALPHA_FP_OPERATE        9       // Floating point operate
  38. #define ALPHA_FP_CONVERT        10      // Floating point convert
  39. #define ALPHA_CALLPAL           11      // Call to PAL
  40. #define ALPHA_EV4_PR            12      // EV4 MTPR/MFPR PAL mode instructions
  41. #define ALPHA_EV4_MEM           13      // EV4 special memory PAL mode access
  42. #define ALPHA_EV4_REI           14      // EV4 PAL mode switch
  43.  
  44. //
  45. // Instruction Opcodes.
  46. //
  47.  
  48. #define CALLPAL_OP      0x00    // ALPHA_CALLPAL
  49. #define _01_OP          0x01    // - reserved opcode
  50. #define _02_OP          0x02    // - reserved opcode
  51. #define _03_OP          0x03    // - reserved opcode
  52. #define _04_OP          0x04    // - reserved opcode
  53. #define _05_OP          0x05    // - reserved opcode
  54. #define _06_OP          0x06    // - reserved opcode
  55. #define _07_OP          0x07    // - reserved opcode
  56. #define LDA_OP          0x08    // ALPHA_MEMORY
  57. #define LDAH_OP         0x09    // ALPHA_MEMORY
  58. #define _0A_OP          0x0A    // - reserved opcode
  59. #define LDQ_U_OP        0x0B    // ALPHA_MEMORY
  60. #define _0C_OP          0x0C    // - reserved opcode
  61. #define _0D_OP          0x0D    // - reserved opcode
  62. #define _0E_OP          0x0E    // - reserved opcode
  63. #define STQ_U_OP        0x0F    // ALPHA_MEMORY
  64. #define ARITH_OP        0x10    // ALPHA_OPERATE or ALPHA_LITERAL
  65. #define BIT_OP          0x11    // ALPHA_OPERATE or ALPHA_LITERAL
  66. #define BYTE_OP         0x12    // ALPHA_OPERATE or ALPHA_LITERAL
  67. #define MUL_OP          0x13    // ALPHA_OPERATE or ALPHA_LITERAL
  68. #define _14_OP          0x14    // - reserved opcode
  69. #define VAXFP_OP        0x15    // ALPHA_FP_OPERATE
  70. #define IEEEFP_OP       0x16    // ALPHA_FP_OPERATE
  71. #define FPOP_OP         0x17    // ALPHA_FP_OPERATE
  72. #define MEMSPC_OP       0x18    // ALPHA_MEMORY
  73. #define PAL19_OP        0x19    // - reserved for PAL mode
  74. //#define MFPR_OP         0x19    // ALPHA_MFPR
  75. #define JMP_OP          0x1A    // ALPHA_JUMP
  76. #define PAL1B_OP        0x1B    // - reserved for PAL mode
  77. #define _1C_OP          0x1C    // - reserved opcode
  78. #define PAL1D_OP        0x1D    // - reserved for PAL mode
  79. //#define MTPR_OP         0x1D    // ALPHA_MTPR
  80. #define PAL1E_OP        0x1E    // - reserved for PAL mode
  81. #define PAL1F_OP        0x1F    // - reserved for PAL mode
  82. #define LDF_OP          0x20    // ALPHA_MEMORY
  83. #define LDG_OP          0x21    // ALPHA_MEMORY
  84. #define LDS_OP          0x22    // ALPHA_MEMORY
  85. #define LDT_OP          0x23    // ALPHA_MEMORY
  86. #define STF_OP          0x24    // ALPHA_MEMORY
  87. #define STG_OP          0x25    // ALPHA_MEMORY
  88. #define STS_OP          0x26    // ALPHA_MEMORY
  89. #define STT_OP          0x27    // ALPHA_MEMORY
  90. #define LDL_OP          0x28    // ALPHA_MEMORY
  91. #define LDQ_OP          0x29    // ALPHA_MEMORY
  92. #define LDL_L_OP        0x2A    // ALPHA_MEMORY
  93. #define LDQ_L_OP        0x2B    // ALPHA_MEMORY
  94. #define STL_OP          0x2C    // ALPHA_MEMORY
  95. #define STQ_OP          0x2D    // ALPHA_MEMORY
  96. #define STL_C_OP        0x2E    // ALPHA_MEMORY
  97. #define STQ_C_OP        0x2F    // ALPHA_MEMORY
  98. #define BR_OP           0x30    // ALPHA_BRANCH
  99. #define FBEQ_OP         0x31    // ALPHA_BRANCH
  100. #define FBLT_OP         0x32    // ALPHA_BRANCH
  101. #define FBLE_OP         0x33    // ALPHA_BRANCH
  102. #define BSR_OP          0x34    // ALPHA_BRANCH
  103. #define FBNE_OP         0x35    // ALPHA_BRANCH
  104. #define FBGE_OP         0x36    // ALPHA_BRANCH
  105. #define FBGT_OP         0x37    // ALPHA_BRANCH
  106. #define BLBC_OP         0x38    // ALPHA_BRANCH
  107. #define BEQ_OP          0x39    // ALPHA_BRANCH
  108. #define BLT_OP          0x3A    // ALPHA_BRANCH
  109. #define BLE_OP          0x3B    // ALPHA_BRANCH
  110. #define BLBS_OP         0x3C    // ALPHA_BRANCH
  111. #define BNE_OP          0x3D    // ALPHA_BRANCH
  112. #define BGE_OP          0x3E    // ALPHA_BRANCH
  113. #define BGT_OP          0x3F    // ALPHA_BRANCH
  114.  
  115. #define LDA_OP_STR      "lda"
  116. #define LDAH_OP_STR     "ldah"
  117. #define LDQ_U_OP_STR    "ldq_u"
  118. #define STQ_U_OP_STR    "stq_u"
  119. #define LDF_OP_STR      "ldf"
  120. #define LDG_OP_STR      "ldg"
  121. #define LDS_OP_STR      "lds"
  122. #define LDT_OP_STR      "ldt"
  123. #define STF_OP_STR      "stf"
  124. #define STG_OP_STR      "stg"
  125. #define STS_OP_STR      "sts"
  126. #define STT_OP_STR      "stt"
  127. #define LDL_OP_STR      "ldl"
  128. #define LDQ_OP_STR      "ldq"
  129. #define LDL_L_OP_STR    "ldl_l"
  130. #define LDQ_L_OP_STR    "ldq_l"
  131. #define STL_OP_STR      "stl"
  132. #define STQ_OP_STR      "stq"
  133. #define STL_C_OP_STR    "stl_c"
  134. #define STQ_C_OP_STR    "stq_c"
  135. #define BR_OP_STR       "br"
  136. #define FBEQ_OP_STR     "fbeq"
  137. #define FBLT_OP_STR     "fblt"
  138. #define FBLE_OP_STR     "fble"
  139. #define BSR_OP_STR      "bsr"
  140. #define FBNE_OP_STR     "fbne"
  141. #define FBGE_OP_STR     "fbge"
  142. #define FBGT_OP_STR     "fbgt"
  143. #define BLBC_OP_STR     "blbc"
  144. #define BEQ_OP_STR      "beq"
  145. #define BLT_OP_STR      "blt"
  146. #define BLE_OP_STR      "ble"
  147. #define BLBS_OP_STR     "blbs"
  148. #define BNE_OP_STR      "bne"
  149. #define BGE_OP_STR      "bge"
  150. #define BGT_OP_STR      "bgt"
  151.  
  152. //
  153. // Type (1) Memory Instruction Format.
  154. // Type (2) Memory Special Instruction Format.
  155. //
  156. //  3         2 2       2 2       1 1
  157. //  1         6 5       1 0       6 5                             0
  158. // +-----------+---------+---------+-------------------------------+
  159. // |   opcode  |   Ra    |   Rb    |          Memory_disp          |
  160. // +-----------+---------+---------+-------------------------------+
  161. //
  162. //      LDAx    Ra.wq,disp.ab(Rb.ab)            x = (,H)
  163. //      LDx     Ra.wq,disp.ab(Rb.ab)            x = (L,Q,F,G,S,T)
  164. //      LDQ_U   Ra.wq,disp.ab(Rb.ab)
  165. //      LDx_L   Ra.wq,disp.ab(Rb.ab)            x = (L,Q)
  166. //      STx_C   Ra.mq,disp.ab(Rb.ab)            x = (L,Q)
  167. //      STx     Ra.rq,disp.ab(Rb.ab)            x = (L,Q,F,G,S,T)
  168. //      STQ_U   Ra.rq,disp.ab(Rb.ab)
  169. //
  170.  
  171. typedef struct _Alpha_Memory_Format {
  172.         LONG MemDisp : 16;
  173.         ULONG Rb : 5;
  174.         ULONG Ra : 5;
  175.         ULONG Opcode : 6;
  176. } Alpha_Memory_Format;
  177.  
  178. //
  179. // Special Memory instruction function codes (in Memdisp).
  180. //
  181.  
  182. #define TRAPB_FUNC        0x0000
  183. #define EXCB_FUNC         0x0400
  184. #define MB_FUNC           0x4000
  185. #define WMB_FUNC          0x4400
  186. #define MB2_FUNC          0x4800
  187. #define MB3_FUNC          0x4C00
  188. #define FETCH_FUNC        0x8000
  189. #define FETCH_M_FUNC      0xA000
  190. #define RPCC_FUNC         0xC000
  191. #define RC_FUNC           0xE000
  192. #define RS_FUNC           0xF000
  193.  
  194. #define TRAPB_FUNC_STR     "trapb"
  195. #define EXCB_FUNC_STR      "excb"
  196. #define MB_FUNC_STR        "mb"
  197. #define MB1_FUNC_STR       "wmb"
  198. #define MB2_FUNC_STR       "mb2"
  199. #define MB3_FUNC_STR       "mb3"
  200. #define FETCH_FUNC_STR     "fetch"
  201. #define FETCH_M_FUNC_STR   "fetch_m"
  202. #define RPCC_FUNC_STR      "rpcc"
  203. #define RC_FUNC_STR        "rc"
  204. #define RS_FUNC_STR        "rs"
  205.  
  206. //
  207. // Type (3) Memory Format Jump Instructions.
  208. //
  209. //  3         2 2       2 2       1 1 1 1
  210. //  1         6 5       1 0       6 5 4 3                         0
  211. // +-----------+---------+---------+---+---------------------------+
  212. // |   opcode  |   Ra    |   Rb    |Fnc|            Hint           |
  213. // +-----------+---------+---------+---+---------------------------+
  214. //
  215. //      xxx     Ra.wq,(Rb.ab),hint      xxx = (JMP, JSR, RET, JSR_COROUTINE)
  216. //
  217.  
  218. typedef struct _Alpha_Jump_Format {
  219.         LONG Hint : 14;
  220.         ULONG Function : 2;
  221.         ULONG Rb : 5;
  222.         ULONG Ra : 5;
  223.         ULONG Opcode : 6;
  224. } Alpha_Jump_Format;
  225.  
  226. //
  227. // Jump function codes (in Function, opcode 1A, JMP_OP).
  228. //
  229.  
  230. #define JMP_FUNC        0x0     // Jump
  231. #define JSR_FUNC        0x1     // Jump to Subroutine
  232. #define RET_FUNC        0x2     // Return from Subroutine
  233. #define JSR_CO_FUNC     0x3     // Jump to Subroutine Return
  234.  
  235. #define JMP_FUNC_STR      "jmp"
  236. #define JSR_FUNC_STR      "jsr"
  237. #define RET_FUNC_STR      "ret"
  238. #define JSR_CO_FUNC_STR   "jsr_cortn"
  239.  
  240. //
  241. // The exception handling compatible return instruction has a hint value
  242. // of 0001. Define a macro that identifies these return instructions.
  243. // The Rb register field is masked out since it is normally, but not
  244. // required to be, RA_REG.
  245. //
  246.  
  247. #define IS_RETURN_0001_INSTRUCTION(Instruction) \
  248.     (((Instruction) & 0xFFE0FFFF) == 0x6BE08001)
  249.  
  250. //
  251. // Type (4) Branch Instruction Format.
  252. //
  253. //  3         2 2       2 2
  254. //  1         6 5       1 0                                       0
  255. // +-----------+---------+-----------------------------------------+
  256. // |   opcode  |   Ra    |             Branch_disp                 |
  257. // +-----------+---------+-----------------------------------------+
  258. //
  259. //      Bxx     Ra.rq,disp.al           x = (EQ,NE,LT,LE,GT,GE,LBC,LBS)
  260. //      BxR     Ra.wq,disp.al           x = (,S)
  261. //      FBxx    Ra.rq,disp.al           x = (EQ,NE,LT,LE,GT,GE)
  262. //
  263.  
  264. typedef struct _Alpha_Branch_Format {
  265.         LONG BranchDisp : 21;
  266.         ULONG Ra : 5;
  267.         ULONG Opcode : 6;
  268. } Alpha_Branch_Format;
  269.  
  270. //
  271. // Type (5) Operate Register Instruction Format.
  272. // Type (6) Operate Literal Instruction Format.
  273. //               bop = Rb.rq or #b.ib
  274. //
  275. //  3         2 2       2 2       1 1   1 1 1
  276. //  1         6 5       1 0       6 5   3 2 1           5 4       0
  277. // +-----------+---------+---------+-----+-+-------------+---------+
  278. // |   opcode  |   Ra    |   Rb    | SBZ |0|  function   |   Rc    |
  279. // +-----------+---------+---------+-----+-+-------------+---------+
  280. //  3         2 2       2 2             1 1 1
  281. //  1         6 5       1 0             3 2 1           5 4       0
  282. // +-----------+---------+---------------+-+-------------+---------+
  283. // |   opcode  |   Ra    |      LIT      |1|  function   |   Rc    |
  284. // +-----------+---------+---------------+-+-------------+---------+
  285. //
  286. //
  287. //      ADDx    Ra.rq,bop,Rc.wq /V      x = (Q,L)
  288. //      SxADDy  Ra.rq,bop,Rc.wq         x = (4,8), y = (Q, L)
  289. //      CMPx    Ra.rq,bop,Rc.wq         x = (EQ,LT,LE,ULT,ULE)
  290. //      MULx    Ra.rq,bop,Rc.wq /V      x = (Q,L)
  291. //      UMULH   Ra.rq,bop,Rc.wq
  292. //      SUBx    Ra.rq,bop,Rc.wq /V      x = (Q,L)
  293. //      SxSUBy  Ra.rq,bop,Rc.wq         x = (4,8), y = (Q, L)
  294. //      xxx     Ra.rq,bop,Rc.wq         xxx = (AND,BIS,XOR,BIC,ORNOT,EQV)
  295. //      CMOVxx  Ra.rq,bop,Rc.wq         xx = (EQ,NE,LT,LE,GT,GE,LBC,LBS)
  296. //      SxL     Ra.rq,bop,Rc.wq         x = (L,R)
  297. //      SRA     Ra.rq,bop,Rc.wq
  298. //      CMPBGE  Ra.rq,bop,Rc.wq
  299. //      EXTxx   Ra.rq,bop,Rc.wq         xx = (BL,WL,WH,LL,LH,WL,QH)
  300. //      INSxx   Ra.rq,bop,Rc.wq         xx = (BL,WL,WH,LL,LH,WL,QH)
  301. //      MSKxx   Ra.rq,bop,Rc.wq         xx = (BL,WL,WH,LL,LH,WL,QH)
  302. //      ZAPx    Ra.rq,bop,Rc.wq         x = (,NOT)
  303. //
  304.  
  305. typedef struct _Alpha_OpReg_Format {
  306.         ULONG Rc : 5;
  307.         ULONG Function : 7;
  308.         ULONG RbvType : 1;              // 0 for register format
  309.         ULONG SBZ : 3;
  310.         ULONG Rb : 5;
  311.         ULONG Ra : 5;
  312.         ULONG Opcode : 6;
  313. } Alpha_OpReg_Format;
  314.  
  315. typedef struct _Alpha_OpLit_Format {
  316.         ULONG Rc : 5;
  317.         ULONG Function : 7;
  318.         ULONG RbvType : 1;              // 1 for literal format
  319.         ULONG Literal : 8;
  320.         ULONG Ra : 5;
  321.         ULONG Opcode : 6;
  322. } Alpha_OpLit_Format;
  323.  
  324. #define RBV_REGISTER_FORMAT 0
  325. #define RBV_LITERAL_FORMAT 1
  326.  
  327. //
  328. // Arithmetic operate function codes (in Function, Opcode 10, ARITH_OP).
  329. //
  330.  
  331. #define ADDL_FUNC       0x00    // Add Longword
  332. #define ADDLV_FUNC      0x40    // Add Longword, Integer Overflow Enable
  333. #define S4ADDL_FUNC     0x02    // Scaled Add Longword by 4
  334. #define S8ADDL_FUNC     0x12    // Scaled Add Longword by 8
  335.  
  336. #define ADDQ_FUNC       0x20    // Add Quadword
  337. #define ADDQV_FUNC      0x60    // Add Quadword, Integer Overflow Enable
  338. #define S4ADDQ_FUNC     0x22    // Scaled Add Quadword by 4
  339. #define S8ADDQ_FUNC     0x32    // Scaled Add Quadword by 8
  340.  
  341. #define SUBL_FUNC       0x09    // Subtract Longword
  342. #define SUBLV_FUNC      0x49    // Subtract Longword, Integer Overflow Enable
  343. #define S4SUBL_FUNC     0x0B    // Scaled Subtract Longword by 4
  344. #define S8SUBL_FUNC     0x1B    // Scaled Subtract Longword by 8
  345.  
  346. #define SUBQ_FUNC       0x29    // Subtract Quadword
  347. #define SUBQV_FUNC      0x69    // Subtract Quadword, Integer Overflow Enable
  348. #define S4SUBQ_FUNC     0x2B    // Scaled Subtract Quadword by 4
  349. #define S8SUBQ_FUNC     0x3B    // Scaled Subtract Quadword by 8
  350.  
  351. #define CMPEQ_FUNC      0x2D    // Compare Signed Quadword Equal
  352. #define CMPLT_FUNC      0x4D    // Compare Signed Quadword Less Than
  353. #define CMPLE_FUNC      0x6D    // Compare Signed Quadword Less Than or Equal
  354. #define CMPULT_FUNC     0x1D    // Compare Unsigned Quadword Less Than
  355. #define CMPULE_FUNC     0x3D    // Compare Unsigned Quadword Less Than or Equal
  356. #define CMPBGE_FUNC     0x0F    // Compare 8 Unsigned Bytes Greater Than or Equal
  357.  
  358. #define ADDL_FUNC_STR     "addl"
  359. #define ADDLV_FUNC_STR    "addl/v"
  360. #define S4ADDL_FUNC_STR   "s4addl"
  361. #define S8ADDL_FUNC_STR   "s8addl"
  362.  
  363. #define ADDQ_FUNC_STR     "addq"
  364. #define ADDQV_FUNC_STR    "addq/v"
  365. #define S4ADDQ_FUNC_STR   "s4addq"
  366. #define S8ADDQ_FUNC_STR   "s8addq"
  367.  
  368. #define SUBL_FUNC_STR     "subl"
  369. #define SUBLV_FUNC_STR    "subl/v"
  370. #define S4SUBL_FUNC_STR   "s4subl"
  371. #define S8SUBL_FUNC_STR   "s8subl"
  372.  
  373. #define SUBQ_FUNC_STR     "subq"
  374. #define SUBQV_FUNC_STR    "subq/v"
  375. #define S4SUBQ_FUNC_STR   "s4subq"
  376. #define S8SUBQ_FUNC_STR   "s8subq"
  377.  
  378. #define CMPEQ_FUNC_STR    "cmpeq"
  379. #define CMPLT_FUNC_STR    "cmplt"
  380. #define CMPLE_FUNC_STR    "cmple"
  381. #define CMPULT_FUNC_STR   "cmpult"
  382. #define CMPULE_FUNC_STR   "cmpule"
  383. #define CMPBGE_FUNC_STR   "cmpbge"
  384.  
  385. //
  386. // Bit and conditional operate function codes (in Function, Opcode 11, BIT_OP).
  387. //
  388.  
  389. #define AND_FUNC        0x00    // Logical Product
  390. #define BIC_FUNC        0x08    // Logical Product with Complement
  391. #define BIS_FUNC        0x20    // Logical Sum (OR)
  392. #define EQV_FUNC        0x48    // Logical Equivalence (XORNOT)
  393. #define ORNOT_FUNC      0x28    // Logical Sum with Complement
  394. #define XOR_FUNC        0x40    // Logical Difference
  395.  
  396. #define CMOVEQ_FUNC     0x24    // CMOVE if Register Equal to Zero
  397. #define CMOVGE_FUNC     0x46    // CMOVE if Register Greater Than or Equal to Zero
  398. #define CMOVGT_FUNC     0x66    // CMOVE if Register Greater Than Zero
  399. #define CMOVLBC_FUNC    0x16    // CMOVE if Register Low Bit Clear
  400. #define CMOVLBS_FUNC    0x14    // CMOVE if Register Low Bit Set
  401. #define CMOVLE_FUNC     0x64    // CMOVE if Register Less Than or Equal to Zero
  402. #define CMOVLT_FUNC     0x44    // CMOVE if Register Less Than Zero
  403. #define CMOVNE_FUNC     0x26    // CMOVE if Register Not Equal to Zero
  404.  
  405. #define AND_FUNC_STR       "and"
  406. #define BIC_FUNC_STR       "bic"
  407. #define BIS_FUNC_STR       "bis"
  408. #define EQV_FUNC_STR       "eqv"
  409. #define ORNOT_FUNC_STR     "ornot"
  410. #define XOR_FUNC_STR       "xor"
  411.  
  412. #define CMOVEQ_FUNC_STR    "cmoveq"
  413. #define CMOVGE_FUNC_STR    "cmovge"
  414. #define CMOVGT_FUNC_STR    "cmovgt"
  415. #define CMOVLBC_FUNC_STR   "cmovlbc"
  416. #define CMOVLBS_FUNC_STR   "cmovlbs"
  417. #define CMOVLE_FUNC_STR    "cmovle"
  418. #define CMOVLT_FUNC_STR    "cmovlt"
  419. #define CMOVNE_FUNC_STR    "cmovne"
  420.  
  421. //
  422. // Shift and byte operate function codes (in Function, Opcode 12, BYTE_OP).
  423. //
  424.  
  425. #define SLL_FUNC        0x39    // Shift Left Logical
  426. #define SRL_FUNC        0x34    // Shift Right Logical
  427. #define SRA_FUNC        0x3C    // Shift Right Arithmetic
  428.  
  429. #define EXTBL_FUNC      0x06    // Extract Byte Low
  430. #define EXTWL_FUNC      0x16    // Extract Word Low
  431. #define EXTLL_FUNC      0x26    // Extract Longword Low
  432. #define EXTQL_FUNC      0x36    // Extract Quadword Low
  433. #define EXTWH_FUNC      0x5A    // Extract Word High
  434. #define EXTLH_FUNC      0x6A    // Extract Longword High
  435. #define EXTQH_FUNC      0x7A    // Extract Quadword High
  436.  
  437. #define INSBL_FUNC      0x0B    // Insert Byte Low
  438. #define INSWL_FUNC      0x1B    // Insert Word Low
  439. #define INSLL_FUNC      0x2B    // Insert Longword Low
  440. #define INSQL_FUNC      0x3B    // Quadword Low
  441. #define INSWH_FUNC      0x57    // Insert Word High
  442. #define INSLH_FUNC      0x67    // Insert Longword High
  443. #define INSQH_FUNC      0x77    // Insert Quadword High
  444.  
  445. #define MSKBL_FUNC      0x02    // Mask Byte Low
  446. #define MSKWL_FUNC      0x12    // Mask Word Low
  447. #define MSKLL_FUNC      0x22    // Mask Longword Low
  448. #define MSKQL_FUNC      0x32    // Mask Quadword Low
  449. #define MSKWH_FUNC      0x52    // Mask Word High
  450. #define MSKLH_FUNC      0x62    // Mask Longword High
  451. #define MSKQH_FUNC      0x72    // Mask Quadword High
  452.  
  453. #define ZAP_FUNC        0x30    // Zero Bytes
  454. #define ZAPNOT_FUNC     0x31    // Zero Bytes Not
  455.  
  456. #define SLL_FUNC_STR    "sll"
  457. #define SRL_FUNC_STR    "srl"
  458. #define SRA_FUNC_STR    "sra"
  459.  
  460. #define EXTBL_FUNC_STR  "extbl"
  461. #define EXTWL_FUNC_STR  "extwl"
  462. #define EXTLL_FUNC_STR  "extll"
  463. #define EXTQL_FUNC_STR  "extql"
  464. #define EXTWH_FUNC_STR  "extwh"
  465. #define EXTLH_FUNC_STR  "extlh"
  466. #define EXTQH_FUNC_STR  "extqh"
  467.  
  468. #define INSBL_FUNC_STR  "insbl"
  469. #define INSWL_FUNC_STR  "inswl"
  470. #define INSLL_FUNC_STR  "insll"
  471. #define INSQL_FUNC_STR  "insql"
  472. #define INSWH_FUNC_STR  "inswh"
  473. #define INSLH_FUNC_STR  "inslh"
  474. #define INSQH_FUNC_STR  "insqh"
  475.  
  476. #define MSKBL_FUNC_STR  "mskbl"
  477. #define MSKWL_FUNC_STR  "mskwl"
  478. #define MSKLL_FUNC_STR  "mskll"
  479. #define MSKQL_FUNC_STR  "mskql"
  480. #define MSKWH_FUNC_STR  "mskwh"
  481. #define MSKLH_FUNC_STR  "msklh"
  482. #define MSKQH_FUNC_STR  "mskqh"
  483.  
  484. #define ZAP_FUNC_STR    "zap"
  485. #define ZAPNOT_FUNC_STR "zapnot"
  486.  
  487. //
  488. // Integer multiply operate function codes (in Function, Opcode 13, MUL_OP).
  489. //
  490.  
  491. #define MULL_FUNC       0x00    // Multiply Longword
  492. #define MULLV_FUNC      0x40    // Multiply Longword, Integer Overflow Enable
  493. #define MULQ_FUNC       0x20    // Multiply Quadword
  494. #define MULQV_FUNC      0x60    // Multiply Quadword, Integer Overflow Enable
  495. #define UMULH_FUNC      0x30    // Unsinged Multiply Quadword High
  496.  
  497. #define MULL_FUNC_STR   "mull"
  498. #define MULLV_FUNC_STR  "mull/v"
  499. #define MULQ_FUNC_STR   "mulq"
  500. #define MULQV_FUNC_STR  "mulq/v"
  501. #define UMULH_FUNC_STR  "umulh"
  502.  
  503. //
  504. // Type (7) Floating-point Operate Instruction Format.
  505. // Type (8) Floating-point Convert Instruction Format.
  506. //
  507. // Type 6 and 7 are the same, except for type 7
  508. //      Fc == F31 (1s) and Fb is the source.
  509. //
  510. //  3         2 2       2 2       1 1
  511. //  1         6 5       1 0       6 5                   5 4       0
  512. // +-----------+---------+---------+---------------------+---------+
  513. // |   opcode  |   Fa    |   Fb    |      function       |   Fc    |
  514. // +-----------+---------+---------+---------------------+---------+
  515. //
  516.  
  517. typedef struct _Alpha_FpOp_Format {
  518.         ULONG Fc : 5;
  519.         ULONG Function : 11;
  520.         ULONG Fb : 5;
  521.         ULONG Fa : 5;
  522.         ULONG Opcode : 6;
  523. } Alpha_FpOp_Format;
  524.  
  525. //
  526. // Format independent function codes (in Function, Opcode 17)
  527. //
  528.  
  529. #define CVTLQ_FUNC      0x010
  530. #define CPYS_FUNC       0x020
  531. #define CPYSN_FUNC      0x021
  532. #define CPYSE_FUNC      0x022
  533. #define MT_FPCR_FUNC    0x024
  534. #define MF_FPCR_FUNC    0x025
  535. #define FCMOVEQ_FUNC    0x02A
  536. #define FCMOVNE_FUNC    0x02B
  537. #define FCMOVLT_FUNC    0x02C
  538. #define FCMOVGE_FUNC    0x02D
  539. #define FCMOVLE_FUNC    0x02E
  540. #define FCMOVGT_FUNC    0x02F
  541. #define CVTQL_FUNC      0x030
  542. #define CVTQLV_FUNC     0x130
  543. #define CVTQLSV_FUNC    0x530
  544.  
  545. #define CVTLQ_FUNC_STR      "cvtlq"
  546. #define CPYS_FUNC_STR       "cpys"
  547. #define CPYSN_FUNC_STR      "cpysn"
  548. #define CPYSE_FUNC_STR      "cpyse"
  549. #define MT_FPCR_FUNC_STR    "mt_fpcr"
  550. #define MF_FPCR_FUNC_STR    "mf_fpcr"
  551. #define FCMOVEQ_FUNC_STR    "fcmoveq"
  552. #define FCMOVNE_FUNC_STR    "fcmovne"
  553. #define FCMOVLT_FUNC_STR    "fcmovlt"
  554. #define FCMOVGE_FUNC_STR    "fcmovge"
  555. #define FCMOVLE_FUNC_STR    "fcmovle"
  556. #define FCMOVGT_FUNC_STR    "fcmovgt"
  557. #define CVTQL_FUNC_STR      "cvtql"
  558. #define CVTQLV_FUNC_STR     "cvtql/v"
  559. #define CVTQLSV_FUNC_STR    "cvtql/sv"
  560.  
  561. //
  562. // IEEE function codes without flags (in Function, Opcode 16).
  563. //
  564.  
  565. #define MSK_FP_OP       0x03F
  566.  
  567. #define ADDS_FUNC       0x000
  568. #define SUBS_FUNC       0x001
  569. #define MULS_FUNC       0x002
  570. #define DIVS_FUNC       0x003
  571. #define ADDT_FUNC       0x020
  572. #define SUBT_FUNC       0x021
  573. #define MULT_FUNC       0x022
  574. #define DIVT_FUNC       0x023
  575. #define CMPTUN_FUNC     0x024
  576. #define CMPTEQ_FUNC     0x025
  577. #define CMPTLT_FUNC     0x026
  578. #define CMPTLE_FUNC     0x027
  579. #define CVTTS_FUNC      0x02C
  580. #define CVTTQ_FUNC      0x02F
  581. #define CVTQS_FUNC      0x03C
  582. #define CVTQT_FUNC      0x03E
  583.  
  584. #define ADDS_FUNC_STR       "adds"
  585. #define SUBS_FUNC_STR       "subs"
  586. #define MULS_FUNC_STR       "muls"
  587. #define DIVS_FUNC_STR       "divs"
  588. #define ADDT_FUNC_STR       "addt"
  589. #define SUBT_FUNC_STR       "subt"
  590. #define MULT_FUNC_STR       "mult"
  591. #define DIVT_FUNC_STR       "divt"
  592. #define CMPTUN_FUNC_STR     "cmptun"
  593. #define CMPTEQ_FUNC_STR     "cmpteq"
  594. #define CMPTLT_FUNC_STR     "cmptlt"
  595. #define CMPTLE_FUNC_STR     "cmptle"
  596. #define CVTTS_FUNC_STR      "cvtts"
  597. #define CVTTQ_FUNC_STR      "cvttq"
  598. #define CVTQS_FUNC_STR      "cvtqs"
  599. #define CVTQT_FUNC_STR      "cvtqt"
  600.  
  601. //
  602. // CVTST is a little different.
  603. //
  604.  
  605. #define CVTST_FUNC      0x2AC
  606. #define CVTST_S_FUNC    0x6AC
  607.  
  608. #define CVTST_FUNC_STR      "cvtst"
  609. #define CVTST_S_FUNC_STR    "cvtst/s"
  610.  
  611. //
  612. // VAX function codes without flags (in Function, Opcode 15).
  613. //
  614.  
  615. #define ADDF_FUNC       0x000
  616. #define CVTDG_FUNC      0x01E
  617. #define ADDG_FUNC       0x020
  618. #define CMPGEQ_FUNC     0x025
  619. #define CMPGLT_FUNC     0x026
  620. #define CMPGLE_FUNC     0x027
  621. #define CVTGF_FUNC      0x02C
  622. #define CVTGD_FUNC      0x02D
  623. #define CVTQF_FUNC      0x03C
  624. #define CVTQG_FUNC      0x03E
  625. #define DIVF_FUNC       0x003
  626. #define DIVG_FUNC       0x023
  627. #define MULF_FUNC       0x002
  628. #define MULG_FUNC       0x022
  629. #define SUBF_FUNC       0x001
  630. #define SUBG_FUNC       0x021
  631. #define CVTGQ_FUNC      0x03F
  632.  
  633. #define ADDF_FUNC_STR       "addf"
  634. #define CVTDG_FUNC_STR      "cvtdg"
  635. #define ADDG_FUNC_STR       "addg"
  636. #define CMPGEQ_FUNC_STR     "cmpgeq"
  637. #define CMPGLT_FUNC_STR     "cmpglt"
  638. #define CMPGLE_FUNC_STR     "cmpgle"
  639. #define CVTGF_FUNC_STR      "cvtgf"
  640. #define CVTGD_FUNC_STR      "cvtgd"
  641. #define CVTQF_FUNC_STR      "cvtqf"
  642. #define CVTQG_FUNC_STR      "cvtqg"
  643. #define DIVF_FUNC_STR       "divf"
  644. #define DIVG_FUNC_STR       "divg"
  645. #define MULF_FUNC_STR       "mulf"
  646. #define MULG_FUNC_STR       "mulg"
  647. #define SUBF_FUNC_STR       "subf"
  648. #define SUBG_FUNC_STR       "subg"
  649. #define CVTGQ_FUNC_STR      "cvtgq"
  650.  
  651. //
  652. // Define subfields within the 11 bit IEEE floating operate function field.
  653. //
  654.  
  655. #define FP_FUNCTION_MASK      0x03F     // Function code including format
  656.  
  657. //
  658. // Define the 2 bit format field.
  659. //
  660.  
  661. #define FP_FORMAT_MASK        0x030
  662. #define FP_FORMAT_S           0x000     // Single (32 bit floating)
  663. #define FP_FORMAT_X           0x010     // Extended (128 bit floating)
  664. #define FP_FORMAT_T           0x020     // Double (64 bit floating)
  665. #define FP_FORMAT_Q           0x030     // Quad (64 bit integer)
  666. #define FP_FORMAT_SHIFT       4
  667.  
  668. //
  669. // Define the 2 bit rounding mode field.
  670. //
  671.  
  672. #define FP_ROUND_MASK         0x0C0
  673. #define FP_ROUND_C            0x000     // Chopped
  674. #define FP_ROUND_M            0x040     // Minus Infinity
  675. #define FP_ROUND_N            0x080     // Nearest
  676. #define FP_ROUND_D            0x0C0     // Dynamic
  677. #define FP_ROUND_SHIFT        6
  678.  
  679. //
  680. // Define the 3 bit trap enable field.
  681. //
  682.  
  683. #define FP_TRAP_ENABLE_MASK   0x700
  684. #define FP_TRAP_ENABLE_NONE   0x000
  685. #define FP_TRAP_ENABLE_U      0x100     // Underflow
  686. #define FP_TRAP_ENABLE_I      0x200     // Inexact
  687.  
  688. #define FP_TRAP_ENABLE_S      0x400     // Software Completion
  689. #define FP_TRAP_ENABLE_SU     0x500
  690. #define FP_TRAP_ENABLE_SUI    0x700
  691.  
  692. #define FP_TRAP_ENABLE_V      0x100     // Integer Overflow
  693. #define FP_TRAP_ENABLE_SV     0x500
  694. #define FP_TRAP_ENABLE_SVI    0x700
  695.  
  696. #define FP_TRAP_ENABLE_SHIFT  8
  697.  
  698. //
  699. // VAX and IEEE function flags (or'd with VAX and IEEE function code)
  700. //
  701.  
  702. #define MSK_FP_FLAGS    0x7C0
  703.  
  704. #define C_FLAGS         0x000
  705. #define M_FLAGS         0x040
  706. #define NONE_FLAGS      0x080
  707. #define D_FLAGS         0x0C0
  708. #define UC_FLAGS        0x100
  709. #define VC_FLAGS        0x100
  710. #define UM_FLAGS        0x140
  711. #define VM_FLAGS        0x140
  712. #define U_FLAGS         0x180
  713. #define V_FLAGS         0x180
  714. #define UD_FLAGS        0x1C0
  715. #define VD_FLAGS        0x1C0
  716. #define SC_FLAGS        0x400
  717. #define S_FLAGS         0x480
  718. #define SUC_FLAGS       0x500
  719. #define SVC_FLAGS       0x500
  720. #define SUM_FLAGS       0x540
  721. #define SVM_FLAGS       0x540
  722. #define SU_FLAGS        0x580
  723. #define SV_FLAGS        0x580
  724. #define SUD_FLAGS       0x5C0
  725. #define SVD_FLAGS       0x5C0
  726. #define SUIC_FLAGS      0x700
  727. #define SVIC_FLAGS      0x700
  728. #define SUIM_FLAGS      0x740
  729. #define SVIM_FLAGS      0x740
  730. #define SUI_FLAGS       0x780
  731. #define SVI_FLAGS       0x780
  732. #define SUID_FLAGS      0x7C0
  733. #define SVID_FLAGS      0x7C0
  734.  
  735. #define C_FLAGS_STR       "/c"
  736. #define M_FLAGS_STR       "/m"
  737. #define NONE_FLAGS_STR    ""
  738. #define D_FLAGS_STR       "/d"
  739. #define UC_FLAGS_STR      "/uc"
  740. #define VC_FLAGS_STR      "/vc"
  741. #define UM_FLAGS_STR      "/um"
  742. #define VM_FLAGS_STR      "/vm"
  743. #define U_FLAGS_STR       "/u"
  744. #define V_FLAGS_STR       "/v"
  745. #define UD_FLAGS_STR      "/ud"
  746. #define VD_FLAGS_STR      "/vd"
  747. #define SC_FLAGS_STR      "/sc"
  748. #define S_FLAGS_STR       "/s"
  749. #define SUC_FLAGS_STR     "/suc"
  750. #define SVC_FLAGS_STR     "/svc"
  751. #define SUM_FLAGS_STR     "/sum"
  752. #define SVM_FLAGS_STR     "/svm"
  753. #define SU_FLAGS_STR      "/su"
  754. #define SV_FLAGS_STR      "/sv"
  755. #define SUD_FLAGS_STR     "/sud"
  756. #define SVD_FLAGS_STR     "/svd"
  757. #define SUIC_FLAGS_STR    "/suic"
  758. #define SVIC_FLAGS_STR    "/svic"
  759. #define SUIM_FLAGS_STR    "/suim"
  760. #define SVIM_FLAGS_STR    "/svim"
  761. #define SUI_FLAGS_STR     "/sui"
  762. #define SVI_FLAGS_STR     "/svi"
  763. #define SUID_FLAGS_STR    "/suid"
  764. #define SVID_FLAGS_STR    "/svid"
  765.  
  766. //
  767. // Type (9) PALcode Instruction Format.
  768. //
  769. //  3         2 2
  770. //  1         6 5                                                 0
  771. // +-----------+---------------------------------------------------+
  772. // |   opcode  |                  PALcode func                     |
  773. // +-----------+---------------------------------------------------+
  774. //
  775.  
  776. typedef struct _Alpha_PAL_Format {
  777.         ULONG Function : 26;
  778.         ULONG Opcode : 6;
  779. } Alpha_PAL_Format;
  780.  
  781. //
  782. // Call to PAL function codes (in Function, Opcode 0, CALLPAL_OP).
  783. //
  784. // N.B. - if new call pal functions are added, they must also be added
  785. // in genalpha.c, genalpha.c will generate the include file for .s files
  786. // that will define the call pal mnemonics for assembly language use
  787. //
  788.  
  789. #define PRIV_PAL_FUNC 0x0
  790. #define UNPRIV_PAL_FUNC 0x80
  791.  
  792.  
  793. //
  794. // Unprivileged call pal functions.
  795. //
  796.  
  797. #define BPT_FUNC       (UNPRIV_PAL_FUNC | 0x00)
  798. #define CALLSYS_FUNC   (UNPRIV_PAL_FUNC | 0x03)
  799. #define IMB_FUNC       (UNPRIV_PAL_FUNC | 0x06)
  800. #define GENTRAP_FUNC   (UNPRIV_PAL_FUNC | 0xAA)
  801. #define RDTEB_FUNC     (UNPRIV_PAL_FUNC | 0xAB)
  802. #define KBPT_FUNC      (UNPRIV_PAL_FUNC | 0xAC)
  803. #define CALLKD_FUNC    (UNPRIV_PAL_FUNC | 0xAD)
  804.  
  805. #define BPT_FUNC_STR       "bpt"
  806. #define CALLSYS_FUNC_STR   "callsys"
  807. #define IMB_FUNC_STR       "imb"
  808. #define RDTEB_FUNC_STR     "rdteb"
  809. #define GENTRAP_FUNC_STR   "gentrap"
  810. #define KBPT_FUNC_STR      "kbpt"
  811. #define CALLKD_FUNC_STR    "callkd"
  812.  
  813. //
  814. // Priveleged call pal functions.
  815. //
  816.  
  817. #define HALT_FUNC       (PRIV_PAL_FUNC | 0x00)
  818. #define RESTART_FUNC    (PRIV_PAL_FUNC | 0x01)
  819. #define DRAINA_FUNC     (PRIV_PAL_FUNC | 0x02)
  820. #define REBOOT_FUNC     (PRIV_PAL_FUNC | 0x03)
  821. #define INITPAL_FUNC    (PRIV_PAL_FUNC | 0x04)
  822. #define WRENTRY_FUNC    (PRIV_PAL_FUNC | 0x05)
  823. #define SWPIRQL_FUNC    (PRIV_PAL_FUNC | 0x06)
  824. #define RDIRQL_FUNC     (PRIV_PAL_FUNC | 0x07)
  825. #define DI_FUNC         (PRIV_PAL_FUNC | 0X08)
  826. #define EI_FUNC         (PRIV_PAL_FUNC | 0x09)
  827. #define SWPPAL_FUNC     (PRIV_PAL_FUNC | 0x0A)
  828. #define SSIR_FUNC       (PRIV_PAL_FUNC | 0x0C)
  829. #define CSIR_FUNC       (PRIV_PAL_FUNC | 0x0D)
  830. #define RFE_FUNC        (PRIV_PAL_FUNC | 0x0E)
  831. #define RETSYS_FUNC     (PRIV_PAL_FUNC | 0x0F)
  832. #define SWPCTX_FUNC     (PRIV_PAL_FUNC | 0x10)
  833. #define SWPPROCESS_FUNC (PRIV_PAL_FUNC | 0x11)
  834. #define RDMCES_FUNC     (PRIV_PAL_FUNC | 0x12)
  835. #define WRMCES_FUNC     (PRIV_PAL_FUNC | 0x13)
  836. #define TBIA_FUNC       (PRIV_PAL_FUNC | 0x14)
  837. #define TBIS_FUNC       (PRIV_PAL_FUNC | 0x15)
  838. #define DTBIS_FUNC      (PRIV_PAL_FUNC | 0x16)
  839. #define TBISASN_FUNC    (PRIV_PAL_FUNC | 0x17)
  840. #define RDKSP_FUNC      (PRIV_PAL_FUNC | 0x18)
  841. #define SWPKSP_FUNC     (PRIV_PAL_FUNC | 0x19)
  842. #define RDPSR_FUNC      (PRIV_PAL_FUNC | 0x1A)
  843. #define RDPCR_FUNC      (PRIV_PAL_FUNC | 0x1C)
  844. #define RDTHREAD_FUNC   (PRIV_PAL_FUNC | 0x1E)
  845. #define TBIM_FUNC       (PRIV_PAL_FUNC | 0x20)
  846. #define TBIMASN_FUNC    (PRIV_PAL_FUNC | 0x21)
  847. #define RDCOUNTERS_FUNC (PRIV_PAL_FUNC | 0x30)
  848. #define RDSTATE_FUNC    (PRIV_PAL_FUNC | 0x31)
  849. #define WRPERFMON_FUNC  (PRIV_PAL_FUNC | 0x32)
  850.  
  851. #define HALT_FUNC_STR       "halt"
  852. #define RESTART_FUNC_STR    "restart"
  853. #define DRAINA_FUNC_STR     "draina"
  854. #define REBOOT_FUNC_STR     "reboot"
  855. #define INITPAL_FUNC_STR    "initpal"
  856. #define WRENTRY_FUNC_STR    "wrentry"
  857. #define SWPIRQL_FUNC_STR    "swpirql"
  858. #define RDIRQL_FUNC_STR     "rdirql"
  859. #define DI_FUNC_STR         "di"
  860. #define EI_FUNC_STR         "ei"
  861. #define SWPPAL_FUNC_STR     "swppal"
  862. #define SSIR_FUNC_STR       "ssir"
  863. #define CSIR_FUNC_STR       "csir"
  864. #define RFE_FUNC_STR        "rfe"
  865. #define RETSYS_FUNC_STR     "retsys"
  866. #define SWPCTX_FUNC_STR     "swpctx"
  867. #define SWPPROCESS_FUNC_STR "swpprocess"
  868. #define RDMCES_FUNC_STR     "rdmces"
  869. #define WRMCES_FUNC_STR     "wrmces"
  870. #define TBIA_FUNC_STR       "tbia"
  871. #define TBIS_FUNC_STR       "tbis"
  872. #define DTBIS_FUNC_STR      "dtbis"
  873. #define TBISASN_FUNC_STR    "tbisasn"
  874. #define RDKSP_FUNC_STR      "rdksp"
  875. #define SWPKSP_FUNC_STR     "swpksp"
  876. #define RDPSR_FUNC_STR      "rdpsr"
  877. #define RDPCR_FUNC_STR      "rdpcr"
  878. #define RDTHREAD_FUNC_STR   "rdthread"
  879. #define TBIM_FUNC_STR       "tbim"
  880. #define TBIMASN_FUNC_STR    "tbimasn"
  881. #define RDCOUNTERS_FUNC_STR "rdcounters"
  882. #define RDSTATE_FUNC_STR    "rdstate"
  883. #define WRPERFMON_FUNC_STR "wrperfmon"
  884.  
  885. //
  886. // 21064 (ev4) - specific call pal functions.
  887. //
  888.  
  889. #define INITPCR_FUNC    (PRIV_PAL_FUNC | 0x38)
  890.  
  891. #define INITPCR_FUNC_STR   "initpcr"
  892.  
  893. //
  894. // Type (10) EV4 MTPR/MFPR PAL mode instructions.
  895. //
  896. //  3         2 2       2 2       1 1
  897. //  1         6 5       1 0       6 5             8 7 6 5 4       0
  898. // +-----------+---------+---------+---------------+-+-+-+---------+
  899. // |   opcode  |   Ra    |   Rb    |      IGN      |P|A|I|  Index  |
  900. // +-----------+---------+---------+---------------+-+-+-+---------+
  901. //
  902.  
  903. typedef struct _Alpha_EV4_PR_Format {
  904.         ULONG Index : 5;
  905.         ULONG Ibox : 1;
  906.         ULONG Abox : 1;
  907.         ULONG PalTemp : 1;
  908.         ULONG IGN : 8;
  909.         ULONG Rb : 5;
  910.         ULONG Ra : 5;
  911.         ULONG Opcode : 6;
  912. } Alpha_EV4_PR_Format;
  913.  
  914. //
  915. // Type (10) EV5 MTPR/MFPR PAL mode instructions.
  916. //
  917. //  3         2 2       2 2       1 1
  918. //  1         6 5       1 0       6 5                              0
  919. // +-----------+---------+---------+-------------------------------+
  920. // |   opcode  |   Ra    |   Rb    |            Index              | 
  921. // +-----------+---------+---------+-------------------------------+
  922. //
  923.  
  924. typedef struct _Alpha_EV5_PR_Format {
  925.         ULONG Index : 16;
  926.         ULONG Rb : 5;
  927.         ULONG Ra : 5;
  928.         ULONG Opcode : 6;
  929. } Alpha_EV5_PR_Format;
  930.  
  931. #define MTPR_OP       0x1D
  932. #define MFPR_OP       0x19
  933.  
  934. #define MTPR_OP_STR   "mt"
  935. #define MFPR_OP_STR   "mf"
  936.  
  937. //
  938. // Type (11) EV4 special memory PAL mode access.
  939. //
  940. //  3         2 2       2 2       1 1 1 1 1 1
  941. //  1         6 5       1 0       6 5 4 3 2 1                     0
  942. // +-----------+---------+---------+-+-+-+-+-----------------------+
  943. // |   opcode  |   Ra    |   Rb    |P|A|R|Q|         Disp          |
  944. // +-----------+---------+---------+-+-+-+-+-----------------------+
  945. //
  946.  
  947. typedef struct _Alpha_EV4_MEM_Format {
  948.         ULONG Disp : 12;
  949.         ULONG QuadWord : 1;
  950.         ULONG RWcheck : 1;
  951.         ULONG Alt : 1;
  952.         ULONG Physical : 1;
  953.         ULONG Rb : 5;
  954.         ULONG Ra : 5;
  955.         ULONG Opcode : 6;
  956. } Alpha_EV4_MEM_Format;
  957.  
  958. //
  959. // Type (11) EV5 special memory PAL mode access.
  960. //
  961. //  3         2 2       2 2       1 1 1 1 1 1
  962. //  1         6 5       1 0       6 5 4 3 2 1                     0
  963. // +-----------+---------+---------+-+-+-+-+-----------------------+
  964. // |   opcode  |   Ra    |   Rb    |P|A|R|Q|         Disp          |
  965. // +-----------+---------+---------+-+-+-+-+-----------------------+
  966. //
  967.  
  968. typedef struct _Alpha_EV5_MEM_Format {
  969.         ULONG Disp : 10;
  970.         ULONG Lock_Cond: 1;
  971.         ULONG Vpte: 1;
  972.         ULONG QuadWord : 1;
  973.         ULONG RWcheck : 1;
  974.         ULONG Alt : 1;
  975.         ULONG Physical : 1;
  976.         ULONG Rb : 5;
  977.         ULONG Ra : 5;
  978.         ULONG Opcode : 6;
  979. } Alpha_EV5_MEM_Format;
  980.  
  981. #define HWLD_OP      0x1B
  982. #define HWST_OP      0x1F
  983.  
  984. #define HWLD_OP_STR  "hwld"
  985. #define HWST_OP_STR  "hwst"
  986.  
  987. // Type (12) EV4 PAL mode switch.
  988. //
  989. //  3         2 2       2 2       1 1 1 1
  990. //  1         6 5       1 0       6 5 4 3                         0
  991. // +-----------+---------+---------+-+-+---------------------------+
  992. // |   opcode  |   Ra    |   Rb    |1|0|          IGN              |
  993. // +-----------+---------+---------+-+-+---------------------------+
  994.  
  995. typedef struct _Alpha_EV4_REI_Format {
  996.         ULONG IGN : 14;
  997.         ULONG zero : 1;
  998.         ULONG one : 1;
  999.         ULONG Rb : 5;
  1000.         ULONG Ra : 5;
  1001.         ULONG Opcode : 6;
  1002. } Alpha_EV4_REI_Format;
  1003.  
  1004. // Type (12) EV5 PAL mode switch.
  1005. //
  1006. //  3         2 2       2 2       1 1 1 1
  1007. //  1         6 5       1 0       6 5 4 3                         0
  1008. // +-----------+---------+---------+-+-+---------------------------+
  1009. // |   opcode  |   Ra    |   Rb    |1|0|          IGN              |
  1010. // +-----------+---------+---------+-+-+---------------------------+
  1011.  
  1012. typedef struct _Alpha_EV5_REI_Format {
  1013.         ULONG IGN : 14;
  1014.         ULONG Type: 2;
  1015.         ULONG Rb : 5;
  1016.         ULONG Ra : 5;
  1017.         ULONG Opcode : 6;
  1018. } Alpha_EV5_REI_Format;
  1019.  
  1020. #define REI_OP    0x1E
  1021.  
  1022. #define REI_OP_STR  "rei"
  1023.  
  1024. //
  1025. //
  1026. //
  1027. typedef union _Alpha_Instruction {
  1028.         ULONG Long;
  1029.         UCHAR Byte[4];
  1030.  
  1031.         Alpha_Memory_Format Memory;
  1032.         Alpha_Jump_Format Jump;
  1033.         Alpha_Branch_Format Branch;
  1034.         Alpha_OpReg_Format OpReg;
  1035.         Alpha_OpLit_Format OpLit;
  1036.         Alpha_FpOp_Format FpOp;
  1037.         Alpha_PAL_Format Pal;
  1038.         Alpha_EV4_PR_Format EV4_PR;
  1039.         Alpha_EV4_MEM_Format EV4_MEM;
  1040.         Alpha_EV4_REI_Format EV4_REI;
  1041.         Alpha_EV5_PR_Format EV5_PR;
  1042.         Alpha_EV5_MEM_Format EV5_MEM;
  1043.         Alpha_EV5_REI_Format EV5_REI;
  1044. } ALPHA_INSTRUCTION, *PALPHA_INSTRUCTION;
  1045.  
  1046. //
  1047. // Define standard integer register assignments.
  1048. //
  1049.  
  1050. #define V0_REG      0       // v0 - return value register
  1051.  
  1052. #define T0_REG      1       // t0 - temporary register
  1053. #define T1_REG      2       // t1 - temporary register
  1054. #define T2_REG      3       // t2 - temporary register
  1055. #define T3_REG      4       // t3 - temporary register
  1056. #define T4_REG      5       // t4 - temporary register
  1057. #define T5_REG      6       // t5 - temporary register
  1058. #define T6_REG      7       // t6 - temporary register
  1059. #define T7_REG      8       // t7 - temporary register
  1060.  
  1061. #define S0_REG      9       // s0 - saved register
  1062. #define S1_REG      10      // s1 - saved register
  1063. #define S2_REG      11      // s2 - saved register
  1064. #define S3_REG      12      // s3 - saved register
  1065. #define S4_REG      13      // s4 - saved register
  1066. #define S5_REG      14      // s5 - saved register
  1067.  
  1068. #define S6_REG      15      // s6 - saved register, aka fp
  1069. #define FP_REG      15      // fp - frame pointer register
  1070.  
  1071. #define A0_REG      16      // a0 - argument register
  1072. #define A1_REG      17      // a1 - argument register
  1073. #define A2_REG      18      // a2 - argument register
  1074. #define A3_REG      19      // a3 - argument register
  1075. #define A4_REG      20      // a4 - argument register
  1076. #define A5_REG      21      // a5 - argument register
  1077.  
  1078. #define T8_REG      22      // t8 - temporary register
  1079. #define T9_REG      23      // t9 - temporary register
  1080. #define T10_REG     24      // t10 - temporary register
  1081. #define T11_REG     25      // t11 - temporary register
  1082.  
  1083. #define RA_REG      26      // ra - return address register
  1084. #define T12_REG     27      // t12 - temporary register
  1085. #define AT_REG      28      // at - assembler temporary register
  1086. #define GP_REG      29      // gp - global pointer register
  1087. #define SP_REG      30      // sp - stack pointer register
  1088. #define ZERO_REG    31      // zero - zero register
  1089.  
  1090. //
  1091. // Define standard floating point register assignments.
  1092. //
  1093.  
  1094. #define F0_REG      0       // floating return value register (real)
  1095. #define F1_REG      1       // floating return value register (imaginary)
  1096. #define F16_REG     16      // floating argument register
  1097. #define FZERO_REG   31      // floating zero register
  1098.  
  1099. //
  1100. //  Define standard integer register strings
  1101. //
  1102.  
  1103. #define V0_REG_STR      "v0"     // - return value register
  1104.  
  1105. #define T0_REG_STR      "t0"     // - temporary register
  1106. #define T1_REG_STR      "t1"     // - temporary register
  1107. #define T2_REG_STR      "t2"     // - temporary register
  1108. #define T3_REG_STR      "t3"     // - temporary register
  1109. #define T4_REG_STR      "t4"     // - temporary register
  1110. #define T5_REG_STR      "t5"     // - temporary register
  1111. #define T6_REG_STR      "t6"     // - temporary register
  1112. #define T7_REG_STR      "t7"     // - temporary register
  1113.  
  1114. #define S0_REG_STR      "s0"     // - saved register
  1115. #define S1_REG_STR      "s1"     // - saved register
  1116. #define S2_REG_STR      "s2"     // - saved register
  1117. #define S3_REG_STR      "s3"     // - saved register
  1118. #define S4_REG_STR      "s4"     // - saved register
  1119. #define S5_REG_STR      "s5"     // - saved register
  1120.  
  1121. #define S6_REG_STR      "s6"     // - saved register, aka fp
  1122. #define FP_REG_STR      "fp"     // - frame pointer register
  1123.  
  1124. #define A0_REG_STR      "a0"     // - argument register
  1125. #define A1_REG_STR      "a1"     // - argument register
  1126. #define A2_REG_STR      "a2"     // - argument register
  1127. #define A3_REG_STR      "a3"     // - argument register
  1128. #define A4_REG_STR      "a4"     // - argument register
  1129. #define A5_REG_STR      "a5"     // - argument register
  1130.  
  1131. #define T8_REG_STR      "t8"     // - temporary register
  1132. #define T9_REG_STR      "t9"     // - temporary register
  1133. #define T10_REG_STR     "t10"    // - temporary register
  1134. #define T11_REG_STR     "t11"    // - temporary register
  1135.  
  1136. #define RA_REG_STR      "ra"     // - return address register
  1137. #define T12_REG_STR     "t12"    // - temporary register
  1138. #define AT_REG_STR      "at"     // - assembler temporary register
  1139. #define GP_REG_STR      "gp"     // - global pointer register
  1140. #define SP_REG_STR      "sp"     // - stack pointer register
  1141. #define ZERO_REG_STR    "zero"   // - zero register
  1142.  
  1143. //
  1144. // Define maximum and minimum single and double exponent values.
  1145. //
  1146.  
  1147. #define DOUBLE_MAXIMUM_EXPONENT 2047
  1148. #define DOUBLE_MINIMUM_EXPONENT 0
  1149.  
  1150. #define SINGLE_MAXIMUM_EXPONENT 255
  1151. #define SINGLE_MINIMUM_EXPONENT 0
  1152.  
  1153. //
  1154. // Define single and double exponent bias values.
  1155. //
  1156.  
  1157. #define SINGLE_EXPONENT_BIAS 127
  1158. #define DOUBLE_EXPONENT_BIAS 1023
  1159.  
  1160. //
  1161. // Define the largest single and double values.
  1162. //
  1163.  
  1164. #define SINGLE_MAXIMUM_VALUE 0x7f7fffff
  1165.  
  1166. #define DOUBLE_MAXIMUM_VALUE_HIGH 0x7fefffff
  1167. #define DOUBLE_MAXIMUM_VALUE_LOW 0xffffffff
  1168.  
  1169. //
  1170. // Define single and double quiet and signaling Nan values
  1171. // (these are identical to X86 formats; Mips is different).
  1172. //
  1173.  
  1174. #define SINGLE_QUIET_NAN_PREFIX 0x7fc00000
  1175. #define SINGLE_SIGNAL_NAN_PREFIX 0x7f800000
  1176. #define SINGLE_QUIET_NAN_VALUE 0xffc00000
  1177.  
  1178. #define DOUBLE_QUIET_NAN_PREFIX_HIGH 0x7ff80000
  1179. #define DOUBLE_SIGNAL_NAN_PREFIX_HIGH 0x7ff00000
  1180. #define DOUBLE_QUIET_NAN_VALUE_HIGH 0xfff80000
  1181. #define DOUBLE_QUIET_NAN_VALUE_LOW 0x0
  1182.  
  1183. //
  1184. // Define positive single and double infinity values.
  1185. //
  1186.  
  1187. #define SINGLE_INFINITY_VALUE 0x7f800000
  1188.  
  1189. #define DOUBLE_INFINITY_VALUE_HIGH 0x7ff00000
  1190. #define DOUBLE_INFINITY_VALUE_LOW 0x0
  1191.  
  1192. //
  1193. // Quadword versions of the above.
  1194. //
  1195.  
  1196. #define DOUBLE_MAXIMUM_VALUE        ((ULONGLONG)0x7fefffffffffffff)
  1197. #define DOUBLE_INFINITY_VALUE       ((ULONGLONG)0x7ff0000000000000)
  1198. #define DOUBLE_QUIET_NAN_VALUE      ((ULONGLONG)0xfff8000000000000)
  1199.  
  1200. //
  1201. // Define result values for IEEE floating point comparison operations.
  1202. // True is 2.0 and False is 0.0.
  1203. //
  1204.  
  1205. #define FP_COMPARE_TRUE             ((ULONGLONG)0x4000000000000000)
  1206. #define FP_COMPARE_FALSE            ((ULONGLONG)0x0000000000000000)
  1207.  
  1208. //
  1209. // Define Alpha AXP rounding modes.
  1210. //
  1211.  
  1212. #define ROUND_TO_ZERO 0                 // round toward zero
  1213. #define ROUND_TO_MINUS_INFINITY 1       // round toward minus infinity
  1214. #define ROUND_TO_NEAREST 2              // round to nearest representable value
  1215. #define ROUND_TO_PLUS_INFINITY 3        // round toward plus infinity
  1216.  
  1217. #endif // _ALPHAOPS_
  1218.