diff options
| author | 2020-01-26 10:28:23 -0400 | |
|---|---|---|
| committer | 2020-01-26 10:28:23 -0400 | |
| commit | 450341b397766caa32138882acb52790f4120963 (patch) | |
| tree | 141d9ddddd6f585c1df8fc2a1465f473bebc354b /src | |
| parent | Core: Refactor CPU Management. (diff) | |
| download | yuzu-450341b397766caa32138882acb52790f4120963.tar.gz yuzu-450341b397766caa32138882acb52790f4120963.tar.xz yuzu-450341b397766caa32138882acb52790f4120963.zip | |
ArmInterface: Delegate Exclusive monitor factory to exclusive monitor interfasce.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/exclusive_monitor.cpp | 13 | ||||
| -rw-r--r-- | src/core/arm/exclusive_monitor.h | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 17 |
3 files changed, 24 insertions, 16 deletions
diff --git a/src/core/arm/exclusive_monitor.cpp b/src/core/arm/exclusive_monitor.cpp index abd59ff4b..00e6a19d5 100644 --- a/src/core/arm/exclusive_monitor.cpp +++ b/src/core/arm/exclusive_monitor.cpp | |||
| @@ -2,10 +2,23 @@ | |||
| 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 | ||
| 5 | #ifdef ARCHITECTURE_x86_64 | ||
| 6 | #include "core/arm/dynarmic/arm_dynarmic.h" | ||
| 7 | #endif | ||
| 5 | #include "core/arm/exclusive_monitor.h" | 8 | #include "core/arm/exclusive_monitor.h" |
| 9 | #include "core/memory.h" | ||
| 6 | 10 | ||
| 7 | namespace Core { | 11 | namespace Core { |
| 8 | 12 | ||
| 9 | ExclusiveMonitor::~ExclusiveMonitor() = default; | 13 | ExclusiveMonitor::~ExclusiveMonitor() = default; |
| 10 | 14 | ||
| 15 | std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores) { | ||
| 16 | #ifdef ARCHITECTURE_x86_64 | ||
| 17 | return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores); | ||
| 18 | #else | ||
| 19 | // TODO(merry): Passthrough exclusive monitor | ||
| 20 | return nullptr; | ||
| 21 | #endif | ||
| 22 | } | ||
| 23 | |||
| 11 | } // namespace Core | 24 | } // namespace Core |
diff --git a/src/core/arm/exclusive_monitor.h b/src/core/arm/exclusive_monitor.h index f59aca667..18461f296 100644 --- a/src/core/arm/exclusive_monitor.h +++ b/src/core/arm/exclusive_monitor.h | |||
| @@ -1,11 +1,17 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | 1 | // Copyright 2020 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 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 8 | |||
| 7 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 8 | 10 | ||
| 11 | namespace Memory { | ||
| 12 | class Memory; | ||
| 13 | } | ||
| 14 | |||
| 9 | namespace Core { | 15 | namespace Core { |
| 10 | 16 | ||
| 11 | class ExclusiveMonitor { | 17 | class ExclusiveMonitor { |
| @@ -22,4 +28,6 @@ public: | |||
| 22 | 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; |
| 23 | }; | 29 | }; |
| 24 | 30 | ||
| 31 | std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores); | ||
| 32 | |||
| 25 | } // namespace Core | 33 | } // namespace Core |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index b7fd480d1..1986cf65c 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <atomic> | 5 | #include <atomic> |
| 6 | #include <functional> | ||
| 6 | #include <memory> | 7 | #include <memory> |
| 7 | #include <mutex> | 8 | #include <mutex> |
| 8 | #include <utility> | 9 | #include <utility> |
| @@ -10,9 +11,6 @@ | |||
| 10 | #include "common/assert.h" | 11 | #include "common/assert.h" |
| 11 | #include "common/logging/log.h" | 12 | #include "common/logging/log.h" |
| 12 | #include "core/arm/arm_interface.h" | 13 | #include "core/arm/arm_interface.h" |
| 13 | #ifdef ARCHITECTURE_x86_64 | ||
| 14 | #include "core/arm/dynarmic/arm_dynarmic.h" | ||
| 15 | #endif | ||
| 16 | #include "core/arm/exclusive_monitor.h" | 14 | #include "core/arm/exclusive_monitor.h" |
| 17 | #include "core/core.h" | 15 | #include "core/core.h" |
| 18 | #include "core/core_timing.h" | 16 | #include "core/core_timing.h" |
| @@ -137,7 +135,7 @@ struct KernelCore::Impl { | |||
| 137 | } | 135 | } |
| 138 | 136 | ||
| 139 | void InitializePhysicalCores(KernelCore& kernel) { | 137 | void InitializePhysicalCores(KernelCore& kernel) { |
| 140 | exclusive_monitor = MakeExclusiveMonitor(); | 138 | exclusive_monitor = Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount()); |
| 141 | for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) { | 139 | for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) { |
| 142 | cores.emplace_back(system, kernel, i, *exclusive_monitor); | 140 | cores.emplace_back(system, kernel, i, *exclusive_monitor); |
| 143 | } | 141 | } |
| @@ -156,7 +154,6 @@ struct KernelCore::Impl { | |||
| 156 | ASSERT(system_resource_limit->SetLimitValue(ResourceType::Sessions, 900).IsSuccess()); | 154 | ASSERT(system_resource_limit->SetLimitValue(ResourceType::Sessions, 900).IsSuccess()); |
| 157 | } | 155 | } |
| 158 | 156 | ||
| 159 | |||
| 160 | void InitializeThreads() { | 157 | void InitializeThreads() { |
| 161 | thread_wakeup_event_type = | 158 | thread_wakeup_event_type = |
| 162 | Core::Timing::CreateEvent("ThreadWakeupCallback", ThreadWakeupCallback); | 159 | Core::Timing::CreateEvent("ThreadWakeupCallback", ThreadWakeupCallback); |
| @@ -184,16 +181,6 @@ struct KernelCore::Impl { | |||
| 184 | system.Memory().SetCurrentPageTable(*process); | 181 | system.Memory().SetCurrentPageTable(*process); |
| 185 | } | 182 | } |
| 186 | 183 | ||
| 187 | std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor() { | ||
| 188 | #ifdef ARCHITECTURE_x86_64 | ||
| 189 | return std::make_unique<Core::DynarmicExclusiveMonitor>(system.Memory(), | ||
| 190 | global_scheduler.CpuCoresCount()); | ||
| 191 | #else | ||
| 192 | // TODO(merry): Passthrough exclusive monitor | ||
| 193 | return nullptr; | ||
| 194 | #endif | ||
| 195 | } | ||
| 196 | |||
| 197 | std::atomic<u32> next_object_id{0}; | 184 | std::atomic<u32> next_object_id{0}; |
| 198 | std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin}; | 185 | std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin}; |
| 199 | std::atomic<u64> next_user_process_id{Process::ProcessIDMin}; | 186 | std::atomic<u64> next_user_process_id{Process::ProcessIDMin}; |