summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/core.cpp6
-rw-r--r--src/core/core_cpu.cpp9
-rw-r--r--src/core/core_cpu.h6
3 files changed, 10 insertions, 11 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 32baa40dc..1b9b1f608 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -139,10 +139,10 @@ struct System::Impl {
139 auto main_process = Kernel::Process::Create(kernel, "main"); 139 auto main_process = Kernel::Process::Create(kernel, "main");
140 kernel.MakeCurrentProcess(main_process.get()); 140 kernel.MakeCurrentProcess(main_process.get());
141 141
142 cpu_barrier = std::make_shared<CpuBarrier>(); 142 cpu_barrier = std::make_unique<CpuBarrier>();
143 cpu_exclusive_monitor = Cpu::MakeExclusiveMonitor(cpu_cores.size()); 143 cpu_exclusive_monitor = Cpu::MakeExclusiveMonitor(cpu_cores.size());
144 for (std::size_t index = 0; index < cpu_cores.size(); ++index) { 144 for (std::size_t index = 0; index < cpu_cores.size(); ++index) {
145 cpu_cores[index] = std::make_shared<Cpu>(cpu_exclusive_monitor, cpu_barrier, index); 145 cpu_cores[index] = std::make_shared<Cpu>(cpu_exclusive_monitor, *cpu_barrier, index);
146 } 146 }
147 147
148 telemetry_session = std::make_unique<Core::TelemetrySession>(); 148 telemetry_session = std::make_unique<Core::TelemetrySession>();
@@ -283,7 +283,7 @@ struct System::Impl {
283 std::unique_ptr<Tegra::GPU> gpu_core; 283 std::unique_ptr<Tegra::GPU> gpu_core;
284 std::shared_ptr<Tegra::DebugContext> debug_context; 284 std::shared_ptr<Tegra::DebugContext> debug_context;
285 std::shared_ptr<ExclusiveMonitor> cpu_exclusive_monitor; 285 std::shared_ptr<ExclusiveMonitor> cpu_exclusive_monitor;
286 std::shared_ptr<CpuBarrier> cpu_barrier; 286 std::unique_ptr<CpuBarrier> cpu_barrier;
287 std::array<std::shared_ptr<Cpu>, NUM_CPU_CORES> cpu_cores; 287 std::array<std::shared_ptr<Cpu>, NUM_CPU_CORES> cpu_cores;
288 std::array<std::unique_ptr<std::thread>, NUM_CPU_CORES - 1> cpu_core_threads; 288 std::array<std::unique_ptr<std::thread>, NUM_CPU_CORES - 1> cpu_core_threads;
289 std::size_t active_core{}; ///< Active core, only used in single thread mode 289 std::size_t active_core{}; ///< Active core, only used in single thread mode
diff --git a/src/core/core_cpu.cpp b/src/core/core_cpu.cpp
index 265f8ed9c..928262c9b 100644
--- a/src/core/core_cpu.cpp
+++ b/src/core/core_cpu.cpp
@@ -49,10 +49,9 @@ bool CpuBarrier::Rendezvous() {
49 return false; 49 return false;
50} 50}
51 51
52Cpu::Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, 52Cpu::Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, CpuBarrier& cpu_barrier,
53 std::shared_ptr<CpuBarrier> cpu_barrier, std::size_t core_index) 53 std::size_t core_index)
54 : cpu_barrier{std::move(cpu_barrier)}, core_index{core_index} { 54 : cpu_barrier{cpu_barrier}, core_index{core_index} {
55
56 if (Settings::values.use_cpu_jit) { 55 if (Settings::values.use_cpu_jit) {
57#ifdef ARCHITECTURE_x86_64 56#ifdef ARCHITECTURE_x86_64
58 arm_interface = std::make_unique<ARM_Dynarmic>(exclusive_monitor, core_index); 57 arm_interface = std::make_unique<ARM_Dynarmic>(exclusive_monitor, core_index);
@@ -83,7 +82,7 @@ std::shared_ptr<ExclusiveMonitor> Cpu::MakeExclusiveMonitor(std::size_t num_core
83 82
84void Cpu::RunLoop(bool tight_loop) { 83void Cpu::RunLoop(bool tight_loop) {
85 // Wait for all other CPU cores to complete the previous slice, such that they run in lock-step 84 // Wait for all other CPU cores to complete the previous slice, such that they run in lock-step
86 if (!cpu_barrier->Rendezvous()) { 85 if (!cpu_barrier.Rendezvous()) {
87 // If rendezvous failed, session has been killed 86 // If rendezvous failed, session has been killed
88 return; 87 return;
89 } 88 }
diff --git a/src/core/core_cpu.h b/src/core/core_cpu.h
index ee7e04abc..68d83ac8f 100644
--- a/src/core/core_cpu.h
+++ b/src/core/core_cpu.h
@@ -41,8 +41,8 @@ private:
41 41
42class Cpu { 42class Cpu {
43public: 43public:
44 Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, 44 Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, CpuBarrier& cpu_barrier,
45 std::shared_ptr<CpuBarrier> cpu_barrier, std::size_t core_index); 45 std::size_t core_index);
46 ~Cpu(); 46 ~Cpu();
47 47
48 void RunLoop(bool tight_loop = true); 48 void RunLoop(bool tight_loop = true);
@@ -77,7 +77,7 @@ private:
77 void Reschedule(); 77 void Reschedule();
78 78
79 std::unique_ptr<ARM_Interface> arm_interface; 79 std::unique_ptr<ARM_Interface> arm_interface;
80 std::shared_ptr<CpuBarrier> cpu_barrier; 80 CpuBarrier& cpu_barrier;
81 std::shared_ptr<Kernel::Scheduler> scheduler; 81 std::shared_ptr<Kernel::Scheduler> scheduler;
82 82
83 std::atomic<bool> reschedule_pending = false; 83 std::atomic<bool> reschedule_pending = false;