summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/citra/citra.cpp12
-rw-r--r--src/citra_qt/bootmanager.cpp3
-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
-rw-r--r--src/core/core.cpp9
8 files changed, 44 insertions, 30 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index d55b97393..6f3bc6f84 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -18,26 +18,24 @@
18int __cdecl main(int argc, char **argv) { 18int __cdecl main(int argc, char **argv) {
19 std::string program_dir = File::GetCurrentDir(); 19 std::string program_dir = File::GetCurrentDir();
20 20
21 LogManager::Init(); 21 LogManager::Init();
22 22
23 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW; 23 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
24 24
25 System::Init(emu_window); 25 System::Init(emu_window);
26 26
27 std::string boot_filename = "homebrew.elf"; 27 std::string boot_filename = "homebrew.elf";
28 std::string error_str; 28 std::string error_str;
29 29
30 bool res = Loader::LoadFile(boot_filename, &error_str); 30 bool res = Loader::LoadFile(boot_filename, &error_str);
31 31
32 if (!res) { 32 if (!res) {
33 ERROR_LOG(BOOT, "Failed to load ROM: %s", error_str.c_str()); 33 ERROR_LOG(BOOT, "Failed to load ROM: %s", error_str.c_str());
34 } 34 }
35 35
36 for (;;) { 36 Core::RunLoop();
37 Core::SingleStep();
38 }
39 37
40 delete emu_window; 38 delete emu_window;
41 39
42 return 0; 40 return 0;
43} 41}
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 31958ac28..cf9e1bffc 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -6,6 +6,8 @@
6 6
7#include "core/core.h" 7#include "core/core.h"
8#include "core/loader.h" 8#include "core/loader.h"
9#include "core/hw/hw.h"
10
9#include "video_core/video_core.h" 11#include "video_core/video_core.h"
10 12
11#include "version.h" 13#include "version.h"
@@ -40,6 +42,7 @@ void EmuThread::run()
40 emit CPUStepped(); 42 emit CPUStepped();
41 } 43 }
42 } 44 }
45 HW::Update();
43 } 46 }
44 47
45 Core::Stop(); 48 Core::Stop();
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 4dfe0570b..9fdc7ba3c 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -17,12 +17,20 @@ public:
17 ~ARM_Interface() { 17 ~ARM_Interface() {
18 } 18 }
19 19
20 /**
21 * Runs the CPU for the given number of instructions
22 * @param num_instructions Number of instructions to run
23 */
24 void Run(int num_instructions) {
25 ExecuteInstructions(num_instructions);
26 m_num_instructions += num_instructions;
27 }
28
20 /// Step CPU by one instruction 29 /// Step CPU by one instruction
21 void Step() { 30 void Step() {
22 ExecuteInstruction(); 31 Run(1);
23 m_num_instructions++;
24 } 32 }
25 33
26 /** 34 /**
27 * Set the Program Counter to an address 35 * Set the Program Counter to an address
28 * @param addr Address to set PC to 36 * @param addr Address to set PC to
@@ -68,8 +76,11 @@ public:
68 76
69protected: 77protected:
70 78
71 /// Execture next instruction 79 /**
72 virtual void ExecuteInstruction() = 0; 80 * Executes the given number of instructions
81 * @param num_instructions Number of instructions to executes
82 */
83 virtual void ExecuteInstructions(int num_instructions) = 0;
73 84
74private: 85private:
75 86
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index 4652803de..23d96d292 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -85,16 +85,11 @@ u64 ARM_Interpreter::GetTicks() const {
85 return ARMul_Time(m_state); 85 return ARMul_Time(m_state);
86} 86}
87 87
88/// Execture next instruction 88/**
89void ARM_Interpreter::ExecuteInstruction() { 89 * Executes the given number of instructions
90 m_state->step++; 90 * @param num_instructions Number of instructions to executes
91 m_state->cycle++; 91 */
92 m_state->EndCondition = 0; 92void ARM_Interpreter::ExecuteInstructions(int num_instructions) {
93 m_state->stop_simulator = 0; 93 m_state->NumInstrsToExecute = num_instructions;
94 m_state->NextInstr = RESUME; 94 ARMul_Emulate32(m_state);
95 m_state->last_pc = m_state->Reg[15];
96 m_state->Reg[15] = ARMul_DoInstr(m_state);
97 m_state->Cpsr = ((m_state->Cpsr & 0x0fffffdf) | (m_state->NFlag << 31) | (m_state->ZFlag << 30) |
98 (m_state->CFlag << 29) | (m_state->VFlag << 28) | (m_state->TFlag << 5));
99 m_state->NextInstr |= PRIMEPIPE; // Flush pipe
100} 95}
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index 625c0c652..509025080 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -56,8 +56,11 @@ public:
56 56
57protected: 57protected:
58 58
59 /// Execture next instruction 59 /**
60 void ExecuteInstruction(); 60 * Executes the given number of instructions
61 * @param num_instructions Number of instructions to executes
62 */
63 void ExecuteInstructions(int num_instructions);
61 64
62private: 65private:
63 66
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
288 ARMword loaded_addr, decoded_addr; /* saved pipeline state addr*/ 288 ARMword loaded_addr, decoded_addr; /* saved pipeline state addr*/
289 unsigned int NumScycles, NumNcycles, NumIcycles, NumCcycles, NumFcycles; /* emulated cycles used */ 289 unsigned int NumScycles, NumNcycles, NumIcycles, NumCcycles, NumFcycles; /* emulated cycles used */
290 unsigned long long NumInstrs; /* the number of instructions executed */ 290 unsigned long long NumInstrs; /* the number of instructions executed */
291 unsigned NumInstrsToExecute;
291 unsigned NextInstr; 292 unsigned NextInstr;
292 unsigned VectorCatch; /* caught exception mask */ 293 unsigned VectorCatch; /* caught exception mask */
293 unsigned CallDebug; /* set to call the debugger */ 294 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:
4734 else if (state->Emulate != RUN) 4734 else if (state->Emulate != RUN)
4735 break; 4735 break;
4736 } 4736 }
4737 while (!state->stop_simulator); 4737 while (state->NumInstrsToExecute--);
4738 4738
4739 state->decoded = decoded; 4739 state->decoded = decoded;
4740 state->loaded = loaded; 4740 state->loaded = loaded;
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 859a62c78..61c237b2c 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -4,8 +4,9 @@
4 4
5#include "common/common_types.h" 5#include "common/common_types.h"
6#include "common/log.h" 6#include "common/log.h"
7#include "core/core.h" 7#include "common/symbols.h"
8 8
9#include "core/core.h"
9#include "core/mem_map.h" 10#include "core/mem_map.h"
10#include "core/hw/hw.h" 11#include "core/hw/hw.h"
11#include "core/arm/disassembler/arm_disasm.h" 12#include "core/arm/disassembler/arm_disasm.h"
@@ -19,13 +20,15 @@ ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core
19 20
20/// Run the core CPU loop 21/// Run the core CPU loop
21void RunLoop() { 22void RunLoop() {
22 // TODO(ShizZy): ImplementMe 23 for (;;){
24 g_app_core->Run(10000);
25 HW::Update();
26 }
23} 27}
24 28
25/// Step the CPU one instruction 29/// Step the CPU one instruction
26void SingleStep() { 30void SingleStep() {
27 g_app_core->Step(); 31 g_app_core->Step();
28 HW::Update();
29} 32}
30 33
31/// Halt the core 34/// Halt the core