summaryrefslogtreecommitdiffstats
path: root/src/core/arm
diff options
context:
space:
mode:
authorbunnei <ericbunnie@gmail.com>2014-05-17 19:35:20 +0200
committerbunnei <ericbunnie@gmail.com>2014-05-17 19:35:20 +0200
commit3fac6dc39e6e94aa068d93535261eede97224e50 (patch)
tree41b5a266814d633b94d090f13bc46c89e8f7f622 /src/core/arm
parent- added enum ThreadProcessorId (diff)
parentupdated how we call ARM core to make things much faster (diff)
downloadyuzu-3fac6dc39e6e94aa068d93535261eede97224e50.tar
yuzu-3fac6dc39e6e94aa068d93535261eede97224e50.tar.gz
yuzu-3fac6dc39e6e94aa068d93535261eede97224e50.tar.bz2
yuzu-3fac6dc39e6e94aa068d93535261eede97224e50.tar.lz
yuzu-3fac6dc39e6e94aa068d93535261eede97224e50.tar.xz
yuzu-3fac6dc39e6e94aa068d93535261eede97224e50.tar.zst
yuzu-3fac6dc39e6e94aa068d93535261eede97224e50.zip
Diffstat (limited to 'src/core/arm')
-rw-r--r--src/core/arm/arm_interface.h21
-rw-r--r--src/core/arm/interpreter/arm_interpreter.cpp19
-rw-r--r--src/core/arm/interpreter/arm_interpreter.h7
-rw-r--r--src/core/arm/interpreter/armdefs.h1
-rw-r--r--src/core/arm/interpreter/armemu.cpp2
5 files changed, 30 insertions, 20 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 602c91e30..5c382ebbd 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -17,12 +17,20 @@ public:
~ARM_Interface() {
}
+ /**
+ * Runs the CPU for the given number of instructions
+ * @param num_instructions Number of instructions to run
+ */
+ void Run(int num_instructions) {
+ ExecuteInstructions(num_instructions);
+ m_num_instructions += num_instructions;
+ }
+
/// Step CPU by one instruction
void Step() {
- ExecuteInstruction();
- m_num_instructions++;
+ Run(1);
}
-
+
/**
* Set the Program Counter to an address
* @param addr Address to set PC to
@@ -74,8 +82,11 @@ public:
protected:
- /// Execture next instruction
- virtual void ExecuteInstruction() = 0;
+ /**
+ * Executes the given number of instructions
+ * @param num_instructions Number of instructions to executes
+ */
+ virtual void ExecuteInstructions(int num_instructions) = 0;
private:
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index 4e1387fdb..c21ff0464 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -93,16 +93,11 @@ u64 ARM_Interpreter::GetTicks() const {
return ARMul_Time(m_state);
}
-/// Execture next instruction
-void ARM_Interpreter::ExecuteInstruction() {
- m_state->step++;
- m_state->cycle++;
- m_state->EndCondition = 0;
- m_state->stop_simulator = 0;
- m_state->NextInstr = RESUME;
- m_state->last_pc = m_state->Reg[15];
- m_state->Reg[15] = ARMul_DoInstr(m_state);
- m_state->Cpsr = ((m_state->Cpsr & 0x0fffffdf) | (m_state->NFlag << 31) | (m_state->ZFlag << 30) |
- (m_state->CFlag << 29) | (m_state->VFlag << 28) | (m_state->TFlag << 5));
- m_state->NextInstr |= PRIMEPIPE; // Flush pipe
+/**
+ * Executes the given number of instructions
+ * @param num_instructions Number of instructions to executes
+ */
+void ARM_Interpreter::ExecuteInstructions(int num_instructions) {
+ m_state->NumInstrsToExecute = num_instructions;
+ ARMul_Emulate32(m_state);
}
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index 78b188bee..474ba3e45 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -62,8 +62,11 @@ public:
protected:
- /// Execture next instruction
- void ExecuteInstruction();
+ /**
+ * Executes the given number of instructions
+ * @param num_instructions Number of instructions to executes
+ */
+ void ExecuteInstructions(int num_instructions);
private:
diff --git a/src/core/arm/interpreter/armdefs.h b/src/core/arm/interpreter/armdefs.h
index 821825ae6..5b2abc7f7 100644
--- a/src/core/arm/interpreter/armdefs.h
+++ b/src/core/arm/interpreter/armdefs.h
@@ -288,6 +288,7 @@ struct ARMul_State
ARMword loaded_addr, decoded_addr; /* saved pipeline state addr*/
unsigned int NumScycles, NumNcycles, NumIcycles, NumCcycles, NumFcycles; /* emulated cycles used */
unsigned long long NumInstrs; /* the number of instructions executed */
+ unsigned NumInstrsToExecute;
unsigned NextInstr;
unsigned VectorCatch; /* caught exception mask */
unsigned CallDebug; /* set to call the debugger */
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index 87141653f..32e315f4b 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -4734,7 +4734,7 @@ TEST_EMULATE:
else if (state->Emulate != RUN)
break;
}
- while (!state->stop_simulator);
+ while (state->NumInstrsToExecute--);
state->decoded = decoded;
state->loaded = loaded;