diff options
Diffstat (limited to 'src/core/arm')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom.cpp | 4 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 31 | ||||
| -rw-r--r-- | src/core/arm/interpreter/arminit.cpp | 2 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/armdefs.h | 6 |
4 files changed, 18 insertions, 25 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index bc1e969e4..128413262 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.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 "common/make_unique.h" | ||
| 6 | |||
| 5 | #include "core/arm/skyeye_common/armemu.h" | 7 | #include "core/arm/skyeye_common/armemu.h" |
| 6 | #include "core/arm/skyeye_common/vfp/vfp.h" | 8 | #include "core/arm/skyeye_common/vfp/vfp.h" |
| 7 | 9 | ||
| @@ -17,7 +19,7 @@ const static cpu_config_t s_arm11_cpu_info = { | |||
| 17 | }; | 19 | }; |
| 18 | 20 | ||
| 19 | ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { | 21 | ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { |
| 20 | state = std::unique_ptr<ARMul_State>(new ARMul_State); | 22 | state = Common::make_unique<ARMul_State>(); |
| 21 | 23 | ||
| 22 | ARMul_NewState(state.get()); | 24 | ARMul_NewState(state.get()); |
| 23 | ARMul_SelectProcessor(state.get(), ARM_v6_Prop | ARM_v5_Prop | ARM_v5e_Prop); | 25 | ARMul_SelectProcessor(state.get(), ARM_v6_Prop | ARM_v5_Prop | ARM_v5e_Prop); |
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index fde11e4ff..991da740b 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <algorithm> | 7 | #include <algorithm> |
| 8 | #include <cstdio> | 8 | #include <cstdio> |
| 9 | #include <unordered_map> | ||
| 10 | 9 | ||
| 11 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 12 | #include "common/profiler.h" | 11 | #include "common/profiler.h" |
| @@ -3533,25 +3532,6 @@ const transop_fp_t arm_instruction_trans[] = { | |||
| 3533 | INTERPRETER_TRANSLATE(blx_1_thumb) | 3532 | INTERPRETER_TRANSLATE(blx_1_thumb) |
| 3534 | }; | 3533 | }; |
| 3535 | 3534 | ||
| 3536 | typedef std::unordered_map<u32, int> bb_map; | ||
| 3537 | static bb_map CreamCache; | ||
| 3538 | |||
| 3539 | static void insert_bb(unsigned int addr, int start) { | ||
| 3540 | CreamCache[addr] = start; | ||
| 3541 | } | ||
| 3542 | |||
| 3543 | static int find_bb(unsigned int addr, int& start) { | ||
| 3544 | int ret = -1; | ||
| 3545 | bb_map::const_iterator it = CreamCache.find(addr); | ||
| 3546 | if (it != CreamCache.end()) { | ||
| 3547 | start = static_cast<int>(it->second); | ||
| 3548 | ret = 0; | ||
| 3549 | } else { | ||
| 3550 | ret = -1; | ||
| 3551 | } | ||
| 3552 | return ret; | ||
| 3553 | } | ||
| 3554 | |||
| 3555 | enum { | 3535 | enum { |
| 3556 | FETCH_SUCCESS, | 3536 | FETCH_SUCCESS, |
| 3557 | FETCH_FAILURE | 3537 | FETCH_FAILURE |
| @@ -3674,7 +3654,9 @@ translated: | |||
| 3674 | } | 3654 | } |
| 3675 | ret = inst_base->br; | 3655 | ret = inst_base->br; |
| 3676 | }; | 3656 | }; |
| 3677 | insert_bb(pc_start, bb_start); | 3657 | |
| 3658 | cpu->instruction_cache[pc_start] = bb_start; | ||
| 3659 | |||
| 3678 | return KEEP_GOING; | 3660 | return KEEP_GOING; |
| 3679 | } | 3661 | } |
| 3680 | 3662 | ||
| @@ -4001,9 +3983,14 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4001 | 3983 | ||
| 4002 | phys_addr = cpu->Reg[15]; | 3984 | phys_addr = cpu->Reg[15]; |
| 4003 | 3985 | ||
| 4004 | if (find_bb(cpu->Reg[15], ptr) == -1) | 3986 | // Find the cached instruction cream, otherwise translate it... |
| 3987 | auto itr = cpu->instruction_cache.find(cpu->Reg[15]); | ||
| 3988 | if (itr != cpu->instruction_cache.end()) { | ||
| 3989 | ptr = itr->second; | ||
| 3990 | } else { | ||
| 4005 | if (InterpreterTranslate(cpu, ptr, cpu->Reg[15]) == FETCH_EXCEPTION) | 3991 | if (InterpreterTranslate(cpu, ptr, cpu->Reg[15]) == FETCH_EXCEPTION) |
| 4006 | goto END; | 3992 | goto END; |
| 3993 | } | ||
| 4007 | 3994 | ||
| 4008 | inst_base = (arm_inst *)&inst_buf[ptr]; | 3995 | inst_base = (arm_inst *)&inst_buf[ptr]; |
| 4009 | GOTO_NEXT_INST; | 3996 | GOTO_NEXT_INST; |
diff --git a/src/core/arm/interpreter/arminit.cpp b/src/core/arm/interpreter/arminit.cpp index 6ac45c396..31b2bab06 100644 --- a/src/core/arm/interpreter/arminit.cpp +++ b/src/core/arm/interpreter/arminit.cpp | |||
| @@ -26,8 +26,6 @@ | |||
| 26 | \***************************************************************************/ | 26 | \***************************************************************************/ |
| 27 | ARMul_State* ARMul_NewState(ARMul_State* state) | 27 | ARMul_State* ARMul_NewState(ARMul_State* state) |
| 28 | { | 28 | { |
| 29 | memset(state, 0, sizeof(ARMul_State)); | ||
| 30 | |||
| 31 | state->Emulate = RUN; | 29 | state->Emulate = RUN; |
| 32 | state->Mode = USER32MODE; | 30 | state->Mode = USER32MODE; |
| 33 | 31 | ||
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h index 08da6d9eb..85d523bc2 100644 --- a/src/core/arm/skyeye_common/armdefs.h +++ b/src/core/arm/skyeye_common/armdefs.h | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | #pragma once | 18 | #pragma once |
| 19 | 19 | ||
| 20 | #include <unordered_map> | ||
| 21 | |||
| 20 | #include "common/common_types.h" | 22 | #include "common/common_types.h" |
| 21 | #include "core/arm/skyeye_common/arm_regformat.h" | 23 | #include "core/arm/skyeye_common/arm_regformat.h" |
| 22 | #include "core/arm/skyeye_common/skyeye_defs.h" | 24 | #include "core/arm/skyeye_common/skyeye_defs.h" |
| @@ -152,6 +154,10 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model) | |||
| 152 | 154 | ||
| 153 | // Added by ksh in 2005-10-1 | 155 | // Added by ksh in 2005-10-1 |
| 154 | cpu_config_t* cpu; | 156 | cpu_config_t* cpu; |
| 157 | |||
| 158 | // TODO(bunnei): Move this cache to a better place - it should be per codeset (likely per | ||
| 159 | // process for our purposes), not per ARMul_State (which tracks CPU core state). | ||
| 160 | std::unordered_map<u32, int> instruction_cache; | ||
| 155 | }; | 161 | }; |
| 156 | 162 | ||
| 157 | /***************************************************************************\ | 163 | /***************************************************************************\ |