OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * DO NOT EDIT: GENERATED CODE |
| 3 */ |
| 4 #include <stdio.h> |
| 5 #include "native_client/src/trusted/validator_mips/decode.h" |
| 6 |
| 7 namespace nacl_mips_dec { |
| 8 |
| 9 /* |
| 10 * This beast holds a bunch of pre-created ClassDecoder instances, which |
| 11 * we create in init_decode(). Because ClassDecoders are stateless, we |
| 12 * can freely reuse them -- even across threads -- and avoid allocating |
| 13 * in the inner decoder loop. |
| 14 */ |
| 15 struct DecoderState { |
| 16 const Load _Load_instance; |
| 17 const JalImm _JalImm_instance; |
| 18 const FPLoadStore _FPLoadStore_instance; |
| 19 const Arithm2 _Arithm2_instance; |
| 20 const Arithm3 _Arithm3_instance; |
| 21 const Forbidden _Forbidden_instance; |
| 22 const Safe _Safe_instance; |
| 23 const BranchAndLink _BranchAndLink_instance; |
| 24 const JalReg _JalReg_instance; |
| 25 const NaClHalt _NaClHalt_instance; |
| 26 const StoreConditional _StoreConditional_instance; |
| 27 const Branch _Branch_instance; |
| 28 const JmpImm _JmpImm_instance; |
| 29 const JmpReg _JmpReg_instance; |
| 30 const Store _Store_instance; |
| 31 const ExtIns _ExtIns_instance; |
| 32 DecoderState() : |
| 33 _Load_instance() |
| 34 ,_JalImm_instance() |
| 35 ,_FPLoadStore_instance() |
| 36 ,_Arithm2_instance() |
| 37 ,_Arithm3_instance() |
| 38 ,_Forbidden_instance() |
| 39 ,_Safe_instance() |
| 40 ,_BranchAndLink_instance() |
| 41 ,_JalReg_instance() |
| 42 ,_NaClHalt_instance() |
| 43 ,_StoreConditional_instance() |
| 44 ,_Branch_instance() |
| 45 ,_JmpImm_instance() |
| 46 ,_JmpReg_instance() |
| 47 ,_Store_instance() |
| 48 ,_ExtIns_instance() |
| 49 {} |
| 50 }; |
| 51 |
| 52 /* |
| 53 * Prototypes for static table-matching functions. |
| 54 */ |
| 55 static inline const ClassDecoder &decode_MIPS32(const Instruction insn, const De
coderState *state); |
| 56 static inline const ClassDecoder &decode_special(const Instruction insn, const D
ecoderState *state); |
| 57 static inline const ClassDecoder &decode_regimm(const Instruction insn, const De
coderState *state); |
| 58 static inline const ClassDecoder &decode_special2(const Instruction insn, const
DecoderState *state); |
| 59 static inline const ClassDecoder &decode_special3(const Instruction insn, const
DecoderState *state); |
| 60 static inline const ClassDecoder &decode_movci(const Instruction insn, const Dec
oderState *state); |
| 61 static inline const ClassDecoder &decode_srl(const Instruction insn, const Decod
erState *state); |
| 62 static inline const ClassDecoder &decode_srlv(const Instruction insn, const Deco
derState *state); |
| 63 static inline const ClassDecoder &decode_bshfl(const Instruction insn, const Dec
oderState *state); |
| 64 static inline const ClassDecoder &decode_cop0(const Instruction insn, const Deco
derState *state); |
| 65 static inline const ClassDecoder &decode_c0(const Instruction insn, const Decode
rState *state); |
| 66 static inline const ClassDecoder &decode_cop1(const Instruction insn, const Deco
derState *state); |
| 67 static inline const ClassDecoder &decode_c1(const Instruction insn, const Decode
rState *state); |
| 68 static inline const ClassDecoder &decode_movcf(const Instruction insn, const Dec
oderState *state); |
| 69 static inline const ClassDecoder &decode_cop2(const Instruction insn, const Deco
derState *state); |
| 70 static inline const ClassDecoder &decode_cop1x(const Instruction insn, const Dec
oderState *state); |
| 71 static inline const ClassDecoder &decode_branch_1(const Instruction insn, const
DecoderState *state); |
| 72 static inline const ClassDecoder &decode_arithm2_1(const Instruction insn, const
DecoderState *state); |
| 73 static inline const ClassDecoder &decode_arithm3_1(const Instruction insn, const
DecoderState *state); |
| 74 static inline const ClassDecoder &decode_arithm3_2(const Instruction insn, const
DecoderState *state); |
| 75 static inline const ClassDecoder &decode_jr(const Instruction insn, const Decode
rState *state); |
| 76 static inline const ClassDecoder &decode_jalr(const Instruction insn, const Deco
derState *state); |
| 77 static inline const ClassDecoder &decode_sync(const Instruction insn, const Deco
derState *state); |
| 78 static inline const ClassDecoder &decode_mfhi(const Instruction insn, const Deco
derState *state); |
| 79 static inline const ClassDecoder &decode_mthi(const Instruction insn, const Deco
derState *state); |
| 80 static inline const ClassDecoder &decode_mult(const Instruction insn, const Deco
derState *state); |
| 81 static inline const ClassDecoder &decode_arithm3_3(const Instruction insn, const
DecoderState *state); |
| 82 static inline const ClassDecoder &decode_mfmc0(const Instruction insn, const Dec
oderState *state); |
| 83 static inline const ClassDecoder &decode_mfc1(const Instruction insn, const Deco
derState *state); |
| 84 static inline const ClassDecoder &decode_mtc1(const Instruction insn, const Deco
derState *state); |
| 85 static inline const ClassDecoder &decode_bc1(const Instruction insn, const Decod
erState *state); |
| 86 static inline const ClassDecoder &decode_fp(const Instruction insn, const Decode
rState *state); |
| 87 static inline const ClassDecoder &decode_bc2(const Instruction insn, const Decod
erState *state); |
| 88 static inline const ClassDecoder &decode_c_cond_fmt(const Instruction insn, cons
t DecoderState *state); |
| 89 |
| 90 /* |
| 91 * Table-matching function implementations. |
| 92 */ |
| 93 |
| 94 /* |
| 95 * Implementation of table MIPS32. |
| 96 * Specified by: See Table A.2. |
| 97 */ |
| 98 static inline const ClassDecoder &decode_MIPS32(const Instruction insn, const De
coderState *state) { |
| 99 if (((insn & 0xFC000000) == 0x00000000)) { |
| 100 return decode_special(insn, state); |
| 101 } |
| 102 |
| 103 if (((insn & 0xFC000000) == 0x04000000)) { |
| 104 return decode_regimm(insn, state); |
| 105 } |
| 106 |
| 107 if (((insn & 0xFC000000) == 0x08000000)) { |
| 108 return state->_JmpImm_instance; |
| 109 } |
| 110 |
| 111 if (((insn & 0xFC000000) == 0x0C000000)) { |
| 112 return state->_JalImm_instance; |
| 113 } |
| 114 |
| 115 if (((insn & 0xFC000000) == 0x38000000)) { |
| 116 return state->_Arithm2_instance; |
| 117 } |
| 118 |
| 119 if (((insn & 0xFC000000) == 0x3C000000)) { |
| 120 return decode_arithm2_1(insn, state); |
| 121 } |
| 122 |
| 123 if (((insn & 0xFC000000) == 0x40000000)) { |
| 124 return decode_cop0(insn, state); |
| 125 } |
| 126 |
| 127 if (((insn & 0xFC000000) == 0x44000000)) { |
| 128 return decode_cop1(insn, state); |
| 129 } |
| 130 |
| 131 if (((insn & 0xFC000000) == 0x48000000)) { |
| 132 return decode_cop2(insn, state); |
| 133 } |
| 134 |
| 135 if (((insn & 0xFC000000) == 0x4C000000)) { |
| 136 return decode_cop1x(insn, state); |
| 137 } |
| 138 |
| 139 if (((insn & 0xFC000000) == 0x70000000)) { |
| 140 return decode_special2(insn, state); |
| 141 } |
| 142 |
| 143 if (((insn & 0xFC000000) == 0x74000000)) { |
| 144 return state->_Forbidden_instance; |
| 145 } |
| 146 |
| 147 if (((insn & 0xFC000000) == 0x78000000)) { |
| 148 return state->_Forbidden_instance; |
| 149 } |
| 150 |
| 151 if (((insn & 0xFC000000) == 0x7C000000)) { |
| 152 return decode_special3(insn, state); |
| 153 } |
| 154 |
| 155 if (((insn & 0xFC000000) == 0x98000000)) { |
| 156 return state->_Load_instance; |
| 157 } |
| 158 |
| 159 if (((insn & 0xFC000000) == 0xB8000000)) { |
| 160 return state->_Store_instance; |
| 161 } |
| 162 |
| 163 if (((insn & 0xFC000000) == 0xC0000000)) { |
| 164 return state->_Load_instance; |
| 165 } |
| 166 |
| 167 if (((insn & 0xFC000000) == 0xE0000000)) { |
| 168 return state->_StoreConditional_instance; |
| 169 } |
| 170 |
| 171 if (((insn & 0xDC000000) == 0x9C000000)) { |
| 172 return state->_Forbidden_instance; |
| 173 } |
| 174 |
| 175 if (((insn & 0xDC000000) == 0xD0000000)) { |
| 176 return state->_Forbidden_instance; |
| 177 } |
| 178 |
| 179 if (((insn & 0xF8000000) == 0x30000000)) { |
| 180 return state->_Arithm2_instance; |
| 181 } |
| 182 |
| 183 if (((insn & 0xF8000000) == 0x90000000)) { |
| 184 return state->_Load_instance; |
| 185 } |
| 186 |
| 187 if (((insn & 0xF8000000) == 0xB0000000)) { |
| 188 return state->_Forbidden_instance; |
| 189 } |
| 190 |
| 191 if (((insn & 0xB8000000) == 0x10000000)) { |
| 192 return state->_Branch_instance; |
| 193 } |
| 194 |
| 195 if (((insn & 0xB8000000) == 0x18000000)) { |
| 196 return decode_branch_1(insn, state); |
| 197 } |
| 198 |
| 199 if (((insn & 0xCC000000) == 0xC4000000)) { |
| 200 return state->_FPLoadStore_instance; |
| 201 } |
| 202 |
| 203 if (((insn & 0xCC000000) == 0xC8000000)) { |
| 204 return state->_FPLoadStore_instance; |
| 205 } |
| 206 |
| 207 if (((insn & 0xCC000000) == 0xCC000000)) { |
| 208 return state->_Forbidden_instance; |
| 209 } |
| 210 |
| 211 if (((insn & 0xF0000000) == 0x20000000)) { |
| 212 return state->_Arithm2_instance; |
| 213 } |
| 214 |
| 215 if (((insn & 0xF0000000) == 0x60000000)) { |
| 216 return state->_Forbidden_instance; |
| 217 } |
| 218 |
| 219 if (((insn & 0xF0000000) == 0x80000000)) { |
| 220 return state->_Load_instance; |
| 221 } |
| 222 |
| 223 if (((insn & 0xF0000000) == 0xA0000000)) { |
| 224 return state->_Store_instance; |
| 225 } |
| 226 |
| 227 // Catch any attempt to fall through... |
| 228 fprintf(stderr, "TABLE IS INCOMPLETE: MIPS32 could not parse %08X",insn.Bits(3
1,0)); |
| 229 return state->_Forbidden_instance; |
| 230 } |
| 231 |
| 232 /* |
| 233 * Implementation of table special. |
| 234 * Specified by: See Table A.3. |
| 235 */ |
| 236 static inline const ClassDecoder &decode_special(const Instruction insn, const D
ecoderState *state) { |
| 237 if (((insn & 0x0000003F) == 0x00000000)) { |
| 238 return decode_arithm3_1(insn, state); |
| 239 } |
| 240 |
| 241 if (((insn & 0x0000003F) == 0x00000001)) { |
| 242 return decode_movci(insn, state); |
| 243 } |
| 244 |
| 245 if (((insn & 0x0000003F) == 0x00000002)) { |
| 246 return decode_srl(insn, state); |
| 247 } |
| 248 |
| 249 if (((insn & 0x0000003F) == 0x00000003)) { |
| 250 return decode_arithm3_1(insn, state); |
| 251 } |
| 252 |
| 253 if (((insn & 0x0000003F) == 0x00000004)) { |
| 254 return decode_arithm3_2(insn, state); |
| 255 } |
| 256 |
| 257 if (((insn & 0x0000003F) == 0x00000006)) { |
| 258 return decode_srlv(insn, state); |
| 259 } |
| 260 |
| 261 if (((insn & 0x0000003F) == 0x00000007)) { |
| 262 return decode_arithm3_2(insn, state); |
| 263 } |
| 264 |
| 265 if (((insn & 0x0000003F) == 0x00000008)) { |
| 266 return decode_jr(insn, state); |
| 267 } |
| 268 |
| 269 if (((insn & 0x0000003F) == 0x00000009)) { |
| 270 return decode_jalr(insn, state); |
| 271 } |
| 272 |
| 273 if (((insn & 0x0000003F) == 0x0000000F)) { |
| 274 return decode_sync(insn, state); |
| 275 } |
| 276 |
| 277 if (((insn & 0x00000037) == 0x00000005)) { |
| 278 return state->_Forbidden_instance; |
| 279 } |
| 280 |
| 281 if (((insn & 0x0000003D) == 0x0000000C)) { |
| 282 return state->_Forbidden_instance; |
| 283 } |
| 284 |
| 285 if (((insn & 0x0000003D) == 0x00000010)) { |
| 286 return decode_mfhi(insn, state); |
| 287 } |
| 288 |
| 289 if (((insn & 0x0000003D) == 0x00000011)) { |
| 290 return decode_mthi(insn, state); |
| 291 } |
| 292 |
| 293 if (((insn & 0x0000003E) == 0x0000000A)) { |
| 294 return decode_arithm3_2(insn, state); |
| 295 } |
| 296 |
| 297 if (((insn & 0x0000003E) == 0x0000002A)) { |
| 298 return decode_arithm3_3(insn, state); |
| 299 } |
| 300 |
| 301 if (((insn & 0x0000003E) == 0x0000003C)) { |
| 302 return state->_Forbidden_instance; |
| 303 } |
| 304 |
| 305 if (((insn & 0x0000002E) == 0x0000002E)) { |
| 306 return state->_Forbidden_instance; |
| 307 } |
| 308 |
| 309 if (((insn & 0x0000003A) == 0x00000028)) { |
| 310 return state->_Forbidden_instance; |
| 311 } |
| 312 |
| 313 if (((insn & 0x0000003C) == 0x00000018)) { |
| 314 return decode_mult(insn, state); |
| 315 } |
| 316 |
| 317 if (((insn & 0x0000003C) == 0x00000038)) { |
| 318 return state->_Forbidden_instance; |
| 319 } |
| 320 |
| 321 if (((insn & 0x00000034) == 0x00000014)) { |
| 322 return state->_Forbidden_instance; |
| 323 } |
| 324 |
| 325 if (((insn & 0x00000038) == 0x00000020)) { |
| 326 return decode_arithm3_3(insn, state); |
| 327 } |
| 328 |
| 329 if (((insn & 0x00000038) == 0x00000030)) { |
| 330 return state->_Forbidden_instance; |
| 331 } |
| 332 |
| 333 // Catch any attempt to fall through... |
| 334 fprintf(stderr, "TABLE IS INCOMPLETE: special could not parse %08X",insn.Bits(
31,0)); |
| 335 return state->_Forbidden_instance; |
| 336 } |
| 337 |
| 338 /* |
| 339 * Implementation of table regimm. |
| 340 * Specified by: See Table A.4. |
| 341 */ |
| 342 static inline const ClassDecoder &decode_regimm(const Instruction insn, const De
coderState *state) { |
| 343 if (((insn & 0x001C0000) == 0x00000000)) { |
| 344 return state->_Branch_instance; |
| 345 } |
| 346 |
| 347 if (((insn & 0x001C0000) == 0x00100000)) { |
| 348 return state->_BranchAndLink_instance; |
| 349 } |
| 350 |
| 351 if (((insn & 0x000C0000) == 0x00080000)) { |
| 352 return state->_Forbidden_instance; |
| 353 } |
| 354 |
| 355 if (((insn & 0x00040000) == 0x00040000)) { |
| 356 return state->_Forbidden_instance; |
| 357 } |
| 358 |
| 359 // Catch any attempt to fall through... |
| 360 fprintf(stderr, "TABLE IS INCOMPLETE: regimm could not parse %08X",insn.Bits(3
1,0)); |
| 361 return state->_Forbidden_instance; |
| 362 } |
| 363 |
| 364 /* |
| 365 * Implementation of table special2. |
| 366 * Specified by: See Table A.5. |
| 367 */ |
| 368 static inline const ClassDecoder &decode_special2(const Instruction insn, const
DecoderState *state) { |
| 369 if (((insn & 0x0000003F) == 0x00000002)) { |
| 370 return decode_arithm3_2(insn, state); |
| 371 } |
| 372 |
| 373 if (((insn & 0x0000003F) == 0x0000003F)) { |
| 374 return state->_Forbidden_instance; |
| 375 } |
| 376 |
| 377 if (((insn & 0x0000001F) == 0x0000001E)) { |
| 378 return state->_Forbidden_instance; |
| 379 } |
| 380 |
| 381 if (((insn & 0x0000002F) == 0x0000000F)) { |
| 382 return state->_Forbidden_instance; |
| 383 } |
| 384 |
| 385 if (((insn & 0x00000037) == 0x00000006)) { |
| 386 return state->_Forbidden_instance; |
| 387 } |
| 388 |
| 389 if (((insn & 0x0000003B) == 0x00000003)) { |
| 390 return state->_Forbidden_instance; |
| 391 } |
| 392 |
| 393 if (((insn & 0x0000003E) == 0x00000020)) { |
| 394 return decode_arithm3_2(insn, state); |
| 395 } |
| 396 |
| 397 if (((insn & 0x0000003E) == 0x0000002E)) { |
| 398 return state->_Forbidden_instance; |
| 399 } |
| 400 |
| 401 if (((insn & 0x0000003E) == 0x0000003C)) { |
| 402 return state->_Forbidden_instance; |
| 403 } |
| 404 |
| 405 if (((insn & 0x0000002E) == 0x0000000C)) { |
| 406 return state->_Forbidden_instance; |
| 407 } |
| 408 |
| 409 if (((insn & 0x00000036) == 0x00000024)) { |
| 410 return state->_Forbidden_instance; |
| 411 } |
| 412 |
| 413 if (((insn & 0x0000003A) == 0x00000000)) { |
| 414 return decode_mult(insn, state); |
| 415 } |
| 416 |
| 417 if (((insn & 0x0000003A) == 0x00000022)) { |
| 418 return state->_Forbidden_instance; |
| 419 } |
| 420 |
| 421 if (((insn & 0x0000000C) == 0x00000008)) { |
| 422 return state->_Forbidden_instance; |
| 423 } |
| 424 |
| 425 if (((insn & 0x00000018) == 0x00000010)) { |
| 426 return state->_Forbidden_instance; |
| 427 } |
| 428 |
| 429 // Catch any attempt to fall through... |
| 430 fprintf(stderr, "TABLE IS INCOMPLETE: special2 could not parse %08X",insn.Bits
(31,0)); |
| 431 return state->_Forbidden_instance; |
| 432 } |
| 433 |
| 434 /* |
| 435 * Implementation of table special3. |
| 436 * Specified by: See Table A.6. |
| 437 */ |
| 438 static inline const ClassDecoder &decode_special3(const Instruction insn, const
DecoderState *state) { |
| 439 if (((insn & 0x0000003F) == 0x00000020)) { |
| 440 return decode_bshfl(insn, state); |
| 441 } |
| 442 |
| 443 if (((insn & 0x0000003F) == 0x0000003F)) { |
| 444 return state->_Forbidden_instance; |
| 445 } |
| 446 |
| 447 if (((insn & 0x0000002F) == 0x0000002E)) { |
| 448 return state->_Forbidden_instance; |
| 449 } |
| 450 |
| 451 if (((insn & 0x00000037) == 0x00000027)) { |
| 452 return state->_Forbidden_instance; |
| 453 } |
| 454 |
| 455 if (((insn & 0x0000003B) == 0x00000000)) { |
| 456 return state->_ExtIns_instance; |
| 457 } |
| 458 |
| 459 if (((insn & 0x0000003D) == 0x00000021)) { |
| 460 return state->_Forbidden_instance; |
| 461 } |
| 462 |
| 463 if (((insn & 0x0000003E) == 0x0000003C)) { |
| 464 return state->_Forbidden_instance; |
| 465 } |
| 466 |
| 467 if (((insn & 0x0000001B) == 0x00000002)) { |
| 468 return state->_Forbidden_instance; |
| 469 } |
| 470 |
| 471 if (((insn & 0x00000036) == 0x00000024)) { |
| 472 return state->_Forbidden_instance; |
| 473 } |
| 474 |
| 475 if (((insn & 0x00000039) == 0x00000001)) { |
| 476 return state->_Forbidden_instance; |
| 477 } |
| 478 |
| 479 if (((insn & 0x0000002C) == 0x00000028)) { |
| 480 return state->_Forbidden_instance; |
| 481 } |
| 482 |
| 483 if (((insn & 0x00000018) == 0x00000010)) { |
| 484 return state->_Forbidden_instance; |
| 485 } |
| 486 |
| 487 if (((insn & 0x00000028) == 0x00000008)) { |
| 488 return state->_Forbidden_instance; |
| 489 } |
| 490 |
| 491 // Catch any attempt to fall through... |
| 492 fprintf(stderr, "TABLE IS INCOMPLETE: special3 could not parse %08X",insn.Bits
(31,0)); |
| 493 return state->_Forbidden_instance; |
| 494 } |
| 495 |
| 496 /* |
| 497 * Implementation of table movci. |
| 498 * Specified by: See Table A.7. |
| 499 */ |
| 500 static inline const ClassDecoder &decode_movci(const Instruction insn, const Dec
oderState *state) { |
| 501 if (((insn & 0x00020000) == 0x00000000) && ((insn & 0x000007C0) == 0x00000000)
) { |
| 502 return state->_Arithm3_instance; |
| 503 } |
| 504 |
| 505 if (((insn & 0x00020000) == 0x00020000) && ((insn & 0x000007C0) == 0x00000000)
) { |
| 506 return state->_Forbidden_instance; |
| 507 } |
| 508 |
| 509 if ((true) && ((insn & 0x000007C0) != 0x00000000)) { |
| 510 return state->_Forbidden_instance; |
| 511 } |
| 512 |
| 513 // Catch any attempt to fall through... |
| 514 fprintf(stderr, "TABLE IS INCOMPLETE: movci could not parse %08X",insn.Bits(31
,0)); |
| 515 return state->_Forbidden_instance; |
| 516 } |
| 517 |
| 518 /* |
| 519 * Implementation of table srl. |
| 520 * Specified by: See Table A.8. |
| 521 */ |
| 522 static inline const ClassDecoder &decode_srl(const Instruction insn, const Decod
erState *state) { |
| 523 if (((insn & 0x03C00000) != 0x00000000)) { |
| 524 return state->_Forbidden_instance; |
| 525 } |
| 526 |
| 527 if (((insn & 0x03C00000) == 0x00000000)) { |
| 528 return state->_Arithm3_instance; |
| 529 } |
| 530 |
| 531 // Catch any attempt to fall through... |
| 532 fprintf(stderr, "TABLE IS INCOMPLETE: srl could not parse %08X",insn.Bits(31,0
)); |
| 533 return state->_Forbidden_instance; |
| 534 } |
| 535 |
| 536 /* |
| 537 * Implementation of table srlv. |
| 538 * Specified by: See Table A.9. |
| 539 */ |
| 540 static inline const ClassDecoder &decode_srlv(const Instruction insn, const Deco
derState *state) { |
| 541 if (((insn & 0x00000780) != 0x00000000)) { |
| 542 return state->_Forbidden_instance; |
| 543 } |
| 544 |
| 545 if (((insn & 0x00000780) == 0x00000000)) { |
| 546 return state->_Arithm3_instance; |
| 547 } |
| 548 |
| 549 // Catch any attempt to fall through... |
| 550 fprintf(stderr, "TABLE IS INCOMPLETE: srlv could not parse %08X",insn.Bits(31,
0)); |
| 551 return state->_Forbidden_instance; |
| 552 } |
| 553 |
| 554 /* |
| 555 * Implementation of table bshfl. |
| 556 * Specified by: See Table A.10. |
| 557 */ |
| 558 static inline const ClassDecoder &decode_bshfl(const Instruction insn, const Dec
oderState *state) { |
| 559 if (((insn & 0x000007C0) == 0x00000080)) { |
| 560 return decode_arithm3_1(insn, state); |
| 561 } |
| 562 |
| 563 if (((insn & 0x000007C0) == 0x000005C0)) { |
| 564 return state->_Forbidden_instance; |
| 565 } |
| 566 |
| 567 if (((insn & 0x000003C0) == 0x000003C0)) { |
| 568 return state->_Forbidden_instance; |
| 569 } |
| 570 |
| 571 if (((insn & 0x000005C0) == 0x00000180)) { |
| 572 return state->_Forbidden_instance; |
| 573 } |
| 574 |
| 575 if (((insn & 0x000005C0) == 0x00000400)) { |
| 576 return decode_arithm3_1(insn, state); |
| 577 } |
| 578 |
| 579 if (((insn & 0x000006C0) == 0x000000C0)) { |
| 580 return state->_Forbidden_instance; |
| 581 } |
| 582 |
| 583 if (((insn & 0x00000780) == 0x00000500)) { |
| 584 return state->_Forbidden_instance; |
| 585 } |
| 586 |
| 587 if (((insn & 0x00000380) == 0x00000300)) { |
| 588 return state->_Forbidden_instance; |
| 589 } |
| 590 |
| 591 if (((insn & 0x000004C0) == 0x00000480)) { |
| 592 return state->_Forbidden_instance; |
| 593 } |
| 594 |
| 595 if (((insn & 0x00000540) == 0x00000440)) { |
| 596 return state->_Forbidden_instance; |
| 597 } |
| 598 |
| 599 if (((insn & 0x00000680) == 0x00000000)) { |
| 600 return state->_Forbidden_instance; |
| 601 } |
| 602 |
| 603 if (((insn & 0x00000700) == 0x00000200)) { |
| 604 return state->_Forbidden_instance; |
| 605 } |
| 606 |
| 607 // Catch any attempt to fall through... |
| 608 fprintf(stderr, "TABLE IS INCOMPLETE: bshfl could not parse %08X",insn.Bits(31
,0)); |
| 609 return state->_Forbidden_instance; |
| 610 } |
| 611 |
| 612 /* |
| 613 * Implementation of table cop0. |
| 614 * Specified by: See Table A.11. |
| 615 */ |
| 616 static inline const ClassDecoder &decode_cop0(const Instruction insn, const Deco
derState *state) { |
| 617 if (((insn & 0x03E00000) == 0x01600000)) { |
| 618 return decode_mfmc0(insn, state); |
| 619 } |
| 620 |
| 621 if (((insn & 0x03E00000) == 0x02000000)) { |
| 622 return decode_c0(insn, state); |
| 623 } |
| 624 |
| 625 if (((insn & 0x03E00000) == 0x02E00000)) { |
| 626 return state->_Forbidden_instance; |
| 627 } |
| 628 |
| 629 if (((insn & 0x03E00000) == 0x03C00000)) { |
| 630 return state->_Forbidden_instance; |
| 631 } |
| 632 |
| 633 if (((insn & 0x01E00000) == 0x01E00000)) { |
| 634 return state->_Forbidden_instance; |
| 635 } |
| 636 |
| 637 if (((insn & 0x03600000) == 0x01400000)) { |
| 638 return state->_Forbidden_instance; |
| 639 } |
| 640 |
| 641 if (((insn & 0x03600000) == 0x02400000)) { |
| 642 return state->_Forbidden_instance; |
| 643 } |
| 644 |
| 645 if (((insn & 0x03A00000) == 0x02200000)) { |
| 646 return state->_Forbidden_instance; |
| 647 } |
| 648 |
| 649 if (((insn & 0x02C00000) == 0x02800000)) { |
| 650 return state->_Forbidden_instance; |
| 651 } |
| 652 |
| 653 if (((insn & 0x03400000) == 0x01000000)) { |
| 654 return state->_Forbidden_instance; |
| 655 } |
| 656 |
| 657 if (((insn & 0x03800000) == 0x03000000)) { |
| 658 return state->_Forbidden_instance; |
| 659 } |
| 660 |
| 661 if (((insn & 0x03000000) == 0x00000000)) { |
| 662 return state->_Forbidden_instance; |
| 663 } |
| 664 |
| 665 // Catch any attempt to fall through... |
| 666 fprintf(stderr, "TABLE IS INCOMPLETE: cop0 could not parse %08X",insn.Bits(31,
0)); |
| 667 return state->_Forbidden_instance; |
| 668 } |
| 669 |
| 670 /* |
| 671 * Implementation of table c0. |
| 672 * Specified by: See Table A.12. |
| 673 */ |
| 674 static inline const ClassDecoder &decode_c0(const Instruction insn, const Decode
rState *state) { |
| 675 if ((true)) { |
| 676 return state->_Forbidden_instance; |
| 677 } |
| 678 |
| 679 // Catch any attempt to fall through... |
| 680 fprintf(stderr, "TABLE IS INCOMPLETE: c0 could not parse %08X",insn.Bits(31,0)
); |
| 681 return state->_Forbidden_instance; |
| 682 } |
| 683 |
| 684 /* |
| 685 * Implementation of table cop1. |
| 686 * Specified by: See Table A.13. |
| 687 */ |
| 688 static inline const ClassDecoder &decode_cop1(const Instruction insn, const Deco
derState *state) { |
| 689 if (((insn & 0x03E00000) == 0x00000000)) { |
| 690 return decode_mfc1(insn, state); |
| 691 } |
| 692 |
| 693 if (((insn & 0x03E00000) == 0x00600000)) { |
| 694 return decode_mfc1(insn, state); |
| 695 } |
| 696 |
| 697 if (((insn & 0x03E00000) == 0x00800000)) { |
| 698 return decode_mtc1(insn, state); |
| 699 } |
| 700 |
| 701 if (((insn & 0x03E00000) == 0x00E00000)) { |
| 702 return decode_mtc1(insn, state); |
| 703 } |
| 704 |
| 705 if (((insn & 0x03E00000) == 0x01000000)) { |
| 706 return decode_bc1(insn, state); |
| 707 } |
| 708 |
| 709 if (((insn & 0x03E00000) == 0x01E00000)) { |
| 710 return state->_Forbidden_instance; |
| 711 } |
| 712 |
| 713 if (((insn & 0x03600000) == 0x00200000)) { |
| 714 return state->_Forbidden_instance; |
| 715 } |
| 716 |
| 717 if (((insn & 0x03A00000) == 0x01200000)) { |
| 718 return state->_Forbidden_instance; |
| 719 } |
| 720 |
| 721 if (((insn & 0x03C00000) == 0x01800000)) { |
| 722 return state->_Forbidden_instance; |
| 723 } |
| 724 |
| 725 if (((insn & 0x03C00000) == 0x02400000)) { |
| 726 return state->_Forbidden_instance; |
| 727 } |
| 728 |
| 729 if (((insn & 0x03C00000) == 0x03800000)) { |
| 730 return decode_c1(insn, state); |
| 731 } |
| 732 |
| 733 if (((insn & 0x02600000) == 0x00400000)) { |
| 734 return state->_Forbidden_instance; |
| 735 } |
| 736 |
| 737 if (((insn & 0x02C00000) == 0x02C00000)) { |
| 738 return decode_c1(insn, state); |
| 739 } |
| 740 |
| 741 if (((insn & 0x03400000) == 0x02000000)) { |
| 742 return decode_c1(insn, state); |
| 743 } |
| 744 |
| 745 if (((insn & 0x03800000) == 0x03000000)) { |
| 746 return decode_c1(insn, state); |
| 747 } |
| 748 |
| 749 // Catch any attempt to fall through... |
| 750 fprintf(stderr, "TABLE IS INCOMPLETE: cop1 could not parse %08X",insn.Bits(31,
0)); |
| 751 return state->_Forbidden_instance; |
| 752 } |
| 753 |
| 754 /* |
| 755 * Implementation of table c1. |
| 756 * Specified by: See Table A.14, A.15, A.16, A.17. |
| 757 */ |
| 758 static inline const ClassDecoder &decode_c1(const Instruction insn, const Decode
rState *state) { |
| 759 if (((insn & 0x0000003F) == 0x00000011)) { |
| 760 return decode_movcf(insn, state); |
| 761 } |
| 762 |
| 763 if (((insn & 0x0000003F) == 0x00000015)) { |
| 764 return decode_fp(insn, state); |
| 765 } |
| 766 |
| 767 if (((insn & 0x0000003F) == 0x00000016)) { |
| 768 return decode_fp(insn, state); |
| 769 } |
| 770 |
| 771 if (((insn & 0x0000003F) == 0x0000001E)) { |
| 772 return state->_Forbidden_instance; |
| 773 } |
| 774 |
| 775 if (((insn & 0x0000003F) == 0x00000027)) { |
| 776 return state->_Forbidden_instance; |
| 777 } |
| 778 |
| 779 if (((insn & 0x0000003F) == 0x00000028)) { |
| 780 return decode_fp(insn, state); |
| 781 } |
| 782 |
| 783 if (((insn & 0x0000003F) == 0x0000002A)) { |
| 784 return state->_Forbidden_instance; |
| 785 } |
| 786 |
| 787 if (((insn & 0x0000003F) == 0x0000002F)) { |
| 788 return state->_Safe_instance; |
| 789 } |
| 790 |
| 791 if (((insn & 0x00000037) == 0x00000017)) { |
| 792 return state->_Forbidden_instance; |
| 793 } |
| 794 |
| 795 if (((insn & 0x00000037) == 0x00000026)) { |
| 796 return state->_Safe_instance; |
| 797 } |
| 798 |
| 799 if (((insn & 0x0000003B) == 0x00000010)) { |
| 800 return state->_Forbidden_instance; |
| 801 } |
| 802 |
| 803 if (((insn & 0x0000003D) == 0x00000029)) { |
| 804 return state->_Forbidden_instance; |
| 805 } |
| 806 |
| 807 if (((insn & 0x0000003E) == 0x00000012)) { |
| 808 return state->_Safe_instance; |
| 809 } |
| 810 |
| 811 if (((insn & 0x0000003E) == 0x0000001C)) { |
| 812 return state->_Forbidden_instance; |
| 813 } |
| 814 |
| 815 if (((insn & 0x0000003E) == 0x00000022)) { |
| 816 return state->_Forbidden_instance; |
| 817 } |
| 818 |
| 819 if (((insn & 0x0000003E) == 0x0000002C)) { |
| 820 return state->_Safe_instance; |
| 821 } |
| 822 |
| 823 if (((insn & 0x0000003A) == 0x00000020)) { |
| 824 return decode_fp(insn, state); |
| 825 } |
| 826 |
| 827 if (((insn & 0x0000003C) == 0x00000000)) { |
| 828 return state->_Safe_instance; |
| 829 } |
| 830 |
| 831 if (((insn & 0x0000003C) == 0x00000008)) { |
| 832 return decode_fp(insn, state); |
| 833 } |
| 834 |
| 835 if (((insn & 0x0000003C) == 0x00000018)) { |
| 836 return state->_Forbidden_instance; |
| 837 } |
| 838 |
| 839 if (((insn & 0x00000034) == 0x00000004)) { |
| 840 return decode_fp(insn, state); |
| 841 } |
| 842 |
| 843 if (((insn & 0x00000030) == 0x00000030)) { |
| 844 return decode_c_cond_fmt(insn, state); |
| 845 } |
| 846 |
| 847 // Catch any attempt to fall through... |
| 848 fprintf(stderr, "TABLE IS INCOMPLETE: c1 could not parse %08X",insn.Bits(31,0)
); |
| 849 return state->_Forbidden_instance; |
| 850 } |
| 851 |
| 852 /* |
| 853 * Implementation of table movcf. |
| 854 * Specified by: See Table A.18. |
| 855 */ |
| 856 static inline const ClassDecoder &decode_movcf(const Instruction insn, const Dec
oderState *state) { |
| 857 if (((insn & 0x00020000) == 0x00000000)) { |
| 858 return state->_Safe_instance; |
| 859 } |
| 860 |
| 861 if (((insn & 0x00020000) == 0x00020000)) { |
| 862 return state->_Forbidden_instance; |
| 863 } |
| 864 |
| 865 // Catch any attempt to fall through... |
| 866 fprintf(stderr, "TABLE IS INCOMPLETE: movcf could not parse %08X",insn.Bits(31
,0)); |
| 867 return state->_Forbidden_instance; |
| 868 } |
| 869 |
| 870 /* |
| 871 * Implementation of table cop2. |
| 872 * Specified by: See Table A.19. |
| 873 */ |
| 874 static inline const ClassDecoder &decode_cop2(const Instruction insn, const Deco
derState *state) { |
| 875 if (((insn & 0x03E00000) == 0x01000000)) { |
| 876 return decode_bc2(insn, state); |
| 877 } |
| 878 |
| 879 if (((insn & 0x03E00000) == 0x03C00000)) { |
| 880 return state->_Forbidden_instance; |
| 881 } |
| 882 |
| 883 if (((insn & 0x01E00000) == 0x01E00000)) { |
| 884 return state->_Forbidden_instance; |
| 885 } |
| 886 |
| 887 if (((insn & 0x03600000) == 0x01400000)) { |
| 888 return state->_Forbidden_instance; |
| 889 } |
| 890 |
| 891 if (((insn & 0x03A00000) == 0x01200000)) { |
| 892 return state->_Forbidden_instance; |
| 893 } |
| 894 |
| 895 if (((insn & 0x01C00000) == 0x01800000)) { |
| 896 return state->_Forbidden_instance; |
| 897 } |
| 898 |
| 899 if (((insn & 0x03800000) == 0x03000000)) { |
| 900 return state->_Forbidden_instance; |
| 901 } |
| 902 |
| 903 if (((insn & 0x01000000) == 0x00000000)) { |
| 904 return state->_Forbidden_instance; |
| 905 } |
| 906 |
| 907 // Catch any attempt to fall through... |
| 908 fprintf(stderr, "TABLE IS INCOMPLETE: cop2 could not parse %08X",insn.Bits(31,
0)); |
| 909 return state->_Forbidden_instance; |
| 910 } |
| 911 |
| 912 /* |
| 913 * Implementation of table cop1x. |
| 914 * Specified by: See Table A.20. |
| 915 */ |
| 916 static inline const ClassDecoder &decode_cop1x(const Instruction insn, const Dec
oderState *state) { |
| 917 if (((insn & 0x0000003F) == 0x00000036)) { |
| 918 return state->_Safe_instance; |
| 919 } |
| 920 |
| 921 if (((insn & 0x0000003F) == 0x00000037)) { |
| 922 return state->_Forbidden_instance; |
| 923 } |
| 924 |
| 925 if (((insn & 0x0000001F) == 0x0000001E)) { |
| 926 return state->_Safe_instance; |
| 927 } |
| 928 |
| 929 if (((insn & 0x0000001F) == 0x0000001F)) { |
| 930 return state->_Forbidden_instance; |
| 931 } |
| 932 |
| 933 if (((insn & 0x00000037) == 0x00000026)) { |
| 934 return state->_Safe_instance; |
| 935 } |
| 936 |
| 937 if (((insn & 0x00000037) == 0x00000027)) { |
| 938 return state->_Forbidden_instance; |
| 939 } |
| 940 |
| 941 if (((insn & 0x0000003E) == 0x00000034)) { |
| 942 return state->_Forbidden_instance; |
| 943 } |
| 944 |
| 945 if (((insn & 0x0000001E) == 0x0000001C)) { |
| 946 return state->_Forbidden_instance; |
| 947 } |
| 948 |
| 949 if (((insn & 0x00000036) == 0x00000024)) { |
| 950 return state->_Forbidden_instance; |
| 951 } |
| 952 |
| 953 if (((insn & 0x0000003C) == 0x00000018)) { |
| 954 return state->_Forbidden_instance; |
| 955 } |
| 956 |
| 957 if (((insn & 0x00000026) == 0x00000020)) { |
| 958 return state->_Safe_instance; |
| 959 } |
| 960 |
| 961 if (((insn & 0x00000026) == 0x00000022)) { |
| 962 return state->_Forbidden_instance; |
| 963 } |
| 964 |
| 965 if (((insn & 0x00000038) == 0x00000010)) { |
| 966 return state->_Forbidden_instance; |
| 967 } |
| 968 |
| 969 if (((insn & 0x00000030) == 0x00000000)) { |
| 970 return state->_Forbidden_instance; |
| 971 } |
| 972 |
| 973 // Catch any attempt to fall through... |
| 974 fprintf(stderr, "TABLE IS INCOMPLETE: cop1x could not parse %08X",insn.Bits(31
,0)); |
| 975 return state->_Forbidden_instance; |
| 976 } |
| 977 |
| 978 /* |
| 979 * Implementation of table branch_1. |
| 980 * Specified by: blez, bgtz, blezl, bgtzl. |
| 981 */ |
| 982 static inline const ClassDecoder &decode_branch_1(const Instruction insn, const
DecoderState *state) { |
| 983 if (((insn & 0x001F0000) != 0x00000000)) { |
| 984 return state->_Forbidden_instance; |
| 985 } |
| 986 |
| 987 if (((insn & 0x001F0000) == 0x00000000)) { |
| 988 return state->_Branch_instance; |
| 989 } |
| 990 |
| 991 // Catch any attempt to fall through... |
| 992 fprintf(stderr, "TABLE IS INCOMPLETE: branch_1 could not parse %08X",insn.Bits
(31,0)); |
| 993 return state->_Forbidden_instance; |
| 994 } |
| 995 |
| 996 /* |
| 997 * Implementation of table arithm2_1. |
| 998 * Specified by: lui. |
| 999 */ |
| 1000 static inline const ClassDecoder &decode_arithm2_1(const Instruction insn, const
DecoderState *state) { |
| 1001 if (((insn & 0x03E00000) != 0x00000000)) { |
| 1002 return state->_Forbidden_instance; |
| 1003 } |
| 1004 |
| 1005 if (((insn & 0x03E00000) == 0x00000000)) { |
| 1006 return state->_Arithm2_instance; |
| 1007 } |
| 1008 |
| 1009 // Catch any attempt to fall through... |
| 1010 fprintf(stderr, "TABLE IS INCOMPLETE: arithm2_1 could not parse %08X",insn.Bit
s(31,0)); |
| 1011 return state->_Forbidden_instance; |
| 1012 } |
| 1013 |
| 1014 /* |
| 1015 * Implementation of table arithm3_1. |
| 1016 * Specified by: sll, sra, wsbh, seb, seh. |
| 1017 */ |
| 1018 static inline const ClassDecoder &decode_arithm3_1(const Instruction insn, const
DecoderState *state) { |
| 1019 if (((insn & 0x03E00000) != 0x00000000)) { |
| 1020 return state->_Forbidden_instance; |
| 1021 } |
| 1022 |
| 1023 if (((insn & 0x03E00000) == 0x00000000)) { |
| 1024 return state->_Arithm3_instance; |
| 1025 } |
| 1026 |
| 1027 // Catch any attempt to fall through... |
| 1028 fprintf(stderr, "TABLE IS INCOMPLETE: arithm3_1 could not parse %08X",insn.Bit
s(31,0)); |
| 1029 return state->_Forbidden_instance; |
| 1030 } |
| 1031 |
| 1032 /* |
| 1033 * Implementation of table arithm3_2. |
| 1034 * Specified by: sllv, srav, movz, movn, mul, clz, clo. |
| 1035 */ |
| 1036 static inline const ClassDecoder &decode_arithm3_2(const Instruction insn, const
DecoderState *state) { |
| 1037 if (((insn & 0x000007C0) != 0x00000000)) { |
| 1038 return state->_Forbidden_instance; |
| 1039 } |
| 1040 |
| 1041 if (((insn & 0x000007C0) == 0x00000000)) { |
| 1042 return state->_Arithm3_instance; |
| 1043 } |
| 1044 |
| 1045 // Catch any attempt to fall through... |
| 1046 fprintf(stderr, "TABLE IS INCOMPLETE: arithm3_2 could not parse %08X",insn.Bit
s(31,0)); |
| 1047 return state->_Forbidden_instance; |
| 1048 } |
| 1049 |
| 1050 /* |
| 1051 * Implementation of table jr. |
| 1052 * Specified by: jr. |
| 1053 */ |
| 1054 static inline const ClassDecoder &decode_jr(const Instruction insn, const Decode
rState *state) { |
| 1055 if (((insn & 0x03E00000) != 0x00000000) && ((insn & 0x001FFFC0) == 0x00000000)
) { |
| 1056 return state->_JmpReg_instance; |
| 1057 } |
| 1058 |
| 1059 if (((insn & 0x03E00000) == 0x00000000) && ((insn & 0x001FFFC0) == 0x00000000)
) { |
| 1060 return state->_NaClHalt_instance; |
| 1061 } |
| 1062 |
| 1063 if ((true) && ((insn & 0x001FFFC0) != 0x00000000)) { |
| 1064 return state->_Forbidden_instance; |
| 1065 } |
| 1066 |
| 1067 // Catch any attempt to fall through... |
| 1068 fprintf(stderr, "TABLE IS INCOMPLETE: jr could not parse %08X",insn.Bits(31,0)
); |
| 1069 return state->_Forbidden_instance; |
| 1070 } |
| 1071 |
| 1072 /* |
| 1073 * Implementation of table jalr. |
| 1074 * Specified by: jalr. |
| 1075 */ |
| 1076 static inline const ClassDecoder &decode_jalr(const Instruction insn, const Deco
derState *state) { |
| 1077 if (((insn & 0x001F0000) != 0x00000000) && ((insn & 0x000007C0) != 0x00000000)
) { |
| 1078 return state->_Forbidden_instance; |
| 1079 } |
| 1080 |
| 1081 if (((insn & 0x001F0000) == 0x00000000) && ((insn & 0x000007C0) == 0x00000000)
) { |
| 1082 return state->_JalReg_instance; |
| 1083 } |
| 1084 |
| 1085 // Catch any attempt to fall through... |
| 1086 fprintf(stderr, "TABLE IS INCOMPLETE: jalr could not parse %08X",insn.Bits(31,
0)); |
| 1087 return state->_Forbidden_instance; |
| 1088 } |
| 1089 |
| 1090 /* |
| 1091 * Implementation of table sync. |
| 1092 * Specified by: sync. |
| 1093 */ |
| 1094 static inline const ClassDecoder &decode_sync(const Instruction insn, const Deco
derState *state) { |
| 1095 if (((insn & 0x03FFFFC0) != 0x00000000)) { |
| 1096 return state->_Forbidden_instance; |
| 1097 } |
| 1098 |
| 1099 if (((insn & 0x03FFFFC0) == 0x00000000)) { |
| 1100 return state->_Safe_instance; |
| 1101 } |
| 1102 |
| 1103 // Catch any attempt to fall through... |
| 1104 fprintf(stderr, "TABLE IS INCOMPLETE: sync could not parse %08X",insn.Bits(31,
0)); |
| 1105 return state->_Forbidden_instance; |
| 1106 } |
| 1107 |
| 1108 /* |
| 1109 * Implementation of table mfhi. |
| 1110 * Specified by: mfhi, mflo. |
| 1111 */ |
| 1112 static inline const ClassDecoder &decode_mfhi(const Instruction insn, const Deco
derState *state) { |
| 1113 if (((insn & 0x03FF0000) != 0x00000000) && ((insn & 0x000007C0) != 0x00000000)
) { |
| 1114 return state->_Forbidden_instance; |
| 1115 } |
| 1116 |
| 1117 if (((insn & 0x03FF0000) == 0x00000000) && ((insn & 0x000007C0) == 0x00000000)
) { |
| 1118 return state->_Arithm3_instance; |
| 1119 } |
| 1120 |
| 1121 // Catch any attempt to fall through... |
| 1122 fprintf(stderr, "TABLE IS INCOMPLETE: mfhi could not parse %08X",insn.Bits(31,
0)); |
| 1123 return state->_Forbidden_instance; |
| 1124 } |
| 1125 |
| 1126 /* |
| 1127 * Implementation of table mthi. |
| 1128 * Specified by: mthi, mtlo. |
| 1129 */ |
| 1130 static inline const ClassDecoder &decode_mthi(const Instruction insn, const Deco
derState *state) { |
| 1131 if (((insn & 0x001FFFC0) != 0x00000000)) { |
| 1132 return state->_Forbidden_instance; |
| 1133 } |
| 1134 |
| 1135 if (((insn & 0x001FFFC0) == 0x00000000)) { |
| 1136 return state->_Safe_instance; |
| 1137 } |
| 1138 |
| 1139 // Catch any attempt to fall through... |
| 1140 fprintf(stderr, "TABLE IS INCOMPLETE: mthi could not parse %08X",insn.Bits(31,
0)); |
| 1141 return state->_Forbidden_instance; |
| 1142 } |
| 1143 |
| 1144 /* |
| 1145 * Implementation of table mult. |
| 1146 * Specified by: mult, multu, div, divu, madd, maddu, msub, msubu. |
| 1147 */ |
| 1148 static inline const ClassDecoder &decode_mult(const Instruction insn, const Deco
derState *state) { |
| 1149 if (((insn & 0x0000FFC0) != 0x00000000)) { |
| 1150 return state->_Forbidden_instance; |
| 1151 } |
| 1152 |
| 1153 if (((insn & 0x0000FFC0) == 0x00000000)) { |
| 1154 return state->_Safe_instance; |
| 1155 } |
| 1156 |
| 1157 // Catch any attempt to fall through... |
| 1158 fprintf(stderr, "TABLE IS INCOMPLETE: mult could not parse %08X",insn.Bits(31,
0)); |
| 1159 return state->_Forbidden_instance; |
| 1160 } |
| 1161 |
| 1162 /* |
| 1163 * Implementation of table arithm3_3. |
| 1164 * Specified by: add, addu, sub, subu, and, or, xor, nor, slt, sltu. |
| 1165 */ |
| 1166 static inline const ClassDecoder &decode_arithm3_3(const Instruction insn, const
DecoderState *state) { |
| 1167 if (((insn & 0x000007C0) != 0x00000000)) { |
| 1168 return state->_Forbidden_instance; |
| 1169 } |
| 1170 |
| 1171 if (((insn & 0x000007C0) == 0x00000000)) { |
| 1172 return state->_Arithm3_instance; |
| 1173 } |
| 1174 |
| 1175 // Catch any attempt to fall through... |
| 1176 fprintf(stderr, "TABLE IS INCOMPLETE: arithm3_3 could not parse %08X",insn.Bit
s(31,0)); |
| 1177 return state->_Forbidden_instance; |
| 1178 } |
| 1179 |
| 1180 /* |
| 1181 * Implementation of table mfmc0. |
| 1182 * Specified by: di, ei. |
| 1183 */ |
| 1184 static inline const ClassDecoder &decode_mfmc0(const Instruction insn, const Dec
oderState *state) { |
| 1185 if ((true)) { |
| 1186 return state->_Forbidden_instance; |
| 1187 } |
| 1188 |
| 1189 // Catch any attempt to fall through... |
| 1190 fprintf(stderr, "TABLE IS INCOMPLETE: mfmc0 could not parse %08X",insn.Bits(31
,0)); |
| 1191 return state->_Forbidden_instance; |
| 1192 } |
| 1193 |
| 1194 /* |
| 1195 * Implementation of table mfc1. |
| 1196 * Specified by: mfc1, mfhc1. |
| 1197 */ |
| 1198 static inline const ClassDecoder &decode_mfc1(const Instruction insn, const Deco
derState *state) { |
| 1199 if (((insn & 0x000007FF) != 0x00000000)) { |
| 1200 return state->_Forbidden_instance; |
| 1201 } |
| 1202 |
| 1203 if (((insn & 0x000007FF) == 0x00000000)) { |
| 1204 return state->_Arithm2_instance; |
| 1205 } |
| 1206 |
| 1207 // Catch any attempt to fall through... |
| 1208 fprintf(stderr, "TABLE IS INCOMPLETE: mfc1 could not parse %08X",insn.Bits(31,
0)); |
| 1209 return state->_Forbidden_instance; |
| 1210 } |
| 1211 |
| 1212 /* |
| 1213 * Implementation of table mtc1. |
| 1214 * Specified by: mtc1, mthc1. |
| 1215 */ |
| 1216 static inline const ClassDecoder &decode_mtc1(const Instruction insn, const Deco
derState *state) { |
| 1217 if (((insn & 0x000007FF) != 0x00000000)) { |
| 1218 return state->_Forbidden_instance; |
| 1219 } |
| 1220 |
| 1221 if (((insn & 0x000007FF) == 0x00000000)) { |
| 1222 return state->_Safe_instance; |
| 1223 } |
| 1224 |
| 1225 // Catch any attempt to fall through... |
| 1226 fprintf(stderr, "TABLE IS INCOMPLETE: mtc1 could not parse %08X",insn.Bits(31,
0)); |
| 1227 return state->_Forbidden_instance; |
| 1228 } |
| 1229 |
| 1230 /* |
| 1231 * Implementation of table bc1. |
| 1232 * Specified by: bc1f, bc1t, bc1fl, bc1tl. |
| 1233 */ |
| 1234 static inline const ClassDecoder &decode_bc1(const Instruction insn, const Decod
erState *state) { |
| 1235 if ((true)) { |
| 1236 return state->_Branch_instance; |
| 1237 } |
| 1238 |
| 1239 // Catch any attempt to fall through... |
| 1240 fprintf(stderr, "TABLE IS INCOMPLETE: bc1 could not parse %08X",insn.Bits(31,0
)); |
| 1241 return state->_Forbidden_instance; |
| 1242 } |
| 1243 |
| 1244 /* |
| 1245 * Implementation of table fp. |
| 1246 * Specified by: sqrt.fmt, abs.fmt, mov.fmt, neg.fmt, round.l.fmt, trunc.l.fmt,
ceil.l.fmt, floor.l.fmt, round.w.fmt, trunc.w.fmt, ceil.w.fmt, floor.w.fmt, reci
p.fmt, rsqrt.fmt, cvt.s.fmt, cvt.d.fmt, cvt.w.fmt, cvt.l.fmt, cvt.s.pl. |
| 1247 */ |
| 1248 static inline const ClassDecoder &decode_fp(const Instruction insn, const Decode
rState *state) { |
| 1249 if (((insn & 0x001F0000) != 0x00000000)) { |
| 1250 return state->_Forbidden_instance; |
| 1251 } |
| 1252 |
| 1253 if (((insn & 0x001F0000) == 0x00000000)) { |
| 1254 return state->_Safe_instance; |
| 1255 } |
| 1256 |
| 1257 // Catch any attempt to fall through... |
| 1258 fprintf(stderr, "TABLE IS INCOMPLETE: fp could not parse %08X",insn.Bits(31,0)
); |
| 1259 return state->_Forbidden_instance; |
| 1260 } |
| 1261 |
| 1262 /* |
| 1263 * Implementation of table bc2. |
| 1264 * Specified by: bc2f, bc2t, bc2fl, bc2tl. |
| 1265 */ |
| 1266 static inline const ClassDecoder &decode_bc2(const Instruction insn, const Decod
erState *state) { |
| 1267 if ((true)) { |
| 1268 return state->_Forbidden_instance; |
| 1269 } |
| 1270 |
| 1271 // Catch any attempt to fall through... |
| 1272 fprintf(stderr, "TABLE IS INCOMPLETE: bc2 could not parse %08X",insn.Bits(31,0
)); |
| 1273 return state->_Forbidden_instance; |
| 1274 } |
| 1275 |
| 1276 /* |
| 1277 * Implementation of table c_cond_fmt. |
| 1278 * Specified by: c.cond.fmt. |
| 1279 */ |
| 1280 static inline const ClassDecoder &decode_c_cond_fmt(const Instruction insn, cons
t DecoderState *state) { |
| 1281 if (((insn & 0x000000C0) != 0x00000000)) { |
| 1282 return state->_Forbidden_instance; |
| 1283 } |
| 1284 |
| 1285 if (((insn & 0x000000C0) == 0x00000000)) { |
| 1286 return state->_Safe_instance; |
| 1287 } |
| 1288 |
| 1289 // Catch any attempt to fall through... |
| 1290 fprintf(stderr, "TABLE IS INCOMPLETE: c_cond_fmt could not parse %08X",insn.Bi
ts(31,0)); |
| 1291 return state->_Forbidden_instance; |
| 1292 } |
| 1293 |
| 1294 const DecoderState *init_decode() { |
| 1295 return new DecoderState; |
| 1296 } |
| 1297 void delete_state(const DecoderState *state) { |
| 1298 delete (DecoderState *)state; |
| 1299 } |
| 1300 |
| 1301 const ClassDecoder &decode(const Instruction insn, const DecoderState *state) { |
| 1302 return decode_MIPS32(insn, (DecoderState *)state); |
| 1303 } |
| 1304 |
| 1305 } // namespace |
OLD | NEW |