diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-01-26 16:14:18 -0400 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2020-01-27 09:54:11 -0400 |
commit | 2d1984c20c75e03ec79eeb3806b12efa1679b977 (patch) | |
tree | 79a457c2fb0cabd810eac92f3cb245d344ed9c3b /src/core/hle/kernel | |
parent | de4b01f75df19c1674a2b4424b4f0d8060829844 (diff) |
System: Address Feedback
Diffstat (limited to 'src/core/hle/kernel')
-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 1986cf65c5..0cf3c8f70c 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 536068f74e..fccffaf3a9 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 7d84e3d282..896a1a87ad 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 a7848e030f..fbef0801fa 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 |