diff options
| author | 2016-07-17 11:55:52 +0100 | |
|---|---|---|
| committer | 2016-07-28 11:51:29 +0100 | |
| commit | 60c93ca3b528ec1d10feb2366a8d0b48c23da271 (patch) | |
| tree | 2b9f75f269334cbf1961870b9bf40b783cfde4e2 /src | |
| parent | Merge pull request #1869 from wwylele/dont-be-lazy (diff) | |
| download | yuzu-60c93ca3b528ec1d10feb2366a8d0b48c23da271.tar.gz yuzu-60c93ca3b528ec1d10feb2366a8d0b48c23da271.tar.xz yuzu-60c93ca3b528ec1d10feb2366a8d0b48c23da271.zip | |
dyncom: Fix translation of thumb REVSH
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.cpp b/src/core/arm/dyncom/arm_dyncom_thumb.cpp index 29272fd5d..3576370d1 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.cpp +++ b/src/core/arm/dyncom/arm_dyncom_thumb.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cstddef> | ||
| 6 | |||
| 5 | // We can provide simple Thumb simulation by decoding the Thumb instruction into its corresponding | 7 | // We can provide simple Thumb simulation by decoding the Thumb instruction into its corresponding |
| 6 | // ARM instruction, and using the existing ARM simulator. | 8 | // ARM instruction, and using the existing ARM simulator. |
| 7 | 9 | ||
| @@ -293,15 +295,22 @@ ThumbDecodeStatus TranslateThumbInstruction(u32 addr, u32 instr, u32* ainstr, u3 | |||
| 293 | | (BIT(tinstr, 4) << 18); // enable bit | 295 | | (BIT(tinstr, 4) << 18); // enable bit |
| 294 | } | 296 | } |
| 295 | } else if ((tinstr & 0x0F00) == 0x0a00) { | 297 | } else if ((tinstr & 0x0F00) == 0x0a00) { |
| 296 | static const u32 subset[3] = { | 298 | static const u32 subset[4] = { |
| 297 | 0xE6BF0F30, // REV | 299 | 0xE6BF0F30, // REV |
| 298 | 0xE6BF0FB0, // REV16 | 300 | 0xE6BF0FB0, // REV16 |
| 301 | 0, // undefined | ||
| 299 | 0xE6FF0FB0, // REVSH | 302 | 0xE6FF0FB0, // REVSH |
| 300 | }; | 303 | }; |
| 301 | 304 | ||
| 302 | *ainstr = subset[BITS(tinstr, 6, 7)] // base | 305 | size_t subset_index = BITS(tinstr, 6, 7); |
| 303 | | (BITS(tinstr, 0, 2) << 12) // Rd | 306 | |
| 304 | | BITS(tinstr, 3, 5); // Rm | 307 | if (subset_index == 2) { |
| 308 | valid = ThumbDecodeStatus::UNDEFINED; | ||
| 309 | } else { | ||
| 310 | *ainstr = subset[subset_index] // base | ||
| 311 | | (BITS(tinstr, 0, 2) << 12) // Rd | ||
| 312 | | BITS(tinstr, 3, 5); // Rm | ||
| 313 | } | ||
| 305 | } else { | 314 | } else { |
| 306 | static const u32 subset[4] = { | 315 | static const u32 subset[4] = { |
| 307 | 0xE92D0000, // STMDB sp!,{rlist} | 316 | 0xE92D0000, // STMDB sp!,{rlist} |