summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-03-07 14:16:25 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:35:58 -0400
commit5974e3ea33e12e7abd813704e5b895003ba83555 (patch)
treea72710344f6436cf5bd91eab3424b89188123285
parentGeneral: Move ARM_Interface into Threads. (diff)
downloadyuzu-5974e3ea33e12e7abd813704e5b895003ba83555.tar.gz
yuzu-5974e3ea33e12e7abd813704e5b895003ba83555.tar.xz
yuzu-5974e3ea33e12e7abd813704e5b895003ba83555.zip
Thread: Release the ARM Interface on exitting.
-rw-r--r--src/core/hle/kernel/scheduler.cpp2
-rw-r--r--src/core/hle/kernel/thread.cpp2
-rw-r--r--src/core/hle/kernel/thread.h5
3 files changed, 8 insertions, 1 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index a5083ae7c..ce7e1986d 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -724,7 +724,7 @@ void Scheduler::SwitchContext() {
724 previous_thread->SetContinuousOnSVC(false); 724 previous_thread->SetContinuousOnSVC(false);
725 previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks(); 725 previous_thread->last_running_ticks = system.CoreTiming().GetCPUTicks();
726 previous_thread->SetIsRunning(false); 726 previous_thread->SetIsRunning(false);
727 if (!previous_thread->IsHLEThread()) { 727 if (!previous_thread->IsHLEThread() && !previous_thread->HasExited()) {
728 Core::ARM_Interface& cpu_core = previous_thread->ArmInterface(); 728 Core::ARM_Interface& cpu_core = previous_thread->ArmInterface();
729 cpu_core.SaveContext(previous_thread->GetContext32()); 729 cpu_core.SaveContext(previous_thread->GetContext32());
730 cpu_core.SaveContext(previous_thread->GetContext64()); 730 cpu_core.SaveContext(previous_thread->GetContext64());
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 58b06aa9e..65fedfc9b 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -69,6 +69,8 @@ void Thread::Stop() {
69 // Mark the TLS slot in the thread's page as free. 69 // Mark the TLS slot in the thread's page as free.
70 owner_process->FreeTLSRegion(tls_address); 70 owner_process->FreeTLSRegion(tls_address);
71 } 71 }
72 arm_interface.reset();
73 has_exited = true;
72 } 74 }
73 global_handle = 0; 75 global_handle = 0;
74} 76}
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index c08fc3a89..f651d7822 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -610,6 +610,10 @@ public:
610 is_phantom_mode = phantom; 610 is_phantom_mode = phantom;
611 } 611 }
612 612
613 bool HasExited() const {
614 return has_exited;
615 }
616
613private: 617private:
614 friend class GlobalScheduler; 618 friend class GlobalScheduler;
615 friend class Scheduler; 619 friend class Scheduler;
@@ -714,6 +718,7 @@ private:
714 718
715 bool will_be_terminated = false; 719 bool will_be_terminated = false;
716 bool is_phantom_mode = false; 720 bool is_phantom_mode = false;
721 bool has_exited = false;
717 722
718 bool was_running = false; 723 bool was_running = false;
719 724