summaryrefslogtreecommitdiff
path: root/src/core/core.h
diff options
context:
space:
mode:
authorGravatar bunnei2018-05-02 22:36:51 -0400
committerGravatar bunnei2018-05-10 19:34:46 -0400
commita434fdcb102e96ddf564dc0973d7073d49bf19fc (patch)
treede758b0cc5ebcb67146397a74474fb898c0be51a /src/core/core.h
parentcore: Create a thread for each CPU core, keep in lock-step with a barrier. (diff)
downloadyuzu-a434fdcb102e96ddf564dc0973d7073d49bf19fc.tar.gz
yuzu-a434fdcb102e96ddf564dc0973d7073d49bf19fc.tar.xz
yuzu-a434fdcb102e96ddf564dc0973d7073d49bf19fc.zip
core: Implement multicore support.
Diffstat (limited to 'src/core/core.h')
-rw-r--r--src/core/core.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/core/core.h b/src/core/core.h
index 21a0b074b..3e0a7e6a7 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -108,20 +108,26 @@ public:
108 108
109 PerfStats::Results GetAndResetPerfStats(); 109 PerfStats::Results GetAndResetPerfStats();
110 110
111 /** 111 ARM_Interface& CurrentArmInterface() {
112 * Gets a reference to the emulated CPU. 112 return CurrentCpuCore().ArmInterface();
113 * @returns A reference to the emulated CPU. 113 }
114 */ 114
115 ARM_Interface& CPU() { 115 ARM_Interface& ArmInterface(size_t core_index) {
116 return CurrentCpuCore().CPU(); 116 ASSERT(core_index < NUM_CPU_CORES);
117 return cpu_cores[core_index]->ArmInterface();
117 } 118 }
118 119
119 Tegra::GPU& GPU() { 120 Tegra::GPU& GPU() {
120 return *gpu_core; 121 return *gpu_core;
121 } 122 }
122 123
123 Kernel::Scheduler& Scheduler() { 124 Kernel::Scheduler& CurrentScheduler() {
124 return CurrentCpuCore().Scheduler(); 125 return *CurrentCpuCore().Scheduler();
126 }
127
128 const std::shared_ptr<Kernel::Scheduler>& Scheduler(size_t core_index) {
129 ASSERT(core_index < NUM_CPU_CORES);
130 return cpu_cores[core_index]->Scheduler();
125 } 131 }
126 132
127 Kernel::SharedPtr<Kernel::Process>& CurrentProcess() { 133 Kernel::SharedPtr<Kernel::Process>& CurrentProcess() {
@@ -198,8 +204,8 @@ private:
198 std::map<std::thread::id, std::shared_ptr<Cpu>> thread_to_cpu; 204 std::map<std::thread::id, std::shared_ptr<Cpu>> thread_to_cpu;
199}; 205};
200 206
201inline ARM_Interface& CPU() { 207inline ARM_Interface& CurrentArmInterface() {
202 return System::GetInstance().CPU(); 208 return System::GetInstance().CurrentArmInterface();
203} 209}
204 210
205inline TelemetrySession& Telemetry() { 211inline TelemetrySession& Telemetry() {