summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_thumb.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.cpp b/src/core/arm/dyncom/arm_dyncom_thumb.cpp
index 08b5c0b77..cdaf21450 100644
--- a/src/core/arm/dyncom/arm_dyncom_thumb.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_thumb.cpp
@@ -189,33 +189,22 @@ tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size) {
189 189
190 case 10: 190 case 10:
191 case 11: 191 case 11:
192 // TODO: Format 7 and Format 8 perform the same ARM encoding, so the following could be 192 {
193 // merged into a single subset, saving on the following boolean: 193 static const ARMword subset[8] = {
194 194 0xE7800000, // STR Rd,[Rb,Ro]
195 if ((tinstr & (1 << 9)) == 0) {
196 static const ARMword subset[4] = {
197 0xE7800000, // STR Rd,[Rb,Ro]
198 0xE7C00000, // STRB Rd,[Rb,Ro]
199 0xE7900000, // LDR Rd,[Rb,Ro]
200 0xE7D00000 // LDRB Rd,[Rb,Ro]
201 };
202
203 *ainstr = subset[(tinstr & 0x0C00) >> 10] // base
204 |((tinstr & 0x0007) << (12 - 0)) // Rd
205 |((tinstr & 0x0038) << (16 - 3)) // Rb
206 |((tinstr & 0x01C0) >> 6); // Ro
207
208 } else {
209 static const ARMword subset[4] = {
210 0xE18000B0, // STRH Rd,[Rb,Ro] 195 0xE18000B0, // STRH Rd,[Rb,Ro]
196 0xE7C00000, // STRB Rd,[Rb,Ro]
211 0xE19000D0, // LDRSB Rd,[Rb,Ro] 197 0xE19000D0, // LDRSB Rd,[Rb,Ro]
198 0xE7900000, // LDR Rd,[Rb,Ro]
212 0xE19000B0, // LDRH Rd,[Rb,Ro] 199 0xE19000B0, // LDRH Rd,[Rb,Ro]
200 0xE7D00000, // LDRB Rd,[Rb,Ro]
213 0xE19000F0 // LDRSH Rd,[Rb,Ro] 201 0xE19000F0 // LDRSH Rd,[Rb,Ro]
214 }; 202 };
215 *ainstr = subset[(tinstr & 0x0C00) >> 10] // base 203
216 |((tinstr & 0x0007) << (12 - 0)) // Rd 204 *ainstr = subset[(tinstr & 0xE00) >> 9] // base
217 |((tinstr & 0x0038) << (16 - 3)) // Rb 205 |((tinstr & 0x0007) << (12 - 0)) // Rd
218 |((tinstr & 0x01C0) >> 6); // Ro 206 |((tinstr & 0x0038) << (16 - 3)) // Rb
207 |((tinstr & 0x01C0) >> 6); // Ro
219 } 208 }
220 break; 209 break;
221 210