diff options
| author | Liam <byteslice@airmail.cc> | 2022-07-09 18:47:32 -0400 |
|---|---|---|
| committer | Liam <byteslice@airmail.cc> | 2022-07-14 22:47:18 -0400 |
| commit | e2be660909c9de7da11de22c7c147ac223fa45ea (patch) | |
| tree | 7ab3fdc7a4dd8a02cdedf2004f3d21403022d36d /src | |
| parent | 21e2063d7dc007a0415d644cfc7f35fa8a81cc84 (diff) | |
kernel: be more careful about initialization path for HLE threads
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/k_scheduler.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index 230ca3b953..d9ba8e4092 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp @@ -70,6 +70,7 @@ void KScheduler::EnableScheduling(KernelCore& kernel, u64 cores_needing_scheduli GetCurrentThread(kernel).IfDummyThreadTryWait(); } GetCurrentThread(kernel).EnableDispatch(); + ASSERT(GetCurrentThread(kernel).GetState() != ThreadState::Waiting); return; } diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 3640d1d13b..985ce448e6 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp @@ -258,7 +258,13 @@ Result KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_ } Result KThread::InitializeDummyThread(KThread* thread) { - return thread->Initialize({}, {}, {}, DummyThreadPriority, 3, {}, ThreadType::Dummy); + // Initialize the thread. + R_TRY(thread->Initialize({}, {}, {}, DummyThreadPriority, 3, {}, ThreadType::Dummy)); + + // Initialize emulation parameters. + thread->stack_parameters.disable_count = 0; + + return ResultSuccess; } Result KThread::InitializeMainThread(Core::System& system, KThread* thread, s32 virt_core) { |
