summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2014-12-22 04:30:09 -0200
committerGravatar Yuri Kunde Schlesner2015-01-09 03:51:55 -0200
commit7b3452c7303cf348377de6702ddda0307533663c (patch)
treece08ed7d7c42015919e1dd26cb2ec8721a54ec8a /src
parentMerge pull request #255 from Subv/cbranch_3 (diff)
downloadyuzu-7b3452c7303cf348377de6702ddda0307533663c.tar.gz
yuzu-7b3452c7303cf348377de6702ddda0307533663c.tar.xz
yuzu-7b3452c7303cf348377de6702ddda0307533663c.zip
Move ThreadContext to core/core.h and deal with the fallout
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/debugger/disassembler.cpp1
-rw-r--r--src/core/arm/arm_interface.h8
-rw-r--r--src/core/arm/dyncom/arm_dyncom.cpp5
-rw-r--r--src/core/arm/dyncom/arm_dyncom.h4
-rw-r--r--src/core/arm/interpreter/arm_interpreter.cpp6
-rw-r--r--src/core/arm/interpreter/arm_interpreter.h4
-rw-r--r--src/core/core.cpp1
-rw-r--r--src/core/core.h20
-rw-r--r--src/core/core_timing.cpp2
-rw-r--r--src/core/hle/function_wrappers.h2
-rw-r--r--src/core/hle/hle.cpp1
-rw-r--r--src/core/hle/hle.h2
-rw-r--r--src/core/hle/kernel/kernel.cpp1
-rw-r--r--src/core/hle/kernel/thread.cpp9
-rw-r--r--src/core/hle/service/hid_user.cpp1
-rw-r--r--src/core/hle/svc.cpp1
-rw-r--r--src/core/hle/svc.h15
-rw-r--r--src/core/hw/gpu.cpp2
18 files changed, 53 insertions, 32 deletions
diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp
index 8db73752f..da084ab24 100644
--- a/src/citra_qt/debugger/disassembler.cpp
+++ b/src/citra_qt/debugger/disassembler.cpp
@@ -13,6 +13,7 @@
13#include "core/core.h" 13#include "core/core.h"
14#include "common/break_points.h" 14#include "common/break_points.h"
15#include "common/symbols.h" 15#include "common/symbols.h"
16#include "core/arm/arm_interface.h"
16#include "core/arm/skyeye_common/armdefs.h" 17#include "core/arm/skyeye_common/armdefs.h"
17#include "core/arm/disassembler/arm_disasm.h" 18#include "core/arm/disassembler/arm_disasm.h"
18 19
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index d3bd4a9a3..e612f7439 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -7,7 +7,9 @@
7#include "common/common.h" 7#include "common/common.h"
8#include "common/common_types.h" 8#include "common/common_types.h"
9 9
10#include "core/hle/svc.h" 10namespace Core {
11 struct ThreadContext;
12}
11 13
12/// Generic ARM11 CPU interface 14/// Generic ARM11 CPU interface
13class ARM_Interface : NonCopyable { 15class ARM_Interface : NonCopyable {
@@ -87,13 +89,13 @@ public:
87 * Saves the current CPU context 89 * Saves the current CPU context
88 * @param ctx Thread context to save 90 * @param ctx Thread context to save
89 */ 91 */
90 virtual void SaveContext(ThreadContext& ctx) = 0; 92 virtual void SaveContext(Core::ThreadContext& ctx) = 0;
91 93
92 /** 94 /**
93 * Loads a CPU context 95 * Loads a CPU context
94 * @param ctx Thread context to load 96 * @param ctx Thread context to load
95 */ 97 */
96 virtual void LoadContext(const ThreadContext& ctx) = 0; 98 virtual void LoadContext(const Core::ThreadContext& ctx) = 0;
97 99
98 /// Prepare core for thread reschedule (if needed to correctly handle state) 100 /// Prepare core for thread reschedule (if needed to correctly handle state)
99 virtual void PrepareReschedule() = 0; 101 virtual void PrepareReschedule() = 0;
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp
index 31eb879a2..9c4cc90f2 100644
--- a/src/core/arm/dyncom/arm_dyncom.cpp
+++ b/src/core/arm/dyncom/arm_dyncom.cpp
@@ -9,6 +9,7 @@
9#include "core/arm/dyncom/arm_dyncom.h" 9#include "core/arm/dyncom/arm_dyncom.h"
10#include "core/arm/dyncom/arm_dyncom_interpreter.h" 10#include "core/arm/dyncom/arm_dyncom_interpreter.h"
11 11
12#include "core/core.h"
12#include "core/core_timing.h" 13#include "core/core_timing.h"
13 14
14const static cpu_config_t s_arm11_cpu_info = { 15const static cpu_config_t s_arm11_cpu_info = {
@@ -94,7 +95,7 @@ void ARM_DynCom::ExecuteInstructions(int num_instructions) {
94 AddTicks(ticks_executed); 95 AddTicks(ticks_executed);
95} 96}
96 97
97void ARM_DynCom::SaveContext(ThreadContext& ctx) { 98void ARM_DynCom::SaveContext(Core::ThreadContext& ctx) {
98 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers)); 99 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers));
99 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers)); 100 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers));
100 101
@@ -110,7 +111,7 @@ void ARM_DynCom::SaveContext(ThreadContext& ctx) {
110 ctx.mode = state->NextInstr; 111 ctx.mode = state->NextInstr;
111} 112}
112 113
113void ARM_DynCom::LoadContext(const ThreadContext& ctx) { 114void ARM_DynCom::LoadContext(const Core::ThreadContext& ctx) {
114 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers)); 115 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers));
115 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers)); 116 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers));
116 117
diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h
index 9e102a46e..f16fb070c 100644
--- a/src/core/arm/dyncom/arm_dyncom.h
+++ b/src/core/arm/dyncom/arm_dyncom.h
@@ -71,13 +71,13 @@ public:
71 * Saves the current CPU context 71 * Saves the current CPU context
72 * @param ctx Thread context to save 72 * @param ctx Thread context to save
73 */ 73 */
74 void SaveContext(ThreadContext& ctx) override; 74 void SaveContext(Core::ThreadContext& ctx) override;
75 75
76 /** 76 /**
77 * Loads a CPU context 77 * Loads a CPU context
78 * @param ctx Thread context to load 78 * @param ctx Thread context to load
79 */ 79 */
80 void LoadContext(const ThreadContext& ctx) override; 80 void LoadContext(const Core::ThreadContext& ctx) override;
81 81
82 /// Prepare core for thread reschedule (if needed to correctly handle state) 82 /// Prepare core for thread reschedule (if needed to correctly handle state)
83 void PrepareReschedule() override; 83 void PrepareReschedule() override;
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index 80ebc359e..c76d371a2 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -4,6 +4,8 @@
4 4
5#include "core/arm/interpreter/arm_interpreter.h" 5#include "core/arm/interpreter/arm_interpreter.h"
6 6
7#include "core/core.h"
8
7const static cpu_config_t arm11_cpu_info = { 9const static cpu_config_t arm11_cpu_info = {
8 "armv6", "arm11", 0x0007b000, 0x0007f000, NONCACHE 10 "armv6", "arm11", 0x0007b000, 0x0007f000, NONCACHE
9}; 11};
@@ -75,7 +77,7 @@ void ARM_Interpreter::ExecuteInstructions(int num_instructions) {
75 ARMul_Emulate32(state); 77 ARMul_Emulate32(state);
76} 78}
77 79
78void ARM_Interpreter::SaveContext(ThreadContext& ctx) { 80void ARM_Interpreter::SaveContext(Core::ThreadContext& ctx) {
79 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers)); 81 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers));
80 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers)); 82 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers));
81 83
@@ -91,7 +93,7 @@ void ARM_Interpreter::SaveContext(ThreadContext& ctx) {
91 ctx.mode = state->NextInstr; 93 ctx.mode = state->NextInstr;
92} 94}
93 95
94void ARM_Interpreter::LoadContext(const ThreadContext& ctx) { 96void ARM_Interpreter::LoadContext(const Core::ThreadContext& ctx) {
95 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers)); 97 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers));
96 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers)); 98 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers));
97 99
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index 019dad5df..e5ecc69c2 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -70,13 +70,13 @@ public:
70 * Saves the current CPU context 70 * Saves the current CPU context
71 * @param ctx Thread context to save 71 * @param ctx Thread context to save
72 */ 72 */
73 void SaveContext(ThreadContext& ctx) override; 73 void SaveContext(Core::ThreadContext& ctx) override;
74 74
75 /** 75 /**
76 * Loads a CPU context 76 * Loads a CPU context
77 * @param ctx Thread context to load 77 * @param ctx Thread context to load
78 */ 78 */
79 void LoadContext(const ThreadContext& ctx) override; 79 void LoadContext(const Core::ThreadContext& ctx) override;
80 80
81 /// Prepare core for thread reschedule (if needed to correctly handle state) 81 /// Prepare core for thread reschedule (if needed to correctly handle state)
82 void PrepareReschedule() override; 82 void PrepareReschedule() override;
diff --git a/src/core/core.cpp b/src/core/core.cpp
index ff506d67d..cf25f87ca 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -8,6 +8,7 @@
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9 9
10#include "core/settings.h" 10#include "core/settings.h"
11#include "core/arm/arm_interface.h"
11#include "core/arm/disassembler/arm_disasm.h" 12#include "core/arm/disassembler/arm_disasm.h"
12#include "core/arm/interpreter/arm_interpreter.h" 13#include "core/arm/interpreter/arm_interpreter.h"
13#include "core/arm/dyncom/arm_dyncom.h" 14#include "core/arm/dyncom/arm_dyncom.h"
diff --git a/src/core/core.h b/src/core/core.h
index ecd58a73a..2f5e8bc6b 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -4,8 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/arm/arm_interface.h" 7#include "common/common_types.h"
8#include "core/arm/skyeye_common/armdefs.h" 8
9class ARM_Interface;
9 10
10//////////////////////////////////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////////////////////////////////
11 12
@@ -16,6 +17,21 @@ enum CPUCore {
16 CPU_OldInterpreter, 17 CPU_OldInterpreter,
17}; 18};
18 19
20struct ThreadContext {
21 u32 cpu_registers[13];
22 u32 sp;
23 u32 lr;
24 u32 pc;
25 u32 cpsr;
26 u32 fpu_registers[32];
27 u32 fpscr;
28 u32 fpexc;
29
30 // These are not part of native ThreadContext, but needed by emu
31 u32 reg_15;
32 u32 mode;
33};
34
19extern ARM_Interface* g_app_core; ///< ARM11 application core 35extern ARM_Interface* g_app_core; ///< ARM11 application core
20extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core 36extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core
21 37
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 833199680..ec9d52a08 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -9,6 +9,8 @@
9 9
10#include "common/chunk_file.h" 10#include "common/chunk_file.h"
11#include "common/log.h" 11#include "common/log.h"
12
13#include "core/arm/arm_interface.h"
12#include "core/core.h" 14#include "core/core.h"
13#include "core/core_timing.h" 15#include "core/core_timing.h"
14 16
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 8eb4f252b..a2f51b41b 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -5,6 +5,8 @@
5#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8
9#include "core/arm/arm_interface.h"
8#include "core/mem_map.h" 10#include "core/mem_map.h"
9#include "core/hle/hle.h" 11#include "core/hle/hle.h"
10 12
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index 33ac12507..5d77a1458 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -4,6 +4,7 @@
4 4
5#include <vector> 5#include <vector>
6 6
7#include "core/arm/arm_interface.h"
7#include "core/mem_map.h" 8#include "core/mem_map.h"
8#include "core/hle/hle.h" 9#include "core/hle/hle.h"
9#include "core/hle/kernel/thread.h" 10#include "core/hle/kernel/thread.h"
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index 59b770f02..3f6f9a4b5 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -4,6 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <string>
8
7#include "common/common_types.h" 9#include "common/common_types.h"
8#include "core/core.h" 10#include "core/core.h"
9 11
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 391e833c0..1537702cf 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -6,6 +6,7 @@
6 6
7#include "common/common.h" 7#include "common/common.h"
8 8
9#include "core/arm/arm_interface.h"
9#include "core/core.h" 10#include "core/core.h"
10#include "core/hle/kernel/kernel.h" 11#include "core/hle/kernel/kernel.h"
11#include "core/hle/kernel/thread.h" 12#include "core/hle/kernel/thread.h"
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 954bd09a0..3e9ea464d 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -10,6 +10,7 @@
10#include "common/common.h" 10#include "common/common.h"
11#include "common/thread_queue_list.h" 11#include "common/thread_queue_list.h"
12 12
13#include "core/arm/arm_interface.h"
13#include "core/core.h" 14#include "core/core.h"
14#include "core/core_timing.h" 15#include "core/core_timing.h"
15#include "core/hle/hle.h" 16#include "core/hle/hle.h"
@@ -50,7 +51,7 @@ public:
50 return MakeResult<bool>(wait); 51 return MakeResult<bool>(wait);
51 } 52 }
52 53
53 ThreadContext context; 54 Core::ThreadContext context;
54 55
55 u32 thread_id; 56 u32 thread_id;
56 57
@@ -104,18 +105,18 @@ inline void SetCurrentThread(Thread* t) {
104} 105}
105 106
106/// Saves the current CPU context 107/// Saves the current CPU context
107void SaveContext(ThreadContext& ctx) { 108void SaveContext(Core::ThreadContext& ctx) {
108 Core::g_app_core->SaveContext(ctx); 109 Core::g_app_core->SaveContext(ctx);
109} 110}
110 111
111/// Loads a CPU context 112/// Loads a CPU context
112void LoadContext(ThreadContext& ctx) { 113void LoadContext(Core::ThreadContext& ctx) {
113 Core::g_app_core->LoadContext(ctx); 114 Core::g_app_core->LoadContext(ctx);
114} 115}
115 116
116/// Resets a thread 117/// Resets a thread
117void ResetThread(Thread* t, u32 arg, s32 lowest_priority) { 118void ResetThread(Thread* t, u32 arg, s32 lowest_priority) {
118 memset(&t->context, 0, sizeof(ThreadContext)); 119 memset(&t->context, 0, sizeof(Core::ThreadContext));
119 120
120 t->context.cpu_registers[0] = arg; 121 t->context.cpu_registers[0] = arg;
121 t->context.pc = t->context.reg_15 = t->entry_point; 122 t->context.pc = t->context.reg_15 = t->entry_point;
diff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cpp
index 99b0ea5a0..8ef9af9d2 100644
--- a/src/core/hle/service/hid_user.cpp
+++ b/src/core/hle/service/hid_user.cpp
@@ -4,6 +4,7 @@
4 4
5#include "common/log.h" 5#include "common/log.h"
6 6
7#include "core/arm/arm_interface.h"
7#include "core/hle/hle.h" 8#include "core/hle/hle.h"
8#include "core/hle/kernel/event.h" 9#include "core/hle/kernel/event.h"
9#include "core/hle/kernel/shared_memory.h" 10#include "core/hle/kernel/shared_memory.h"
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index cdcdea36d..92de442e8 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -7,6 +7,7 @@
7#include "common/string_util.h" 7#include "common/string_util.h"
8#include "common/symbols.h" 8#include "common/symbols.h"
9 9
10#include "core/arm/arm_interface.h"
10#include "core/mem_map.h" 11#include "core/mem_map.h"
11 12
12#include "core/hle/kernel/address_arbiter.h" 13#include "core/hle/kernel/address_arbiter.h"
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h
index ad780818e..5d020a5ba 100644
--- a/src/core/hle/svc.h
+++ b/src/core/hle/svc.h
@@ -20,21 +20,6 @@ struct PageInfo {
20 u32 flags; 20 u32 flags;
21}; 21};
22 22
23struct ThreadContext {
24 u32 cpu_registers[13];
25 u32 sp;
26 u32 lr;
27 u32 pc;
28 u32 cpsr;
29 u32 fpu_registers[32];
30 u32 fpscr;
31 u32 fpexc;
32
33 // These are not part of native ThreadContext, but needed by emu
34 u32 reg_15;
35 u32 mode;
36};
37
38enum ResetType { 23enum ResetType {
39 RESETTYPE_ONESHOT, 24 RESETTYPE_ONESHOT,
40 RESETTYPE_STICKY, 25 RESETTYPE_STICKY,
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index e346e0ad6..3b730a0de 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -4,6 +4,8 @@
4 4
5#include "common/common_types.h" 5#include "common/common_types.h"
6 6
7#include "core/arm/arm_interface.h"
8
7#include "core/settings.h" 9#include "core/settings.h"
8#include "core/core.h" 10#include "core/core.h"
9#include "core/mem_map.h" 11#include "core/mem_map.h"