From 6020723e77585835eddcc5675385f5e7dd3072ac Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 28 Jun 2021 16:58:40 -0700 Subject: hle: kernel: k_process: Close main thread reference after it is inserted into handle table. --- src/core/hle/kernel/k_process.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/hle/kernel/k_process.cpp') diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index d1bd98051..c309ae563 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -10,6 +10,7 @@ #include "common/alignment.h" #include "common/assert.h" #include "common/logging/log.h" +#include "common/scope_exit.h" #include "common/settings.h" #include "core/core.h" #include "core/device_memory.h" @@ -43,6 +44,8 @@ void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::Threads, 1)); KThread* thread = KThread::Create(system.Kernel()); + SCOPE_EXIT({ thread->Close(); }); + ASSERT(KThread::InitializeUserThread(system, thread, entry_point, 0, stack_top, priority, owner_process.GetIdealCoreId(), &owner_process) .IsSuccess()); -- cgit v1.2.3 From b119363fc27994a4eb68405011235c4a1b3cdf8f Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 28 Jun 2021 16:59:49 -0700 Subject: hle: kernel: k_process: Close the handle table on shutdown. --- src/core/hle/kernel/k_process.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/hle/kernel/k_process.cpp') diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index c309ae563..87171b1c8 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -409,6 +409,9 @@ void KProcess::Finalize() { resource_limit->Close(); } + // Finalize the handle table and close any open handles. + handle_table.Finalize(); + // Perform inherited finalization. KAutoObjectWithSlabHeapAndContainer::Finalize(); } -- cgit v1.2.3 From 8d755147d8fbe664d78b3e78514b64804505d6d7 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 2 Jul 2021 15:04:08 -0700 Subject: hle: kernel: KProcess: Change process termination assert to a warning. - Since we do not implement multiprocess right now, this should not be a crashing assert. --- src/core/hle/kernel/k_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/kernel/k_process.cpp') diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 87171b1c8..8ead1a769 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -165,7 +165,7 @@ void KProcess::DecrementThreadCount() { ASSERT(num_threads > 0); if (const auto count = --num_threads; count == 0) { - UNIMPLEMENTED_MSG("Process termination is not implemented!"); + LOG_WARNING(Kernel, "Process termination is not fully implemented."); } } -- cgit v1.2.3