diff options
author | bunnei <bunneidev@gmail.com> | 2018-07-19 03:55:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-19 03:55:58 +0200 |
commit | 49b0966003caeaafe2f5455d06b16175f02686fb (patch) | |
tree | 141c8d3c09f9eca021dddedb17cdc3cc6607a19a /src/core | |
parent | Merge pull request #680 from bunnei/fix-swizz (diff) | |
parent | core: Make System's default constructor private (diff) | |
download | yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar.gz yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar.bz2 yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar.lz yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar.xz yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar.zst yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.cpp | 4 | ||||
-rw-r--r-- | src/core/core.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 12 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 82db5cccf..9bd9f4bd9 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -26,11 +26,13 @@ namespace Core { /*static*/ System System::s_instance; +System::System() = default; + System::~System() = default; /// Runs a CPU core while the system is powered on static void RunCpuCore(std::shared_ptr<Cpu> cpu_state) { - while (Core::System().GetInstance().IsPoweredOn()) { + while (Core::System::GetInstance().IsPoweredOn()) { cpu_state->RunLoop(true); } } diff --git a/src/core/core.h b/src/core/core.h index f90f085ad..c6f69f001 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -168,6 +168,8 @@ public: } private: + System(); + /// Returns the currently running CPU core Cpu& CurrentCpuCore(); diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 9a9746585..0b3c66428 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -165,7 +165,7 @@ void Thread::CancelWakeupTimer() { static boost::optional<s32> GetNextProcessorId(u64 mask) { for (s32 index = 0; index < Core::NUM_CPU_CORES; ++index) { if (mask & (1ULL << index)) { - if (!Core::System().GetInstance().Scheduler(index)->GetCurrentThread()) { + if (!Core::System::GetInstance().Scheduler(index)->GetCurrentThread()) { // Core is enabled and not running any threads, use this one return index; } @@ -215,14 +215,14 @@ void Thread::ResumeFromWait() { new_processor_id = processor_id; } if (ideal_core != -1 && - Core::System().GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { + Core::System::GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { new_processor_id = ideal_core; } ASSERT(*new_processor_id < 4); // Add thread to new core's scheduler - auto& next_scheduler = Core::System().GetInstance().Scheduler(*new_processor_id); + auto& next_scheduler = Core::System::GetInstance().Scheduler(*new_processor_id); if (*new_processor_id != processor_id) { // Remove thread from previous core's scheduler @@ -325,7 +325,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, thread->name = std::move(name); thread->callback_handle = wakeup_callback_handle_table.Create(thread).Unwrap(); thread->owner_process = owner_process; - thread->scheduler = Core::System().GetInstance().Scheduler(processor_id); + thread->scheduler = Core::System::GetInstance().Scheduler(processor_id); thread->scheduler->AddThread(thread, priority); // Find the next available TLS index, and mark it as used @@ -481,14 +481,14 @@ void Thread::ChangeCore(u32 core, u64 mask) { new_processor_id = processor_id; } if (ideal_core != -1 && - Core::System().GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { + Core::System::GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { new_processor_id = ideal_core; } ASSERT(*new_processor_id < 4); // Add thread to new core's scheduler - auto& next_scheduler = Core::System().GetInstance().Scheduler(*new_processor_id); + auto& next_scheduler = Core::System::GetInstance().Scheduler(*new_processor_id); if (*new_processor_id != processor_id) { // Remove thread from previous core's scheduler |