summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/dyncom/arm_dyncom.cpp7
-rw-r--r--src/core/arm/skyeye_common/arminit.cpp32
-rw-r--r--src/core/arm/skyeye_common/armstate.h20
-rw-r--r--src/core/arm/skyeye_common/armsupp.h2
4 files changed, 2 insertions, 59 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp
index 8d4a7dd98..a51a3acf8 100644
--- a/src/core/arm/dyncom/arm_dyncom.cpp
+++ b/src/core/arm/dyncom/arm_dyncom.cpp
@@ -20,15 +20,8 @@
20ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { 20ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) {
21 state = Common::make_unique<ARMul_State>(); 21 state = Common::make_unique<ARMul_State>();
22 22
23 ARMul_NewState(state.get());
24 ARMul_SelectProcessor(state.get(), ARM_v6_Prop | ARM_v5_Prop | ARM_v5e_Prop);
25
26 state->bigendSig = LOW;
27 state->NirqSig = HIGH;
28
29 // Reset the core to initial state 23 // Reset the core to initial state
30 ARMul_Reset(state.get()); 24 ARMul_Reset(state.get());
31 state->Emulate = RUN;
32 25
33 // Switch to the desired privilege mode. 26 // Switch to the desired privilege mode.
34 switch_mode(state.get(), initial_mode); 27 switch_mode(state.get(), initial_mode);
diff --git a/src/core/arm/skyeye_common/arminit.cpp b/src/core/arm/skyeye_common/arminit.cpp
index 4e868f86b..b7c508d75 100644
--- a/src/core/arm/skyeye_common/arminit.cpp
+++ b/src/core/arm/skyeye_common/arminit.cpp
@@ -19,33 +19,6 @@
19#include "core/arm/skyeye_common/armstate.h" 19#include "core/arm/skyeye_common/armstate.h"
20#include "core/arm/skyeye_common/vfp/vfp.h" 20#include "core/arm/skyeye_common/vfp/vfp.h"
21 21
22/***************************************************************************\
23* Returns a new instantiation of the ARMulator's state *
24\***************************************************************************/
25ARMul_State* ARMul_NewState(ARMul_State* state)
26{
27 state->Emulate = RUN;
28 state->Mode = USER32MODE;
29
30 state->lateabtSig = HIGH;
31 state->bigendSig = LOW;
32
33 return state;
34}
35
36/***************************************************************************\
37* Call this routine to set ARMulator to model a certain processor *
38\***************************************************************************/
39
40void ARMul_SelectProcessor(ARMul_State* state, unsigned properties)
41{
42 state->is_v4 = (properties & (ARM_v4_Prop | ARM_v5_Prop)) != 0;
43 state->is_v5 = (properties & ARM_v5_Prop) != 0;
44 state->is_v5e = (properties & ARM_v5e_Prop) != 0;
45 state->is_v6 = (properties & ARM_v6_Prop) != 0;
46 state->is_v7 = (properties & ARM_v7_Prop) != 0;
47}
48
49// Resets certain MPCore CP15 values to their ARM-defined reset values. 22// Resets certain MPCore CP15 values to their ARM-defined reset values.
50static void ResetMPCoreCP15Registers(ARMul_State* cpu) 23static void ResetMPCoreCP15Registers(ARMul_State* cpu)
51{ 24{
@@ -104,9 +77,7 @@ static void ResetMPCoreCP15Registers(ARMul_State* cpu)
104 cpu->CP15[CP15_TLB_DEBUG_CONTROL] = 0x00000000; 77 cpu->CP15[CP15_TLB_DEBUG_CONTROL] = 0x00000000;
105} 78}
106 79
107/***************************************************************************\ 80// Performs a reset
108* Call this routine to set up the initial machine state (or perform a RESET *
109\***************************************************************************/
110void ARMul_Reset(ARMul_State* state) 81void ARMul_Reset(ARMul_State* state)
111{ 82{
112 VFPInit(state); 83 VFPInit(state);
@@ -125,4 +96,5 @@ void ARMul_Reset(ARMul_State* state)
125 state->abortSig = LOW; 96 state->abortSig = LOW;
126 97
127 state->NumInstrs = 0; 98 state->NumInstrs = 0;
99 state->Emulate = RUN;
128} 100}
diff --git a/src/core/arm/skyeye_common/armstate.h b/src/core/arm/skyeye_common/armstate.h
index 0a165bcf0..3ba0ba5cd 100644
--- a/src/core/arm/skyeye_common/armstate.h
+++ b/src/core/arm/skyeye_common/armstate.h
@@ -89,31 +89,12 @@ struct ARMul_State
89 unsigned bigendSig; 89 unsigned bigendSig;
90 unsigned syscallSig; 90 unsigned syscallSig;
91 91
92 // For differentiating ARM core emulation.
93 bool is_v4; // Are we emulating a v4 architecture (or higher)?
94 bool is_v5; // Are we emulating a v5 architecture?
95 bool is_v5e; // Are we emulating a v5e architecture?
96 bool is_v6; // Are we emulating a v6 architecture?
97 bool is_v7; // Are we emulating a v7 architecture?
98
99 // TODO(bunnei): Move this cache to a better place - it should be per codeset (likely per 92 // TODO(bunnei): Move this cache to a better place - it should be per codeset (likely per
100 // process for our purposes), not per ARMul_State (which tracks CPU core state). 93 // process for our purposes), not per ARMul_State (which tracks CPU core state).
101 std::unordered_map<u32, int> instruction_cache; 94 std::unordered_map<u32, int> instruction_cache;
102}; 95};
103 96
104/***************************************************************************\ 97/***************************************************************************\
105* Types of ARM we know about *
106\***************************************************************************/
107
108enum {
109 ARM_v4_Prop = 0x01,
110 ARM_v5_Prop = 0x02,
111 ARM_v5e_Prop = 0x04,
112 ARM_v6_Prop = 0x08,
113 ARM_v7_Prop = 0x10,
114};
115
116/***************************************************************************\
117* The hardware vector addresses * 98* The hardware vector addresses *
118\***************************************************************************/ 99\***************************************************************************/
119 100
@@ -167,7 +148,6 @@ enum {
167* Definitions of things in the emulator * 148* Definitions of things in the emulator *
168\***************************************************************************/ 149\***************************************************************************/
169void ARMul_Reset(ARMul_State* state); 150void ARMul_Reset(ARMul_State* state);
170ARMul_State* ARMul_NewState(ARMul_State* state);
171 151
172/***************************************************************************\ 152/***************************************************************************\
173* Definitions of things in the co-processor interface * 153* Definitions of things in the co-processor interface *
diff --git a/src/core/arm/skyeye_common/armsupp.h b/src/core/arm/skyeye_common/armsupp.h
index d82b21107..5cf1cd1d3 100644
--- a/src/core/arm/skyeye_common/armsupp.h
+++ b/src/core/arm/skyeye_common/armsupp.h
@@ -17,8 +17,6 @@ struct ARMul_State;
17bool AddOverflow(u32, u32, u32); 17bool AddOverflow(u32, u32, u32);
18bool SubOverflow(u32, u32, u32); 18bool SubOverflow(u32, u32, u32);
19 19
20void ARMul_SelectProcessor(ARMul_State*, unsigned);
21
22u32 AddWithCarry(u32, u32, u32, bool*, bool*); 20u32 AddWithCarry(u32, u32, u32, bool*, bool*);
23bool ARMul_AddOverflowQ(u32, u32); 21bool ARMul_AddOverflowQ(u32, u32);
24 22