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 | |
| 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')
| -rw-r--r-- | src/core/arm/arm_interface.h | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 10 |
2 files changed, 3 insertions, 17 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index be9f3703a..87a1c29cc 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include <mutex> | ||
| 10 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 11 | 10 | ||
| 12 | namespace Common { | 11 | namespace Common { |
| @@ -165,14 +164,6 @@ public: | |||
| 165 | std::string name; | 164 | std::string name; |
| 166 | }; | 165 | }; |
| 167 | 166 | ||
| 168 | void Lock() { | ||
| 169 | guard.lock(); | ||
| 170 | } | ||
| 171 | |||
| 172 | void Unlock() { | ||
| 173 | guard.unlock(); | ||
| 174 | } | ||
| 175 | |||
| 176 | std::vector<BacktraceEntry> GetBacktrace() const; | 167 | std::vector<BacktraceEntry> GetBacktrace() const; |
| 177 | 168 | ||
| 178 | /// fp (= r29) points to the last frame record. | 169 | /// fp (= r29) points to the last frame record. |
| @@ -187,7 +178,6 @@ protected: | |||
| 187 | /// System context that this ARM interface is running under. | 178 | /// System context that this ARM interface is running under. |
| 188 | System& system; | 179 | System& system; |
| 189 | CPUInterruptHandler& interrupt_handler; | 180 | CPUInterruptHandler& interrupt_handler; |
| 190 | std::mutex guard; | ||
| 191 | }; | 181 | }; |
| 192 | 182 | ||
| 193 | } // namespace Core | 183 | } // namespace Core |
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; |