summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-05-13 14:17:34 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:36:15 -0400
commitd24014358883987d7ebdafc4863a7bc36addfa1b (patch)
tree4277b9194972e40e124f130f2759268bf14cd4d6 /src
parentYuzuQT: Hide Speed UI on Multicore. (diff)
downloadyuzu-d24014358883987d7ebdafc4863a7bc36addfa1b.tar.gz
yuzu-d24014358883987d7ebdafc4863a7bc36addfa1b.tar.xz
yuzu-d24014358883987d7ebdafc4863a7bc36addfa1b.zip
Kernel: Correct Host Context on Threads and Scheduler.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/scheduler.cpp16
-rw-r--r--src/core/hle/kernel/scheduler.h2
-rw-r--r--src/core/hle/kernel/thread.cpp2
-rw-r--r--src/core/hle/kernel/thread.h2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 43c924fa0..61b8a396a 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -736,15 +736,15 @@ void Scheduler::SwitchContext() {
736 previous_thread->context_guard.unlock(); 736 previous_thread->context_guard.unlock();
737 } 737 }
738 738
739 std::shared_ptr<Common::Fiber> old_context; 739 std::shared_ptr<Common::Fiber>* old_context;
740 if (previous_thread != nullptr) { 740 if (previous_thread != nullptr) {
741 old_context = previous_thread->GetHostContext(); 741 old_context = &previous_thread->GetHostContext();
742 } else { 742 } else {
743 old_context = idle_thread->GetHostContext(); 743 old_context = &idle_thread->GetHostContext();
744 } 744 }
745 guard.unlock(); 745 guard.unlock();
746 746
747 Common::Fiber::YieldTo(old_context, switch_fiber); 747 Common::Fiber::YieldTo(*old_context, switch_fiber);
748 /// When a thread wakes up, the scheduler may have changed to other in another core. 748 /// When a thread wakes up, the scheduler may have changed to other in another core.
749 auto& next_scheduler = system.Kernel().CurrentScheduler(); 749 auto& next_scheduler = system.Kernel().CurrentScheduler();
750 next_scheduler.SwitchContextStep2(); 750 next_scheduler.SwitchContextStep2();
@@ -774,13 +774,13 @@ void Scheduler::SwitchToCurrent() {
774 break; 774 break;
775 } 775 }
776 } 776 }
777 std::shared_ptr<Common::Fiber> next_context; 777 std::shared_ptr<Common::Fiber>* next_context;
778 if (current_thread != nullptr) { 778 if (current_thread != nullptr) {
779 next_context = current_thread->GetHostContext(); 779 next_context = &current_thread->GetHostContext();
780 } else { 780 } else {
781 next_context = idle_thread->GetHostContext(); 781 next_context = &idle_thread->GetHostContext();
782 } 782 }
783 Common::Fiber::YieldTo(switch_fiber, next_context); 783 Common::Fiber::YieldTo(switch_fiber, *next_context);
784 } 784 }
785 } 785 }
786} 786}
diff --git a/src/core/hle/kernel/scheduler.h b/src/core/hle/kernel/scheduler.h
index 10dc4b832..348107160 100644
--- a/src/core/hle/kernel/scheduler.h
+++ b/src/core/hle/kernel/scheduler.h
@@ -236,7 +236,7 @@ public:
236 236
237 void OnThreadStart(); 237 void OnThreadStart();
238 238
239 std::shared_ptr<Common::Fiber> ControlContext() { 239 std::shared_ptr<Common::Fiber>& ControlContext() {
240 return switch_fiber; 240 return switch_fiber;
241 } 241 }
242 242
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index fba2a9c85..2b1092697 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -150,7 +150,7 @@ static void ResetThreadContext64(Core::ARM_Interface::ThreadContext64& context,
150 context.fpcr = 0; 150 context.fpcr = 0;
151} 151}
152 152
153std::shared_ptr<Common::Fiber> Thread::GetHostContext() const { 153std::shared_ptr<Common::Fiber>& Thread::GetHostContext() {
154 return host_context; 154 return host_context;
155} 155}
156 156
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 3ae0df6ef..c0342c462 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -342,7 +342,7 @@ public:
342 was_running = value; 342 was_running = value;
343 } 343 }
344 344
345 std::shared_ptr<Common::Fiber> GetHostContext() const; 345 std::shared_ptr<Common::Fiber>& GetHostContext();
346 346
347 ThreadStatus GetStatus() const { 347 ThreadStatus GetStatus() const {
348 return status; 348 return status;