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

1259 lines
42 KiB

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