summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-08-05 21:18:51 +0200
committerLioncash <mathew1800@gmail.com>2020-08-05 21:19:48 +0200
commita10d64ea79dcc38e342acd1d35e2a0d61f228d13 (patch)
treef9eade2aec2cad114d1d4655d66a73543864d9c3 /src/core/hle/kernel/scheduler.cpp
parentMerge pull request #4466 from ogniK5377/loader-type-safe (diff)
downloadyuzu-a10d64ea79dcc38e342acd1d35e2a0d61f228d13.tar
yuzu-a10d64ea79dcc38e342acd1d35e2a0d61f228d13.tar.gz
yuzu-a10d64ea79dcc38e342acd1d35e2a0d61f228d13.tar.bz2
yuzu-a10d64ea79dcc38e342acd1d35e2a0d61f228d13.tar.lz
yuzu-a10d64ea79dcc38e342acd1d35e2a0d61f228d13.tar.xz
yuzu-a10d64ea79dcc38e342acd1d35e2a0d61f228d13.tar.zst
yuzu-a10d64ea79dcc38e342acd1d35e2a0d61f228d13.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/scheduler.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index f93e5e4b0..77c095ef2 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -663,32 +663,26 @@ void Scheduler::Reload() {
}
void Scheduler::SwitchContextStep2() {
- Thread* previous_thread = current_thread_prev.get();
- Thread* new_thread = selected_thread.get();
-
// Load context of new thread
- Process* const previous_process =
- previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr;
-
- if (new_thread) {
- ASSERT_MSG(new_thread->GetSchedulingStatus() == ThreadSchedStatus::Runnable,
+ if (selected_thread) {
+ ASSERT_MSG(selected_thread->GetSchedulingStatus() == ThreadSchedStatus::Runnable,
"Thread must be runnable.");
// Cancel any outstanding wakeup events for this thread
- new_thread->SetIsRunning(true);
- new_thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
- new_thread->SetWasRunning(false);
+ selected_thread->SetIsRunning(true);
+ selected_thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
+ selected_thread->SetWasRunning(false);
auto* const thread_owner_process = current_thread->GetOwnerProcess();
if (thread_owner_process != nullptr) {
system.Kernel().MakeCurrentProcess(thread_owner_process);
}
- if (!new_thread->IsHLEThread()) {
- Core::ARM_Interface& cpu_core = new_thread->ArmInterface();
- cpu_core.LoadContext(new_thread->GetContext32());
- cpu_core.LoadContext(new_thread->GetContext64());
- cpu_core.SetTlsAddress(new_thread->GetTLSAddress());
- cpu_core.SetTPIDR_EL0(new_thread->GetTPIDR_EL0());
+ if (!selected_thread->IsHLEThread()) {
+ Core::ARM_Interface& cpu_core = selected_thread->ArmInterface();
+ cpu_core.LoadContext(selected_thread->GetContext32());
+ cpu_core.LoadContext(selected_thread->GetContext64());
+ cpu_core.SetTlsAddress(selected_thread->GetTLSAddress());
+ cpu_core.SetTPIDR_EL0(selected_thread->GetTPIDR_EL0());
cpu_core.ChangeProcessorID(this->core_id);
cpu_core.ClearExclusiveState();
}