diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/physical_core.cpp | 11 | ||||
-rw-r--r-- | src/core/hle/kernel/physical_core.h | 12 |
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 { } void InitializePhysicalCores(KernelCore& kernel) { - exclusive_monitor = Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount()); + exclusive_monitor = + Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount()); for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) { cores.emplace_back(system, kernel, i, *exclusive_monitor); } @@ -284,7 +285,7 @@ void KernelCore::InvalidateAllInstructionCaches() { } void KernelCore::PrepareReschedule(std::size_t id) { - if (id >= 0 && id < impl->global_scheduler.CpuCoresCount()) { + if (id < impl->global_scheduler.CpuCoresCount()) { impl->cores[id].Stop(); } } 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 @@ namespace Core { class ExclusiveMonitor; class System; -} +} // namespace Core namespace Core::Timing { class 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 @@ namespace Kernel { -PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor) +PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, + Core::ExclusiveMonitor& exclusive_monitor) : core_index{id}, kernel{kernel} { #ifdef ARCHITECTURE_x86_64 - arm_interface = std::make_unique<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index); + arm_interface = std::make_shared<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index); #else - arm_interface = std::make_unique<Core::ARM_Unicorn>(system); + arm_interface = std::make_shared<Core::ARM_Unicorn>(system); LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); #endif - scheduler = std::make_unique<Kernel::Scheduler>(system, *arm_interface, core_index); + scheduler = std::make_shared<Kernel::Scheduler>(system, *arm_interface, core_index); } +PhysicalCore::~PhysicalCore() = default; + void PhysicalCore::Run() { arm_interface->Run(); 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 @@ #pragma once +#include <cstddef> +#include <memory> + namespace Kernel { class Scheduler; } // namespace Kernel @@ -18,7 +21,10 @@ namespace Kernel { class PhysicalCore { public: - PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor); + PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, + Core::ExclusiveMonitor& exclusive_monitor); + + ~PhysicalCore(); /// Execute current jit state void Run(); @@ -61,8 +67,8 @@ public: private: std::size_t core_index; KernelCore& kernel; - std::unique_ptr<Core::ARM_Interface> arm_interface; - std::unique_ptr<Kernel::Scheduler> scheduler; + std::shared_ptr<Core::ARM_Interface> arm_interface; + std::shared_ptr<Kernel::Scheduler> scheduler; }; } // namespace Kernel |