diff options
| author | 2020-01-26 16:14:18 -0400 | |
|---|---|---|
| committer | 2020-01-27 09:54:11 -0400 | |
| commit | 2d1984c20c75e03ec79eeb3806b12efa1679b977 (patch) | |
| tree | 79a457c2fb0cabd810eac92f3cb245d344ed9c3b /src | |
| parent | System: Correct PrepareReschedule. (diff) | |
| download | yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar.gz yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar.xz yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.zip | |
System: Address Feedback
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/exclusive_monitor.cpp | 3 | ||||
| -rw-r--r-- | src/core/arm/exclusive_monitor.h | 5 | ||||
| -rw-r--r-- | src/core/core.cpp | 4 | ||||
| -rw-r--r-- | src/core/core_manager.cpp | 7 | ||||
| -rw-r--r-- | src/core/core_manager.h | 2 | ||||
| -rw-r--r-- | src/core/cpu_manager.cpp | 1 | ||||
| -rw-r--r-- | src/core/cpu_manager.h | 2 | ||||
| -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 |
11 files changed, 30 insertions, 24 deletions
diff --git a/src/core/arm/exclusive_monitor.cpp b/src/core/arm/exclusive_monitor.cpp index 00e6a19d5..94570e520 100644 --- a/src/core/arm/exclusive_monitor.cpp +++ b/src/core/arm/exclusive_monitor.cpp | |||
| @@ -12,7 +12,8 @@ namespace Core { | |||
| 12 | 12 | ||
| 13 | ExclusiveMonitor::~ExclusiveMonitor() = default; | 13 | ExclusiveMonitor::~ExclusiveMonitor() = default; |
| 14 | 14 | ||
| 15 | std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores) { | 15 | std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, |
| 16 | std::size_t num_cores) { | ||
| 16 | #ifdef ARCHITECTURE_x86_64 | 17 | #ifdef ARCHITECTURE_x86_64 |
| 17 | return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores); | 18 | return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores); |
| 18 | #else | 19 | #else |
diff --git a/src/core/arm/exclusive_monitor.h b/src/core/arm/exclusive_monitor.h index 18461f296..4ef418b90 100644 --- a/src/core/arm/exclusive_monitor.h +++ b/src/core/arm/exclusive_monitor.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | 1 | // Copyright 2018 yuzu emulator team |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| @@ -28,6 +28,7 @@ public: | |||
| 28 | virtual bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) = 0; | 28 | virtual bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) = 0; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores); | 31 | std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, |
| 32 | std::size_t num_cores); | ||
| 32 | 33 | ||
| 33 | } // namespace Core | 34 | } // namespace Core |
diff --git a/src/core/core.cpp b/src/core/core.cpp index c2295f69c..c53d122be 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -121,8 +121,8 @@ struct System::Impl { | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | Kernel::PhysicalCore& CurrentPhysicalCore() { | 123 | Kernel::PhysicalCore& CurrentPhysicalCore() { |
| 124 | const auto i = cpu_manager.GetActiveCoreIndex(); | 124 | const auto index = cpu_manager.GetActiveCoreIndex(); |
| 125 | return kernel.PhysicalCore(i); | 125 | return kernel.PhysicalCore(index); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | Kernel::PhysicalCore& GetPhysicalCore(std::size_t index) { | 128 | Kernel::PhysicalCore& GetPhysicalCore(std::size_t index) { |
diff --git a/src/core/core_manager.cpp b/src/core/core_manager.cpp index bb03857d5..8eacf92dd 100644 --- a/src/core/core_manager.cpp +++ b/src/core/core_manager.cpp | |||
| @@ -24,10 +24,9 @@ | |||
| 24 | namespace Core { | 24 | namespace Core { |
| 25 | 25 | ||
| 26 | CoreManager::CoreManager(System& system, std::size_t core_index) | 26 | CoreManager::CoreManager(System& system, std::size_t core_index) |
| 27 | : global_scheduler{system.GlobalScheduler()}, | 27 | : global_scheduler{system.GlobalScheduler()}, physical_core{system.Kernel().PhysicalCore( |
| 28 | physical_core{system.Kernel().PhysicalCore(core_index)}, core_timing{system.CoreTiming()}, | 28 | core_index)}, |
| 29 | core_index{core_index} { | 29 | core_timing{system.CoreTiming()}, core_index{core_index} {} |
| 30 | } | ||
| 31 | 30 | ||
| 32 | CoreManager::~CoreManager() = default; | 31 | CoreManager::~CoreManager() = default; |
| 33 | 32 | ||
diff --git a/src/core/core_manager.h b/src/core/core_manager.h index 7bc9679c1..b14e723d7 100644 --- a/src/core/core_manager.h +++ b/src/core/core_manager.h | |||
| @@ -5,10 +5,8 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <atomic> | 7 | #include <atomic> |
| 8 | #include <condition_variable> | ||
| 9 | #include <cstddef> | 8 | #include <cstddef> |
| 10 | #include <memory> | 9 | #include <memory> |
| 11 | #include <mutex> | ||
| 12 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 13 | 11 | ||
| 14 | namespace Kernel { | 12 | namespace Kernel { |
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index abc8aad9e..752534868 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -17,7 +17,6 @@ CpuManager::CpuManager(System& system) : system{system} {} | |||
| 17 | CpuManager::~CpuManager() = default; | 17 | CpuManager::~CpuManager() = default; |
| 18 | 18 | ||
| 19 | void CpuManager::Initialize() { | 19 | void CpuManager::Initialize() { |
| 20 | |||
| 21 | for (std::size_t index = 0; index < core_managers.size(); ++index) { | 20 | for (std::size_t index = 0; index < core_managers.size(); ++index) { |
| 22 | core_managers[index] = std::make_unique<CoreManager>(system, index); | 21 | core_managers[index] = std::make_unique<CoreManager>(system, index); |
| 23 | } | 22 | } |
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h index 5371d448e..feb619e1b 100644 --- a/src/core/cpu_manager.h +++ b/src/core/cpu_manager.h | |||
| @@ -5,9 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <map> | ||
| 9 | #include <memory> | 8 | #include <memory> |
| 10 | #include <thread> | ||
| 11 | 9 | ||
| 12 | namespace Core { | 10 | namespace Core { |
| 13 | 11 | ||
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 | ||
| 286 | void KernelCore::PrepareReschedule(std::size_t id) { | 287 | void 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 @@ | |||
| 13 | namespace Core { | 13 | namespace Core { |
| 14 | class ExclusiveMonitor; | 14 | class ExclusiveMonitor; |
| 15 | class System; | 15 | class System; |
| 16 | } | 16 | } // namespace Core |
| 17 | 17 | ||
| 18 | namespace Core::Timing { | 18 | namespace Core::Timing { |
| 19 | class CoreTiming; | 19 | 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 @@ | |||
| 17 | 17 | ||
| 18 | namespace Kernel { | 18 | namespace Kernel { |
| 19 | 19 | ||
| 20 | PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor) | 20 | PhysicalCore::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 | ||
| 33 | PhysicalCore::~PhysicalCore() = default; | ||
| 34 | |||
| 32 | void PhysicalCore::Run() { | 35 | void 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 | |||
| 7 | namespace Kernel { | 10 | namespace Kernel { |
| 8 | class Scheduler; | 11 | class Scheduler; |
| 9 | } // namespace Kernel | 12 | } // namespace Kernel |
| @@ -18,7 +21,10 @@ namespace Kernel { | |||
| 18 | 21 | ||
| 19 | class PhysicalCore { | 22 | class PhysicalCore { |
| 20 | public: | 23 | public: |
| 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: | |||
| 61 | private: | 67 | private: |
| 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 |