summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-07 18:27:27 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:35 +0200
commit725bac14044b2645b9ce912d1b1e2c9c2a96818b (patch)
treea5eaedf5bc5647f9bde9215097472819bbb9d6ac /src/core/hle/kernel/scheduler.cpp
parentYuzu/Debuggers: Correct Wait Tree for Paused threads. (diff)
downloadyuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar
yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar.gz
yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar.bz2
yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar.lz
yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar.xz
yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.tar.zst
yuzu-725bac14044b2645b9ce912d1b1e2c9c2a96818b.zip
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
-rw-r--r--src/core/hle/kernel/scheduler.cpp10
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
}
if (thread->processor_id >= 0) {
- // TODO(Blinkhawk): compare it with current thread running on current core, instead of
- // checking running
- if (thread->IsRunning()) {
+ if (thread == kernel.CurrentScheduler().GetCurrentThread()) {
SchedulePrepend(thread->current_priority, static_cast<u32>(thread->processor_id),
thread);
} else {
@@ -602,8 +600,6 @@ void Scheduler::SwitchContextStep2() {
previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr;
if (new_thread) {
- auto& cpu_core = system.ArmInterface(core_id);
- cpu_core.Lock();
ASSERT_MSG(new_thread->GetSchedulingStatus() == ThreadSchedStatus::Runnable,
"Thread must be runnable.");
@@ -615,6 +611,7 @@ void Scheduler::SwitchContextStep2() {
system.Kernel().MakeCurrentProcess(thread_owner_process);
}
if (!new_thread->IsHLEThread()) {
+ auto& cpu_core = system.ArmInterface(core_id);
cpu_core.LoadContext(new_thread->GetContext32());
cpu_core.LoadContext(new_thread->GetContext64());
cpu_core.SetTlsAddress(new_thread->GetTLSAddress());
@@ -646,8 +643,8 @@ void Scheduler::SwitchContext() {
// Save context for previous thread
if (previous_thread) {
- auto& cpu_core = system.ArmInterface(core_id);
if (!previous_thread->IsHLEThread()) {
+ auto& cpu_core = system.ArmInterface(core_id);
cpu_core.SaveContext(previous_thread->GetContext32());
cpu_core.SaveContext(previous_thread->GetContext64());
// Save the TPIDR_EL0 system register in case it was modified.
@@ -659,7 +656,6 @@ void Scheduler::SwitchContext() {
}
previous_thread->SetIsRunning(false);
previous_thread->context_guard.unlock();
- cpu_core.Unlock();
}
std::shared_ptr<Common::Fiber> old_context;