Leaked source code of windows server 2003
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.

328 lines
12 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. mipsinst.h
  5. Abstract:
  6. Mips instruction and floating constant definitions.
  7. Author:
  8. David N. Cutler (davec) 8-May-1992
  9. Revision History:
  10. --*/
  11. #ifndef _MIPSINST_
  12. #define _MIPSINST_
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. //
  17. // Define MIPS instruction format structures.
  18. //
  19. typedef union _MIPS_INSTRUCTION {
  20. ULONG Long;
  21. UCHAR Byte[4];
  22. struct {
  23. ULONG Target : 26;
  24. ULONG Opcode : 6;
  25. } j_format;
  26. struct {
  27. LONG Simmediate : 16;
  28. ULONG Rt : 5;
  29. ULONG Rs : 5;
  30. ULONG Opcode : 6;
  31. } i_format;
  32. struct {
  33. ULONG Uimmediate : 16;
  34. ULONG Rt : 5;
  35. ULONG Rs : 5;
  36. ULONG Opcode : 6;
  37. } u_format;
  38. struct {
  39. ULONG Function : 6;
  40. ULONG Re : 5;
  41. ULONG Rd : 5;
  42. ULONG Rt : 5;
  43. ULONG Rs : 5;
  44. ULONG Opcode : 6;
  45. } r_format;
  46. struct {
  47. ULONG Function : 6;
  48. ULONG Re : 5;
  49. ULONG Rd : 5;
  50. ULONG Rt : 5;
  51. ULONG Format : 4;
  52. ULONG Fill1 : 1;
  53. ULONG Opcode : 6;
  54. } f_format;
  55. struct {
  56. ULONG Function : 6;
  57. ULONG Fd : 5;
  58. ULONG Fs : 5;
  59. ULONG Ft : 5;
  60. ULONG Format : 4;
  61. ULONG Fill1 : 1;
  62. ULONG Opcode : 6;
  63. } c_format;
  64. } MIPS_INSTRUCTION, *PMIPS_INSTRUCTION;
  65. //
  66. // Define MIPS instruction opcode values.
  67. //
  68. #define SPEC_OP 0x0 // special opcode - use function field
  69. #define BCOND_OP 0x1 // condition branch
  70. #define J_OP 0x2 // unconditional jump
  71. #define JAL_OP 0x3 // jump and link
  72. #define BEQ_OP 0x4 // branch equal
  73. #define BNE_OP 0x5 // branch not equal
  74. #define BLEZ_OP 0x6 // branch less than or equal
  75. #define BGTZ_OP 0x7 // branch greater than
  76. #define ADDI_OP 0x8 // add immediate signed integer
  77. #define ADDIU_OP 0x9 // add immediate unsigned integer
  78. #define SLTI_OP 0xa // set less than signed integer
  79. #define SLTIU_OP 0xb // set less than unsigned integer
  80. #define ANDI_OP 0xc // and unsigned immediate integer
  81. #define ORI_OP 0xd // or unsigned immediate integer
  82. #define XORI_OP 0xe // exclusive or unsigned immediate
  83. #define LUI_OP 0xf // load upper immediate integer
  84. #define COP0_OP 0x10 // coprocessor 0 operation
  85. #define COP1_OP 0x11 // coprocessor 1 operation
  86. #define BEQL_OP 0x14 // branch equal likely
  87. #define BNEL_OP 0x15 // branch not equal likely
  88. #define BLEZL_OP 0x16 // branch less than or equal likely
  89. #define BGTZL_OP 0x17 // branch greater than likely
  90. #define LDL_OP 0x1a // load double left integer
  91. #define LDR_OP 0x1b // load double right integer
  92. #define LB_OP 0x20 // load byte signed integer
  93. #define LH_OP 0x21 // load halfword signed integer
  94. #define LWL_OP 0x22 // load word left integer
  95. #define LW_OP 0x23 // load word integer
  96. #define LBU_OP 0x24 // load byte unsigned integer
  97. #define LHU_OP 0x25 // load halfword unsigned integer
  98. #define LWR_OP 0x26 // load word right integer
  99. #define LWU_OP 0x27 // load word unsigned integer
  100. #define SB_OP 0x28 // store byte integer
  101. #define SH_OP 0x29 // store halfword integer
  102. #define SWL_OP 0x2a // store word left integer
  103. #define SW_OP 0x2b // store word integer register
  104. #define SDL_OP 0x2c // store double left integer
  105. #define SDR_OP 0x2d // store double right integer
  106. #define SWR_OP 0x2e // store word right integer
  107. #define CACHE_OP 0x2f // cache operation
  108. #define LL_OP 0x30 // load linked integer register
  109. #define LWC1_OP 0x31 // load word floating
  110. #define LWC2_OP 0x32 // load word coprocessor 2
  111. #define LLD_OP 0x34 // load locked double integer
  112. #define LDC1_OP 0x35 // load word double floating
  113. #define LDC2_OP 0x36 // load double coprocessor 2
  114. #define LD_OP 0x37 // load double integer
  115. #define SC_OP 0x38 // store conditional word integer
  116. #define SWC1_OP 0x39 // store word floating
  117. #define SWC2_OP 0x3a // store double coprocessor 2
  118. #define SDC_OP 0x3c // store conditional double integer
  119. #define SDC1_OP 0x3d // store double floating
  120. #define SDC2_OP 0x3e // store double copreocessor 2
  121. #define SD_OP 0x3f // store double integer register
  122. //
  123. // Define special function subopcodes.
  124. //
  125. #define SLL_OP 0x0 // shift left logical integer
  126. #define SRL_OP 0x2 // shift right logical integer
  127. #define SRA_OP 0x3 // shift right arithmetic integer
  128. #define SLLV_OP 0x4 // shift left logical variable integer
  129. #define SRLV_OP 0x6 // shift right logical variable integer
  130. #define SRAV_OP 0x7 // shift right arithmetic variable integer
  131. #define JR_OP 0x8 // jump register
  132. #define JALR_OP 0x9 // jump and link register
  133. #define SYSCALL_OP 0xc // system call trap
  134. #define BREAK_OP 0xd // breakpoint trap
  135. #define MFHI_OP 0x10 // more from high integer
  136. #define MTHI_OP 0x11 // move to high integer
  137. #define MFLO_OP 0x12 // move from low integer
  138. #define MTLO_OP 0x13 // move to low integer
  139. #define MULT_OP 0x18 // multiply signed integer
  140. #define MULTU_OP 0x19 // multiply unsigned integer
  141. #define DIV_OP 0x1a // divide signed integer
  142. #define DIVU_OP 0x1b // divide unsigned integer
  143. #define ADD_OP 0x20 // add signed integer
  144. #define ADDU_OP 0x21 // add unsigned integer
  145. #define SUP_OP 0x22 // subtract signed integer
  146. #define SUBU_OP 0x23 // subtract unsigned integer
  147. #define AND_OP 0x24 // and integer
  148. #define OR_OP 0x25 // or integer
  149. #define XOR_OP 0x26 // exclusive or integer
  150. #define NOR_OP 0x27 // nor integer
  151. #define SLT_OP 0x2a // set less signed integer
  152. #define SLTU_OP 0x2b // set less unsigned integer
  153. //
  154. // Define branch conditional subopcodes.
  155. //
  156. #define BLTZ_OP 0x0 // branch less that zero integer
  157. #define BGEZ_OP 0x1 // branch greater than or equal zero integer
  158. #define BLTZL_OP 0x2 // branch less that zero integer liekly
  159. #define BGEZL_OP 0x3 // branch greater than or equal zero integer likely
  160. #define BLTZAL_OP 0x10 // branch less than zero integer and link
  161. #define BGEZAL_OP 0x11 // branch greater than or equal zero integer and link
  162. #define BLTZALL_OP 0x12 // branch less than zero integer and link likely
  163. #define BGEZALL_OP 0x13 // branch greater than or equal zero integer and link likely
  164. //
  165. // Coprocessor branch true and false subfunctions and mask values.
  166. //
  167. #define COPz_BC_MASK 0x3e10000 // coprocessor z branch condition mask
  168. #define COPz_BF 0x1000000 // coprocessor z branch false subfunction
  169. #define COPz_BT 0x1010000 // coprocessor z branch true subfunction
  170. //
  171. // Define floating coprocessor 1 opcodes.
  172. //
  173. #define FLOAT_ADD 0 // floating add
  174. #define FLOAT_SUBTRACT 1 // floating subtract
  175. #define FLOAT_MULTIPLY 2 // floating multiply
  176. #define FLOAT_DIVIDE 3 // floating divide
  177. #define FLOAT_SQUARE_ROOT 4 // floating square root
  178. #define FLOAT_ABSOLUTE 5 // floating absolute value
  179. #define FLOAT_MOVE 6 // floating move
  180. #define FLOAT_NEGATE 7 // floating negate
  181. #define FLOAT_ROUND_QUADWORD 8 // floating round to longword
  182. #define FLOAT_TRUNC_QUADWORD 9 // floating truncate to longword
  183. #define FLOAT_CEIL_QUADWORD 10 // floating ceiling
  184. #define FLOAT_FLOOR_QUADWORD 11 // floating floor
  185. #define FLOAT_ROUND_LONGWORD 12 // floating round to longword
  186. #define FLOAT_TRUNC_LONGWORD 13 // floating truncate to longword
  187. #define FLOAT_CEIL_LONGWORD 14 // floating ceiling
  188. #define FLOAT_FLOOR_LONGWORD 15 // floating floor
  189. #define FLOAT_ILLEGAL 16 // illegal floating opcode
  190. #define FLOAT_COMPARE_SINGLE 17 // floating compare single
  191. #define FLOAT_COMPARE_DOUBLE 18 // floating compare double
  192. #define FLOAT_CONVERT_SINGLE 32 // floating convert to single
  193. #define FLOAT_CONVERT_DOUBLE 33 // floating convert to double
  194. #define FLOAT_CONVERT_LONGWORD 36 // floating convert to longword integer
  195. #define FLOAT_CONVERT_QUADWORD 37 // floating convert to quadword integer
  196. #define FLOAT_COMPARE 48 // starting floating compare code
  197. //
  198. // Define floating format values.
  199. //
  200. #define FORMAT_SINGLE 0 // single floating format
  201. #define FORMAT_DOUBLE 1 // double floating format
  202. #define FORMAT_LONGWORD 4 // longword integer format
  203. #define FORMAT_QUADWORD 5 // quadword integer format
  204. //
  205. // Define jump indirect return address register.
  206. //
  207. #define JUMP_RA 0x3e00008 // jump indirect return address
  208. //
  209. // Define maximum and minimum single and double exponent values.
  210. //
  211. #define DOUBLE_MAXIMUM_EXPONENT 2047
  212. #define DOUBLE_MINIMUM_EXPONENT 0
  213. #define SINGLE_MAXIMUM_EXPONENT 255
  214. #define SINGLE_MINIMUM_EXPONENT 0
  215. //
  216. // Define single and double exponent bias values.
  217. //
  218. #define SINGLE_EXPONENT_BIAS 127
  219. #define DOUBLE_EXPONENT_BIAS 1023
  220. //
  221. // Define the largest single and double values;
  222. //
  223. #define DOUBLE_MAXIMUM_VALUE 0x7fefffffffffffff
  224. #define DOUBLE_MAXIMUM_VALUE_LOW 0xffffffff
  225. #define DOUBLE_MAXIMUM_VALUE_HIGH 0x7fefffff
  226. #define SINGLE_MAXIMUM_VALUE 0x7f7fffff
  227. //
  228. // Define single and double quite and signaling Nan values.
  229. //
  230. #define DOUBLE_NAN_LOW 0xffffffff
  231. #define DOUBLE_QUIET_NAN 0x7ff7ffff
  232. #define DOUBLE_SIGNAL_NAN 0x7fffffff
  233. #define SINGLE_QUIET_NAN 0x7fbfffff
  234. #define SINGLE_SIGNAL_NAN 0x7fffffff
  235. #define DOUBLE_INTEGER_NAN 0x7fffffffffffffff
  236. #define SINGLE_INTEGER_NAN 0x7fffffff
  237. //
  238. // Define positive single and double infinity values.
  239. //
  240. #define DOUBLE_INFINITY_VALUE 0x7ff0000000000000
  241. #define DOUBLE_INFINITY_VALUE_LOW 0x0
  242. #define DOUBLE_INFINITY_VALUE_HIGH 0x7ff00000
  243. #define SINGLE_INFINITY_VALUE 0x7f800000
  244. //
  245. // Define rounding modes.
  246. //
  247. #define ROUND_TO_NEAREST 0 // round to nearest representable value
  248. #define ROUND_TO_ZERO 1 // round toward zero
  249. #define ROUND_TO_PLUS_INFINITY 2 // round toward plus infinity
  250. #define ROUND_TO_MINUS_INFINITY 3 // round toward minus infinity
  251. #endif // MIPSINST