From f0125b2be8ba34aaf07b8c9d04b866d29ceea53a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 16 Jul 2020 13:28:10 -0400 Subject: cpu_manager: Mark function getters as static All these do are return std::function instances of static functions, so these can be used without an instance of the CPU manager. --- src/core/hle/kernel/kernel.cpp | 11 ++++++----- src/core/hle/kernel/scheduler.cpp | 2 +- src/core/hle/kernel/thread.cpp | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 6e2014e08..e1c7a0f3b 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -161,13 +161,14 @@ struct KernelCore::Impl { void InitializeSuspendThreads() { for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { std::string name = "Suspend Thread Id:" + std::to_string(i); - std::function init_func = - system.GetCpuManager().GetSuspendThreadStartFunc(); + std::function init_func = Core::CpuManager::GetSuspendThreadStartFunc(); void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater(); - ThreadType type = + const auto type = static_cast(THREADTYPE_KERNEL | THREADTYPE_HLE | THREADTYPE_SUSPEND); - auto thread_res = Thread::Create(system, type, name, 0, 0, 0, static_cast(i), 0, - nullptr, std::move(init_func), init_func_parameter); + auto thread_res = + Thread::Create(system, type, std::move(name), 0, 0, 0, static_cast(i), 0, + nullptr, std::move(init_func), init_func_parameter); + suspend_threads[i] = std::move(thread_res).Unwrap(); } } diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 7b929781c..f93e5e4b0 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp @@ -802,7 +802,7 @@ void Scheduler::UpdateLastContextSwitchTime(Thread* thread, Process* process) { void Scheduler::Initialize() { std::string name = "Idle Thread Id:" + std::to_string(core_id); - std::function init_func = system.GetCpuManager().GetIdleThreadStartFunc(); + std::function init_func = Core::CpuManager::GetIdleThreadStartFunc(); void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater(); ThreadType type = static_cast(THREADTYPE_KERNEL | THREADTYPE_HLE | THREADTYPE_IDLE); auto thread_res = Thread::Create(system, type, name, 0, 64, 0, static_cast(core_id), 0, diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 67148fa6d..d132aba34 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -155,7 +155,7 @@ ResultVal> Thread::Create(Core::System& system, ThreadTy std::string name, VAddr entry_point, u32 priority, u64 arg, s32 processor_id, VAddr stack_top, Process* owner_process) { - std::function init_func = system.GetCpuManager().GetGuestThreadStartFunc(); + std::function init_func = Core::CpuManager::GetGuestThreadStartFunc(); void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater(); return Create(system, type_flags, name, entry_point, priority, arg, processor_id, stack_top, owner_process, std::move(init_func), init_func_parameter); -- cgit v1.2.3 From 07d080ecc810a415e06ae52b414fc5e5e4393a93 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 16 Jul 2020 13:51:51 -0400 Subject: kernel: Add missing include --- src/core/hle/kernel/kernel.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 49bd47e89..16285c3f0 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -9,6 +9,7 @@ #include #include #include +#include "core/arm/cpu_interrupt_handler.h" #include "core/hardware_properties.h" #include "core/hle/kernel/memory/memory_types.h" #include "core/hle/kernel/object.h" -- cgit v1.2.3