diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 8 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_run.h | 41 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.cpp | 2 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.h | 4 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/skyeye_defs.h | 25 |
5 files changed, 30 insertions, 50 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 65fe8a055..fde11e4ff 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -3557,7 +3557,7 @@ enum { | |||
| 3557 | FETCH_FAILURE | 3557 | FETCH_FAILURE |
| 3558 | }; | 3558 | }; |
| 3559 | 3559 | ||
| 3560 | static tdstate decode_thumb_instr(ARMul_State* cpu, uint32_t inst, addr_t addr, uint32_t* arm_inst, uint32_t* inst_size, ARM_INST_PTR* ptr_inst_base){ | 3560 | static tdstate decode_thumb_instr(ARMul_State* cpu, u32 inst, u32 addr, u32* arm_inst, u32* inst_size, ARM_INST_PTR* ptr_inst_base) { |
| 3561 | // Check if in Thumb mode | 3561 | // Check if in Thumb mode |
| 3562 | tdstate ret = thumb_translate (addr, inst, arm_inst, inst_size); | 3562 | tdstate ret = thumb_translate (addr, inst, arm_inst, inst_size); |
| 3563 | if(ret == t_branch){ | 3563 | if(ret == t_branch){ |
| @@ -3620,7 +3620,7 @@ typedef struct instruction_set_encoding_item ISEITEM; | |||
| 3620 | 3620 | ||
| 3621 | extern const ISEITEM arm_instruction[]; | 3621 | extern const ISEITEM arm_instruction[]; |
| 3622 | 3622 | ||
| 3623 | static int InterpreterTranslate(ARMul_State* cpu, int& bb_start, addr_t addr) { | 3623 | static int InterpreterTranslate(ARMul_State* cpu, int& bb_start, u32 addr) { |
| 3624 | Common::Profiling::ScopeTimer timer_decode(profile_decode); | 3624 | Common::Profiling::ScopeTimer timer_decode(profile_decode); |
| 3625 | 3625 | ||
| 3626 | // Decode instruction, get index | 3626 | // Decode instruction, get index |
| @@ -3638,8 +3638,8 @@ static int InterpreterTranslate(ARMul_State* cpu, int& bb_start, addr_t addr) { | |||
| 3638 | if (cpu->TFlag) | 3638 | if (cpu->TFlag) |
| 3639 | thumb = THUMB; | 3639 | thumb = THUMB; |
| 3640 | 3640 | ||
| 3641 | addr_t phys_addr = addr; | 3641 | u32 phys_addr = addr; |
| 3642 | addr_t pc_start = cpu->Reg[15]; | 3642 | u32 pc_start = cpu->Reg[15]; |
| 3643 | 3643 | ||
| 3644 | while(ret == NON_BRANCH) { | 3644 | while(ret == NON_BRANCH) { |
| 3645 | inst = Memory::Read32(phys_addr & 0xFFFFFFFC); | 3645 | inst = Memory::Read32(phys_addr & 0xFFFFFFFC); |
diff --git a/src/core/arm/dyncom/arm_dyncom_run.h b/src/core/arm/dyncom/arm_dyncom_run.h index e17420497..85774c565 100644 --- a/src/core/arm/dyncom/arm_dyncom_run.h +++ b/src/core/arm/dyncom/arm_dyncom_run.h | |||
| @@ -22,31 +22,36 @@ | |||
| 22 | 22 | ||
| 23 | void switch_mode(ARMul_State* core, uint32_t mode); | 23 | void switch_mode(ARMul_State* core, uint32_t mode); |
| 24 | 24 | ||
| 25 | /* FIXME, we temporarily think thumb instruction is always 16 bit */ | 25 | // Note that for the 3DS, a Thumb instruction will only ever be |
| 26 | // two bytes in size. Thus we don't need to worry about ThumbEE | ||
| 27 | // or Thumb-2 where instructions can be 4 bytes in length. | ||
| 26 | static inline u32 GET_INST_SIZE(ARMul_State* core) { | 28 | static inline u32 GET_INST_SIZE(ARMul_State* core) { |
| 27 | return core->TFlag? 2 : 4; | 29 | return core->TFlag? 2 : 4; |
| 28 | } | 30 | } |
| 29 | 31 | ||
| 30 | /** | 32 | /** |
| 31 | * @brief Read R15 and forced R15 to wold align, used address calculation | 33 | * Checks if the PC is being read, and if so, word-aligns it. |
| 32 | * | 34 | * Used with address calculations. |
| 33 | * @param core | 35 | * |
| 34 | * @param Rn | 36 | * @param core The ARM CPU state instance. |
| 35 | * | 37 | * @param Rn The register being read. |
| 36 | * @return | 38 | * |
| 37 | */ | 39 | * @return If the PC is being read, then the word-aligned PC value is returned. |
| 38 | static inline addr_t CHECK_READ_REG15_WA(ARMul_State* core, int Rn) { | 40 | * If the PC is not being read, then the value stored in the register is returned. |
| 39 | return (Rn == 15)? ((core->Reg[15] & ~0x3) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; | 41 | */ |
| 42 | static inline u32 CHECK_READ_REG15_WA(ARMul_State* core, int Rn) { | ||
| 43 | return (Rn == 15) ? ((core->Reg[15] & ~0x3) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; | ||
| 40 | } | 44 | } |
| 41 | 45 | ||
| 42 | /** | 46 | /** |
| 43 | * @brief Read R15, used to data processing with pc | 47 | * Reads the PC. Used for data processing operations that use the PC. |
| 44 | * | 48 | * |
| 45 | * @param core | 49 | * @param core The ARM CPU state instance. |
| 46 | * @param Rn | 50 | * @param Rn The register being read. |
| 47 | * | 51 | * |
| 48 | * @return | 52 | * @return If the PC is being read, then the incremented PC value is returned. |
| 49 | */ | 53 | * If the PC is not being read, then the values stored in the register is returned. |
| 54 | */ | ||
| 50 | static inline u32 CHECK_READ_REG15(ARMul_State* core, int Rn) { | 55 | static inline u32 CHECK_READ_REG15(ARMul_State* core, int Rn) { |
| 51 | return (Rn == 15)? ((core->Reg[15] & ~0x1) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; | 56 | return (Rn == 15) ? ((core->Reg[15] & ~0x1) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; |
| 52 | } | 57 | } |
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.cpp b/src/core/arm/dyncom/arm_dyncom_thumb.cpp index e30d515fb..bfb45f104 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.cpp +++ b/src/core/arm/dyncom/arm_dyncom_thumb.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | // with the following Thumb instruction held in the high 16-bits. Passing in two Thumb instructions | 13 | // with the following Thumb instruction held in the high 16-bits. Passing in two Thumb instructions |
| 14 | // allows easier simulation of the special dual BL instruction. | 14 | // allows easier simulation of the special dual BL instruction. |
| 15 | 15 | ||
| 16 | tdstate thumb_translate(addr_t addr, uint32_t instr, uint32_t* ainstr, uint32_t* inst_size) { | 16 | tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size) { |
| 17 | tdstate valid = t_uninitialized; | 17 | tdstate valid = t_uninitialized; |
| 18 | ARMword tinstr = instr; | 18 | ARMword tinstr = instr; |
| 19 | 19 | ||
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.h b/src/core/arm/dyncom/arm_dyncom_thumb.h index a1785abb8..8394ff156 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.h +++ b/src/core/arm/dyncom/arm_dyncom_thumb.h | |||
| @@ -35,9 +35,9 @@ enum tdstate { | |||
| 35 | t_uninitialized, | 35 | t_uninitialized, |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | tdstate thumb_translate(addr_t 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, addr_t pc) { | 40 | static inline u32 get_thumb_instr(u32 instr, u32 pc) { |
| 41 | u32 tinstr; | 41 | u32 tinstr; |
| 42 | if ((pc & 0x3) != 0) | 42 | if ((pc & 0x3) != 0) |
| 43 | tinstr = instr >> 16; | 43 | tinstr = instr >> 16; |
diff --git a/src/core/arm/skyeye_common/skyeye_defs.h b/src/core/arm/skyeye_common/skyeye_defs.h index edf6097e0..94b02459d 100644 --- a/src/core/arm/skyeye_common/skyeye_defs.h +++ b/src/core/arm/skyeye_common/skyeye_defs.h | |||
| @@ -11,28 +11,3 @@ struct cpu_config_t | |||
| 11 | u32 cpu_mask; // cpu_val's mask. | 11 | u32 cpu_mask; // cpu_val's mask. |
| 12 | u32 cachetype; // CPU cache type | 12 | u32 cachetype; // CPU cache type |
| 13 | }; | 13 | }; |
| 14 | |||
| 15 | enum { | ||
| 16 | // No exception | ||
| 17 | No_exp = 0, | ||
| 18 | // Memory allocation exception | ||
| 19 | Malloc_exp, | ||
| 20 | // File open exception | ||
| 21 | File_open_exp, | ||
| 22 | // DLL open exception | ||
| 23 | Dll_open_exp, | ||
| 24 | // Invalid argument exception | ||
| 25 | Invarg_exp, | ||
| 26 | // Invalid module exception | ||
| 27 | Invmod_exp, | ||
| 28 | // wrong format exception for config file parsing | ||
| 29 | Conf_format_exp, | ||
| 30 | // some reference excess the predefiend range. Such as the index out of array range | ||
| 31 | Excess_range_exp, | ||
| 32 | // Can not find the desirable result | ||
| 33 | Not_found_exp, | ||
| 34 | // Unknown exception | ||
| 35 | Unknown_exp | ||
| 36 | }; | ||
| 37 | |||
| 38 | typedef u32 addr_t; | ||