summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/kernel.cpp5
-rw-r--r--src/core/hle/kernel/kernel.h2
-rw-r--r--src/core/hle/kernel/physical_core.cpp11
-rw-r--r--src/core/hle/kernel/physical_core.h12
4 files changed, 20 insertions, 10 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 1986cf65c..0cf3c8f70 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -135,7 +135,8 @@ struct KernelCore::Impl {
135 } 135 }
136 136
137 void InitializePhysicalCores(KernelCore& kernel) { 137 void InitializePhysicalCores(KernelCore& kernel) {
138 exclusive_monitor = Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount()); 138 exclusive_monitor =
139 Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount());
139 for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) { 140 for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) {
140 cores.emplace_back(system, kernel, i, *exclusive_monitor); 141 cores.emplace_back(system, kernel, i, *exclusive_monitor);
141 } 142 }
@@ -284,7 +285,7 @@ void KernelCore::InvalidateAllInstructionCaches() {
284} 285}
285 286
286void KernelCore::PrepareReschedule(std::size_t id) { 287void KernelCore::PrepareReschedule(std::size_t id) {
287 if (id >= 0 && id < impl->global_scheduler.CpuCoresCount()) { 288 if (id < impl->global_scheduler.CpuCoresCount()) {
288 impl->cores[id].Stop(); 289 impl->cores[id].Stop();
289 } 290 }
290} 291}
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 536068f74..fccffaf3a 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -13,7 +13,7 @@
13namespace Core { 13namespace Core {
14class ExclusiveMonitor; 14class ExclusiveMonitor;
15class System; 15class System;
16} 16} // namespace Core
17 17
18namespace Core::Timing { 18namespace Core::Timing {
19class CoreTiming; 19class CoreTiming;
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index 7d84e3d28..896a1a87a 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -17,18 +17,21 @@
17 17
18namespace Kernel { 18namespace Kernel {
19 19
20PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor) 20PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id,
21 Core::ExclusiveMonitor& exclusive_monitor)
21 : core_index{id}, kernel{kernel} { 22 : core_index{id}, kernel{kernel} {
22#ifdef ARCHITECTURE_x86_64 23#ifdef ARCHITECTURE_x86_64
23 arm_interface = std::make_unique<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index); 24 arm_interface = std::make_shared<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index);
24#else 25#else
25 arm_interface = std::make_unique<Core::ARM_Unicorn>(system); 26 arm_interface = std::make_shared<Core::ARM_Unicorn>(system);
26 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); 27 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
27#endif 28#endif
28 29
29 scheduler = std::make_unique<Kernel::Scheduler>(system, *arm_interface, core_index); 30 scheduler = std::make_shared<Kernel::Scheduler>(system, *arm_interface, core_index);
30} 31}
31 32
33PhysicalCore::~PhysicalCore() = default;
34
32void PhysicalCore::Run() { 35void PhysicalCore::Run() {
33 arm_interface->Run(); 36 arm_interface->Run();
34 arm_interface->ClearExclusiveState(); 37 arm_interface->ClearExclusiveState();
diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h
index a7848e030..fbef0801f 100644
--- a/src/core/hle/kernel/physical_core.h
+++ b/src/core/hle/kernel/physical_core.h
@@ -4,6 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef>
8#include <memory>
9
7namespace Kernel { 10namespace Kernel {
8class Scheduler; 11class Scheduler;
9} // namespace Kernel 12} // namespace Kernel
@@ -18,7 +21,10 @@ namespace Kernel {
18 21
19class PhysicalCore { 22class PhysicalCore {
20public: 23public:
21 PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor); 24 PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id,
25 Core::ExclusiveMonitor& exclusive_monitor);
26
27 ~PhysicalCore();
22 28
23 /// Execute current jit state 29 /// Execute current jit state
24 void Run(); 30 void Run();
@@ -61,8 +67,8 @@ public:
61private: 67private:
62 std::size_t core_index; 68 std::size_t core_index;
63 KernelCore& kernel; 69 KernelCore& kernel;
64 std::unique_ptr<Core::ARM_Interface> arm_interface; 70 std::shared_ptr<Core::ARM_Interface> arm_interface;
65 std::unique_ptr<Kernel::Scheduler> scheduler; 71 std::shared_ptr<Kernel::Scheduler> scheduler;
66}; 72};
67 73
68} // namespace Kernel 74} // namespace Kernel