From eea346ba8eed49111d34e2fb1eee8a1ad53c4614 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 31 Dec 2020 00:46:09 -0800 Subject: hle: kernel: KThread: Remove thread types that do not exist. --- src/core/hle/kernel/k_thread.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/core/hle/kernel/k_thread.cpp') diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 1ec29636c..0f349dad2 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp @@ -125,7 +125,7 @@ ResultVal> KThread::Create(Core::System& system, Thread void* thread_start_parameter) { auto& kernel = system.Kernel(); // Check if priority is in ranged. Lowest priority -> highest priority id. - if (priority > THREADPRIO_LOWEST && ((type_flags & THREADTYPE_IDLE) == 0)) { + if (priority > THREADPRIO_LOWEST) { LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); return ERR_INVALID_THREAD_PRIORITY; } @@ -164,10 +164,10 @@ ResultVal> KThread::Create(Core::System& system, Thread thread->owner_process = owner_process; thread->type = type_flags; thread->signaled = false; - if ((type_flags & THREADTYPE_IDLE) == 0) { - auto& scheduler = kernel.GlobalSchedulerContext(); - scheduler.AddThread(thread); - } + + auto& scheduler = kernel.GlobalSchedulerContext(); + scheduler.AddThread(thread); + if (owner_process) { thread->tls_address = thread->owner_process->CreateTLSRegion(); thread->owner_process->RegisterThread(thread.get()); @@ -175,13 +175,10 @@ ResultVal> KThread::Create(Core::System& system, Thread thread->tls_address = 0; } - // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used - // to initialize the context - if ((type_flags & THREADTYPE_HLE) == 0) { - ResetThreadContext32(thread->context_32, static_cast(stack_top), - static_cast(entry_point), static_cast(arg)); - ResetThreadContext64(thread->context_64, stack_top, entry_point, arg); - } + ResetThreadContext32(thread->context_32, static_cast(stack_top), + static_cast(entry_point), static_cast(arg)); + ResetThreadContext64(thread->context_64, stack_top, entry_point, arg); + thread->host_context = std::make_shared(std::move(thread_start_func), thread_start_parameter); -- cgit v1.2.3