diff options
| author | 2020-01-26 14:07:22 -0400 | |
|---|---|---|
| committer | 2020-01-26 14:07:22 -0400 | |
| commit | e4a1ead897575ee9222b4fc1021aaa9cc58f12c8 (patch) | |
| tree | ef544a51ba2480400df62d40706f68fa3ae62693 /src/core/core.cpp | |
| parent | ArmInterface: Delegate Exclusive monitor factory to exclusive monitor interfa... (diff) | |
| download | yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar.gz yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar.xz yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.zip | |
Core: Refactor CpuCoreManager to CpuManager and Cpu to Core Manager.
This commit instends on better naming the new purpose of this classes.
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 27b8d3408..bfe952515 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -11,9 +11,9 @@ | |||
| 11 | #include "common/string_util.h" | 11 | #include "common/string_util.h" |
| 12 | #include "core/arm/exclusive_monitor.h" | 12 | #include "core/arm/exclusive_monitor.h" |
| 13 | #include "core/core.h" | 13 | #include "core/core.h" |
| 14 | #include "core/core_cpu.h" | 14 | #include "core/core_manager.h" |
| 15 | #include "core/core_timing.h" | 15 | #include "core/core_timing.h" |
| 16 | #include "core/cpu_core_manager.h" | 16 | #include "core/cpu_manager.h" |
| 17 | #include "core/file_sys/bis_factory.h" | 17 | #include "core/file_sys/bis_factory.h" |
| 18 | #include "core/file_sys/card_image.h" | 18 | #include "core/file_sys/card_image.h" |
| 19 | #include "core/file_sys/mode.h" | 19 | #include "core/file_sys/mode.h" |
| @@ -114,14 +114,14 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, | |||
| 114 | struct System::Impl { | 114 | struct System::Impl { |
| 115 | explicit Impl(System& system) | 115 | explicit Impl(System& system) |
| 116 | : kernel{system}, fs_controller{system}, memory{system}, | 116 | : kernel{system}, fs_controller{system}, memory{system}, |
| 117 | cpu_core_manager{system}, reporter{system}, applet_manager{system} {} | 117 | cpu_manager{system}, reporter{system}, applet_manager{system} {} |
| 118 | 118 | ||
| 119 | Cpu& CurrentCpuCore() { | 119 | CoreManager& CurrentCoreManager() { |
| 120 | return cpu_core_manager.GetCurrentCore(); | 120 | return cpu_manager.GetCurrentCoreManager(); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | Kernel::PhysicalCore& CurrentPhysicalCore() { | 123 | Kernel::PhysicalCore& CurrentPhysicalCore() { |
| 124 | const auto i = cpu_core_manager.GetCurrentCoreIndex(); | 124 | const auto i = cpu_manager.GetActiveCoreIndex(); |
| 125 | return kernel.PhysicalCore(i); | 125 | return kernel.PhysicalCore(i); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| @@ -132,7 +132,7 @@ struct System::Impl { | |||
| 132 | ResultStatus RunLoop(bool tight_loop) { | 132 | ResultStatus RunLoop(bool tight_loop) { |
| 133 | status = ResultStatus::Success; | 133 | status = ResultStatus::Success; |
| 134 | 134 | ||
| 135 | cpu_core_manager.RunLoop(tight_loop); | 135 | cpu_manager.RunLoop(tight_loop); |
| 136 | 136 | ||
| 137 | return status; | 137 | return status; |
| 138 | } | 138 | } |
| @@ -142,7 +142,7 @@ struct System::Impl { | |||
| 142 | 142 | ||
| 143 | core_timing.Initialize(); | 143 | core_timing.Initialize(); |
| 144 | kernel.Initialize(); | 144 | kernel.Initialize(); |
| 145 | cpu_core_manager.Initialize(); | 145 | cpu_manager.Initialize(); |
| 146 | 146 | ||
| 147 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( | 147 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( |
| 148 | std::chrono::system_clock::now().time_since_epoch()); | 148 | std::chrono::system_clock::now().time_since_epoch()); |
| @@ -281,7 +281,7 @@ struct System::Impl { | |||
| 281 | gpu_core.reset(); | 281 | gpu_core.reset(); |
| 282 | 282 | ||
| 283 | // Close all CPU/threading state | 283 | // Close all CPU/threading state |
| 284 | cpu_core_manager.Shutdown(); | 284 | cpu_manager.Shutdown(); |
| 285 | 285 | ||
| 286 | // Shutdown kernel and core timing | 286 | // Shutdown kernel and core timing |
| 287 | kernel.Shutdown(); | 287 | kernel.Shutdown(); |
| @@ -351,7 +351,7 @@ struct System::Impl { | |||
| 351 | std::unique_ptr<Tegra::GPU> gpu_core; | 351 | std::unique_ptr<Tegra::GPU> gpu_core; |
| 352 | std::unique_ptr<Hardware::InterruptManager> interrupt_manager; | 352 | std::unique_ptr<Hardware::InterruptManager> interrupt_manager; |
| 353 | Memory::Memory memory; | 353 | Memory::Memory memory; |
| 354 | CpuCoreManager cpu_core_manager; | 354 | CpuManager cpu_manager; |
| 355 | bool is_powered_on = false; | 355 | bool is_powered_on = false; |
| 356 | bool exit_lock = false; | 356 | bool exit_lock = false; |
| 357 | 357 | ||
| @@ -386,12 +386,12 @@ struct System::Impl { | |||
| 386 | System::System() : impl{std::make_unique<Impl>(*this)} {} | 386 | System::System() : impl{std::make_unique<Impl>(*this)} {} |
| 387 | System::~System() = default; | 387 | System::~System() = default; |
| 388 | 388 | ||
| 389 | Cpu& System::CurrentCpuCore() { | 389 | CoreManager& System::CurrentCoreManager() { |
| 390 | return impl->CurrentCpuCore(); | 390 | return impl->CurrentCoreManager(); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | const Cpu& System::CurrentCpuCore() const { | 393 | const CoreManager& System::CurrentCoreManager() const { |
| 394 | return impl->CurrentCpuCore(); | 394 | return impl->CurrentCoreManager(); |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | System::ResultStatus System::RunLoop(bool tight_loop) { | 397 | System::ResultStatus System::RunLoop(bool tight_loop) { |
| @@ -415,13 +415,11 @@ bool System::IsPoweredOn() const { | |||
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | void System::PrepareReschedule() { | 417 | void System::PrepareReschedule() { |
| 418 | CurrentCpuCore().PrepareReschedule(); | 418 | CurrentCoreManager().PrepareReschedule(); |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | void System::PrepareReschedule(const u32 core_index) { | 421 | void System::PrepareReschedule(const u32 core_index) { |
| 422 | if (core_index < GlobalScheduler().CpuCoresCount()) { | 422 | impl->kernel.PrepareReschedule(core_index); |
| 423 | CpuCore(core_index).PrepareReschedule(); | ||
| 424 | } | ||
| 425 | } | 423 | } |
| 426 | 424 | ||
| 427 | PerfStatsResults System::GetAndResetPerfStats() { | 425 | PerfStatsResults System::GetAndResetPerfStats() { |
| @@ -445,7 +443,7 @@ const ARM_Interface& System::CurrentArmInterface() const { | |||
| 445 | } | 443 | } |
| 446 | 444 | ||
| 447 | std::size_t System::CurrentCoreIndex() const { | 445 | std::size_t System::CurrentCoreIndex() const { |
| 448 | return CurrentCpuCore().CoreIndex(); | 446 | return impl->cpu_manager.GetActiveCoreIndex(); |
| 449 | } | 447 | } |
| 450 | 448 | ||
| 451 | Kernel::Scheduler& System::CurrentScheduler() { | 449 | Kernel::Scheduler& System::CurrentScheduler() { |
| @@ -490,13 +488,13 @@ const ARM_Interface& System::ArmInterface(std::size_t core_index) const { | |||
| 490 | return impl->GetPhysicalCore(core_index).ArmInterface(); | 488 | return impl->GetPhysicalCore(core_index).ArmInterface(); |
| 491 | } | 489 | } |
| 492 | 490 | ||
| 493 | Cpu& System::CpuCore(std::size_t core_index) { | 491 | CoreManager& System::GetCoreManager(std::size_t core_index) { |
| 494 | return impl->cpu_core_manager.GetCore(core_index); | 492 | return impl->cpu_manager.GetCoreManager(core_index); |
| 495 | } | 493 | } |
| 496 | 494 | ||
| 497 | const Cpu& System::CpuCore(std::size_t core_index) const { | 495 | const CoreManager& System::GetCoreManager(std::size_t core_index) const { |
| 498 | ASSERT(core_index < NUM_CPU_CORES); | 496 | ASSERT(core_index < NUM_CPU_CORES); |
| 499 | return impl->cpu_core_manager.GetCore(core_index); | 497 | return impl->cpu_manager.GetCoreManager(core_index); |
| 500 | } | 498 | } |
| 501 | 499 | ||
| 502 | ExclusiveMonitor& System::Monitor() { | 500 | ExclusiveMonitor& System::Monitor() { |