diff options
author | bunnei <bunneidev@gmail.com> | 2022-06-22 00:30:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 00:30:27 +0200 |
commit | 73e13aa09051ce802ad6a4c98e0ce325a2cd707c (patch) | |
tree | 4485c500f91b1cb41bd81c16624b74d8c96b0d03 | |
parent | Merge pull request #8487 from german77/system-button (diff) | |
parent | kernel: fix some uses of disable_count (diff) | |
download | yuzu-73e13aa09051ce802ad6a4c98e0ce325a2cd707c.tar yuzu-73e13aa09051ce802ad6a4c98e0ce325a2cd707c.tar.gz yuzu-73e13aa09051ce802ad6a4c98e0ce325a2cd707c.tar.bz2 yuzu-73e13aa09051ce802ad6a4c98e0ce325a2cd707c.tar.lz yuzu-73e13aa09051ce802ad6a4c98e0ce325a2cd707c.tar.xz yuzu-73e13aa09051ce802ad6a4c98e0ce325a2cd707c.tar.zst yuzu-73e13aa09051ce802ad6a4c98e0ce325a2cd707c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/k_process.cpp | 15 | ||||
-rw-r--r-- | src/core/hle/kernel/k_scheduler.cpp | 1 | ||||
-rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 1 |
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 thread->GetContext64().cpu_registers[0] = 0; thread->GetContext32().cpu_registers[1] = thread_handle; thread->GetContext64().cpu_registers[1] = thread_handle; - thread->DisableDispatch(); - auto& kernel = system.Kernel(); - // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires - { - KScopedSchedulerLock lock{kernel}; - thread->SetState(ThreadState::Runnable); - - if (system.DebuggerEnabled()) { - thread->RequestSuspend(SuspendType::Debug); - } + if (system.DebuggerEnabled()) { + thread->RequestSuspend(SuspendType::Debug); } + + // Run our thread. + void(thread->Run()); } } // Anonymous namespace 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() { idle_thread = KThread::Create(system.Kernel()); ASSERT(KThread::InitializeIdleThread(system, idle_thread, core_id).IsSuccess()); idle_thread->SetName(fmt::format("IdleThread:{}", core_id)); + idle_thread->EnableDispatch(); } KScopedSchedulerLock::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 // Setup the stack parameters. StackParameters& sp = GetStackParameters(); sp.cur_thread = this; - sp.disable_count = 0; + sp.disable_count = 1; SetInExceptionHandler(); // Set thread ID. @@ -1014,8 +1014,6 @@ ResultCode KThread::Run() { // Set our state and finish. SetState(ThreadState::Runnable); - DisableDispatch(); - return ResultSuccess; } } 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 { core_id) .IsSuccess()); shutdown_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id)); - shutdown_threads[core_id]->DisableDispatch(); } } |