diff options
| author | 2020-03-07 13:27:27 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:35 -0400 | |
| commit | 725bac14044b2645b9ce912d1b1e2c9c2a96818b (patch) | |
| tree | a5eaedf5bc5647f9bde9215097472819bbb9d6ac /src/core/hle/kernel/scheduler.cpp | |
| parent | Yuzu/Debuggers: Correct Wait Tree for Paused threads. (diff) | |
| download | yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar.gz yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar.xz yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.zip | |
Scheduler: Remove arm_interface lock and a few corrections.
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index a37b992ec..affc2fbed 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -463,9 +463,7 @@ void GlobalScheduler::AdjustSchedulingOnPriority(Thread* thread, u32 old_priorit | |||
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | if (thread->processor_id >= 0) { | 465 | if (thread->processor_id >= 0) { |
| 466 | // TODO(Blinkhawk): compare it with current thread running on current core, instead of | 466 | if (thread == kernel.CurrentScheduler().GetCurrentThread()) { |
| 467 | // checking running | ||
| 468 | if (thread->IsRunning()) { | ||
| 469 | SchedulePrepend(thread->current_priority, static_cast<u32>(thread->processor_id), | 467 | SchedulePrepend(thread->current_priority, static_cast<u32>(thread->processor_id), |
| 470 | thread); | 468 | thread); |
| 471 | } else { | 469 | } else { |
| @@ -602,8 +600,6 @@ void Scheduler::SwitchContextStep2() { | |||
| 602 | previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr; | 600 | previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr; |
| 603 | 601 | ||
| 604 | if (new_thread) { | 602 | if (new_thread) { |
| 605 | auto& cpu_core = system.ArmInterface(core_id); | ||
| 606 | cpu_core.Lock(); | ||
| 607 | ASSERT_MSG(new_thread->GetSchedulingStatus() == ThreadSchedStatus::Runnable, | 603 | ASSERT_MSG(new_thread->GetSchedulingStatus() == ThreadSchedStatus::Runnable, |
| 608 | "Thread must be runnable."); | 604 | "Thread must be runnable."); |
| 609 | 605 | ||
| @@ -615,6 +611,7 @@ void Scheduler::SwitchContextStep2() { | |||
| 615 | system.Kernel().MakeCurrentProcess(thread_owner_process); | 611 | system.Kernel().MakeCurrentProcess(thread_owner_process); |
| 616 | } | 612 | } |
| 617 | if (!new_thread->IsHLEThread()) { | 613 | if (!new_thread->IsHLEThread()) { |
| 614 | auto& cpu_core = system.ArmInterface(core_id); | ||
| 618 | cpu_core.LoadContext(new_thread->GetContext32()); | 615 | cpu_core.LoadContext(new_thread->GetContext32()); |
| 619 | cpu_core.LoadContext(new_thread->GetContext64()); | 616 | cpu_core.LoadContext(new_thread->GetContext64()); |
| 620 | cpu_core.SetTlsAddress(new_thread->GetTLSAddress()); | 617 | cpu_core.SetTlsAddress(new_thread->GetTLSAddress()); |
| @@ -646,8 +643,8 @@ void Scheduler::SwitchContext() { | |||
| 646 | 643 | ||
| 647 | // Save context for previous thread | 644 | // Save context for previous thread |
| 648 | if (previous_thread) { | 645 | if (previous_thread) { |
| 649 | auto& cpu_core = system.ArmInterface(core_id); | ||
| 650 | if (!previous_thread->IsHLEThread()) { | 646 | if (!previous_thread->IsHLEThread()) { |
| 647 | auto& cpu_core = system.ArmInterface(core_id); | ||
| 651 | cpu_core.SaveContext(previous_thread->GetContext32()); | 648 | cpu_core.SaveContext(previous_thread->GetContext32()); |
| 652 | cpu_core.SaveContext(previous_thread->GetContext64()); | 649 | cpu_core.SaveContext(previous_thread->GetContext64()); |
| 653 | // Save the TPIDR_EL0 system register in case it was modified. | 650 | // Save the TPIDR_EL0 system register in case it was modified. |
| @@ -659,7 +656,6 @@ void Scheduler::SwitchContext() { | |||
| 659 | } | 656 | } |
| 660 | previous_thread->SetIsRunning(false); | 657 | previous_thread->SetIsRunning(false); |
| 661 | previous_thread->context_guard.unlock(); | 658 | previous_thread->context_guard.unlock(); |
| 662 | cpu_core.Unlock(); | ||
| 663 | } | 659 | } |
| 664 | 660 | ||
| 665 | std::shared_ptr<Common::Fiber> old_context; | 661 | std::shared_ptr<Common::Fiber> old_context; |