summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/k_process.cpp15
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp1
-rw-r--r--src/core/hle/kernel/k_thread.cpp4
-rw-r--r--src/core/hle/kernel/kernel.cpp1
4 files changed, 7 insertions, 14 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index cd863e715..61a4fb464 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -57,18 +57,13 @@ void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority
57 thread->GetContext64().cpu_registers[0] = 0; 57 thread->GetContext64().cpu_registers[0] = 0;
58 thread->GetContext32().cpu_registers[1] = thread_handle; 58 thread->GetContext32().cpu_registers[1] = thread_handle;
59 thread->GetContext64().cpu_registers[1] = thread_handle; 59 thread->GetContext64().cpu_registers[1] = thread_handle;
60 thread->DisableDispatch();
61 60
62 auto& kernel = system.Kernel(); 61 if (system.DebuggerEnabled()) {
63 // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires 62 thread->RequestSuspend(SuspendType::Debug);
64 {
65 KScopedSchedulerLock lock{kernel};
66 thread->SetState(ThreadState::Runnable);
67
68 if (system.DebuggerEnabled()) {
69 thread->RequestSuspend(SuspendType::Debug);
70 }
71 } 63 }
64
65 // Run our thread.
66 void(thread->Run());
72} 67}
73} // Anonymous namespace 68} // Anonymous namespace
74 69
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp
index 2d4e8637b..7e03b26f8 100644
--- a/src/core/hle/kernel/k_scheduler.cpp
+++ b/src/core/hle/kernel/k_scheduler.cpp
@@ -829,6 +829,7 @@ void KScheduler::Initialize() {
829 idle_thread = KThread::Create(system.Kernel()); 829 idle_thread = KThread::Create(system.Kernel());
830 ASSERT(KThread::InitializeIdleThread(system, idle_thread, core_id).IsSuccess()); 830 ASSERT(KThread::InitializeIdleThread(system, idle_thread, core_id).IsSuccess());
831 idle_thread->SetName(fmt::format("IdleThread:{}", core_id)); 831 idle_thread->SetName(fmt::format("IdleThread:{}", core_id));
832 idle_thread->EnableDispatch();
832} 833}
833 834
834KScopedSchedulerLock::KScopedSchedulerLock(KernelCore& kernel) 835KScopedSchedulerLock::KScopedSchedulerLock(KernelCore& kernel)
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index 8d48a7901..268789150 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -225,7 +225,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
225 // Setup the stack parameters. 225 // Setup the stack parameters.
226 StackParameters& sp = GetStackParameters(); 226 StackParameters& sp = GetStackParameters();
227 sp.cur_thread = this; 227 sp.cur_thread = this;
228 sp.disable_count = 0; 228 sp.disable_count = 1;
229 SetInExceptionHandler(); 229 SetInExceptionHandler();
230 230
231 // Set thread ID. 231 // Set thread ID.
@@ -1014,8 +1014,6 @@ ResultCode KThread::Run() {
1014 // Set our state and finish. 1014 // Set our state and finish.
1015 SetState(ThreadState::Runnable); 1015 SetState(ThreadState::Runnable);
1016 1016
1017 DisableDispatch();
1018
1019 return ResultSuccess; 1017 return ResultSuccess;
1020 } 1018 }
1021} 1019}
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 73593c7a0..66c8f4455 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -254,7 +254,6 @@ struct KernelCore::Impl {
254 core_id) 254 core_id)
255 .IsSuccess()); 255 .IsSuccess());
256 shutdown_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id)); 256 shutdown_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id));
257 shutdown_threads[core_id]->DisableDispatch();
258 } 257 }
259 } 258 }
260 259