diff options
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 12 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.cpp | 8 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.h | 15 |
3 files changed, 12 insertions, 23 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 69228180e..cdef72be6 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -3471,18 +3471,12 @@ enum { | |||
| 3471 | static tdstate decode_thumb_instr(u32 inst, u32 addr, u32* arm_inst, u32* inst_size, ARM_INST_PTR* ptr_inst_base) { | 3471 | static tdstate decode_thumb_instr(u32 inst, u32 addr, u32* arm_inst, u32* inst_size, ARM_INST_PTR* ptr_inst_base) { |
| 3472 | // Check if in Thumb mode | 3472 | // Check if in Thumb mode |
| 3473 | tdstate ret = thumb_translate (addr, inst, arm_inst, inst_size); | 3473 | tdstate ret = thumb_translate (addr, inst, arm_inst, inst_size); |
| 3474 | if(ret == t_branch){ | 3474 | if (ret == t_branch) { |
| 3475 | // TODO: FIXME, endian should be judged | ||
| 3476 | u32 tinstr; | ||
| 3477 | if((addr & 0x3) != 0) | ||
| 3478 | tinstr = inst >> 16; | ||
| 3479 | else | ||
| 3480 | tinstr = inst & 0xFFFF; | ||
| 3481 | |||
| 3482 | int inst_index; | 3475 | int inst_index; |
| 3483 | int table_length = sizeof(arm_instruction_trans) / sizeof(transop_fp_t); | 3476 | int table_length = sizeof(arm_instruction_trans) / sizeof(transop_fp_t); |
| 3477 | u32 tinstr = GetThumbInstruction(inst, addr); | ||
| 3484 | 3478 | ||
| 3485 | switch((tinstr & 0xF800) >> 11){ | 3479 | switch ((tinstr & 0xF800) >> 11) { |
| 3486 | case 26: | 3480 | case 26: |
| 3487 | case 27: | 3481 | case 27: |
| 3488 | if (((tinstr & 0x0F00) != 0x0E00) && ((tinstr & 0x0F00) != 0x0F00)){ | 3482 | if (((tinstr & 0x0F00) != 0x0E00) && ((tinstr & 0x0F00) != 0x0F00)){ |
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.cpp b/src/core/arm/dyncom/arm_dyncom_thumb.cpp index 2860af376..6eb03fb5a 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.cpp +++ b/src/core/arm/dyncom/arm_dyncom_thumb.cpp | |||
| @@ -14,13 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size) { | 15 | tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size) { |
| 16 | tdstate valid = t_uninitialized; | 16 | tdstate valid = t_uninitialized; |
| 17 | u32 tinstr = instr; | 17 | u32 tinstr = GetThumbInstruction(instr, addr); |
| 18 | |||
| 19 | // The endian should be judge here | ||
| 20 | if((addr & 0x3) != 0) | ||
| 21 | tinstr = instr >> 16; | ||
| 22 | else | ||
| 23 | tinstr &= 0xFFFF; | ||
| 24 | 18 | ||
| 25 | *ainstr = 0xDEADC0DE; // Debugging to catch non updates | 19 | *ainstr = 0xDEADC0DE; // Debugging to catch non updates |
| 26 | 20 | ||
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.h b/src/core/arm/dyncom/arm_dyncom_thumb.h index c06f09580..74e69e13a 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.h +++ b/src/core/arm/dyncom/arm_dyncom_thumb.h | |||
| @@ -37,11 +37,12 @@ enum tdstate { | |||
| 37 | 37 | ||
| 38 | tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size); | 38 | tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size); |
| 39 | 39 | ||
| 40 | static inline u32 get_thumb_instr(u32 instr, u32 pc) { | 40 | static inline u32 GetThumbInstruction(u32 instr, u32 address) { |
| 41 | u32 tinstr; | 41 | // Normally you would need to handle instruction endianness, |
| 42 | if ((pc & 0x3) != 0) | 42 | // however, it is fixed to little-endian on the MPCore, so |
| 43 | tinstr = instr >> 16; | 43 | // there's no need to check for this beforehand. |
| 44 | else | 44 | if ((address & 0x3) != 0) |
| 45 | tinstr = instr & 0xFFFF; | 45 | return instr >> 16; |
| 46 | return tinstr; | 46 | |
| 47 | return instr & 0xFFFF; | ||
| 47 | } | 48 | } |