summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-03-01 12:14:17 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:35:58 -0400
commit1567824d2da8e9b49b433f3d1d753d8ad84e65f9 (patch)
treec9553bb3f1693e430054695737d2f87ba4b58955 /src/core/hle/kernel/scheduler.cpp
parentCore: Refactor ARM Interface. (diff)
downloadyuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.gz
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.xz
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.zip
General: Move ARM_Interface into Threads.
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
-rw-r--r--src/core/hle/kernel/scheduler.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 8d56b49ce..a5083ae7c 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -681,15 +681,16 @@ void Scheduler::SwitchContextStep2() {
681 new_thread->SetWasRunning(false); 681 new_thread->SetWasRunning(false);
682 682
683 auto* const thread_owner_process = current_thread->GetOwnerProcess(); 683 auto* const thread_owner_process = current_thread->GetOwnerProcess();
684 if (previous_process != thread_owner_process && thread_owner_process != nullptr) { 684 if (thread_owner_process != nullptr) {
685 system.Kernel().MakeCurrentProcess(thread_owner_process); 685 system.Kernel().MakeCurrentProcess(thread_owner_process);
686 } 686 }
687 if (!new_thread->IsHLEThread()) { 687 if (!new_thread->IsHLEThread()) {
688 auto& cpu_core = system.ArmInterface(core_id); 688 Core::ARM_Interface& cpu_core = new_thread->ArmInterface();
689 cpu_core.LoadContext(new_thread->GetContext32()); 689 cpu_core.LoadContext(new_thread->GetContext32());
690 cpu_core.LoadContext(new_thread->GetContext64()); 690 cpu_core.LoadContext(new_thread->GetContext64());
691 cpu_core.SetTlsAddress(new_thread->GetTLSAddress()); 691 cpu_core.SetTlsAddress(new_thread->GetTLSAddress());
692 cpu_core.SetTPIDR_EL0(new_thread->GetTPIDR_EL0()); 692 cpu_core.SetTPIDR_EL0(new_thread->GetTPIDR_EL0());
693 cpu_core.ChangeProcessorId(this->core_id);
693 cpu_core.ClearExclusiveState(); 694 cpu_core.ClearExclusiveState();
694 } 695 }
695 } 696 }
@@ -722,18 +723,15 @@ void Scheduler::SwitchContext() {
722 } 723 }
723 previous_thread->SetContinuousOnSVC(false); 724 previous_thread->SetContinuousOnSVC(false);
724 previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks(); 725 previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
726 previous_thread->SetIsRunning(false);
725 if (!previous_thread->IsHLEThread()) { 727 if (!previous_thread->IsHLEThread()) {
726 auto& cpu_core = system.ArmInterface(core_id); 728 Core::ARM_Interface& cpu_core = previous_thread->ArmInterface();
727 cpu_core.SaveContext(previous_thread->GetContext32()); 729 cpu_core.SaveContext(previous_thread->GetContext32());
728 cpu_core.SaveContext(previous_thread->GetContext64()); 730 cpu_core.SaveContext(previous_thread->GetContext64());
729 // Save the TPIDR_EL0 system register in case it was modified. 731 // Save the TPIDR_EL0 system register in case it was modified.
730 previous_thread->SetTPIDR_EL0(cpu_core.GetTPIDR_EL0()); 732 previous_thread->SetTPIDR_EL0(cpu_core.GetTPIDR_EL0());
731 cpu_core.ClearExclusiveState(); 733 cpu_core.ClearExclusiveState();
732 } 734 }
733 if (previous_thread->GetStatus() == ThreadStatus::Running) {
734 previous_thread->SetStatus(ThreadStatus::Ready);
735 }
736 previous_thread->SetIsRunning(false);
737 previous_thread->context_guard.unlock(); 735 previous_thread->context_guard.unlock();
738 } 736 }
739 737