PageRenderTime 51ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/wcwp/bin/VC6CMD/Include/ALPHAOPS.H

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