diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.cpp | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.cpp b/src/core/arm/dyncom/arm_dyncom_thumb.cpp index 2fc8170be..83b532aac 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.cpp +++ b/src/core/arm/dyncom/arm_dyncom_thumb.cpp | |||
| @@ -274,9 +274,46 @@ tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size) { | |||
| 274 | ? 0xE24DDF00 // SUB | 274 | ? 0xE24DDF00 // SUB |
| 275 | : 0xE28DDF00) // ADD | 275 | : 0xE28DDF00) // ADD |
| 276 | |(tinstr & 0x007F); // off7 | 276 | |(tinstr & 0x007F); // off7 |
| 277 | } else if ((tinstr & 0x0F00) == 0x0e00) | 277 | } else if ((tinstr & 0x0F00) == 0x0e00) { |
| 278 | *ainstr = 0xEF000000 | 0x180000; // base | BKPT mask | 278 | // BKPT |
| 279 | else { | 279 | *ainstr = 0xEF000000 // base |
| 280 | | BITS(tinstr, 0, 3) // imm4 field; | ||
| 281 | | (BITS(tinstr, 4, 7) << 8); // beginning 4 bits of imm12 | ||
| 282 | } else if ((tinstr & 0x0F00) == 0x0200) { | ||
| 283 | static const ARMword subset[4] = { | ||
| 284 | 0xE6BF0070, // SXTH | ||
| 285 | 0xE6AF0070, // SXTB | ||
| 286 | 0xE6FF0070, // UXTH | ||
| 287 | 0xE6EF0070, // UXTB | ||
| 288 | }; | ||
| 289 | |||
| 290 | *ainstr = subset[BITS(tinstr, 6, 7)] // base | ||
| 291 | | (BITS(tinstr, 0, 2) << 12) // Rd | ||
| 292 | | BITS(tinstr, 3, 5); // Rm | ||
| 293 | } else if ((tinstr & 0x0F00) == 0x600) { | ||
| 294 | if (BIT(tinstr, 5) == 0) { | ||
| 295 | // SETEND | ||
| 296 | *ainstr = 0xF1010000 // base | ||
| 297 | | (BIT(tinstr, 3) << 9); // endian specifier | ||
| 298 | } else { | ||
| 299 | // CPS | ||
| 300 | *ainstr = 0xF1080000 // base | ||
| 301 | | (BIT(tinstr, 0) << 6) // fiq bit | ||
| 302 | | (BIT(tinstr, 1) << 7) // irq bit | ||
| 303 | | (BIT(tinstr, 2) << 8) // abort bit | ||
| 304 | | (BIT(tinstr, 4) << 18); // enable bit | ||
| 305 | } | ||
| 306 | } else if ((tinstr & 0x0F00) == 0x0a00) { | ||
| 307 | static const ARMword subset[3] = { | ||
| 308 | 0xE6BF0F30, // REV | ||
| 309 | 0xE6BF0FB0, // REV16 | ||
| 310 | 0xE6FF0FB0, // REVSH | ||
| 311 | }; | ||
| 312 | |||
| 313 | *ainstr = subset[BITS(tinstr, 6, 7)] // base | ||
| 314 | | (BITS(tinstr, 0, 2) << 12) // Rd | ||
| 315 | | BITS(tinstr, 3, 5); // Rm | ||
| 316 | } else { | ||
| 280 | static const ARMword subset[4] = { | 317 | static const ARMword subset[4] = { |
| 281 | 0xE92D0000, // STMDB sp!,{rlist} | 318 | 0xE92D0000, // STMDB sp!,{rlist} |
| 282 | 0xE92D4000, // STMDB sp!,{rlist,lr} | 319 | 0xE92D4000, // STMDB sp!,{rlist,lr} |