summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-08-07 08:16:12 +0200
committerbunnei <bunneidev@gmail.com>2021-12-07 01:39:16 +0100
commit13c82d042f10dbaec7fb66764bf4b636e7a2949b (patch)
tree6e2e12e6f52e852c049b29c5e525a2f85dce3a36
parentcore: hle: kernel: k_scheduler: Improve Unload. (diff)
downloadyuzu-13c82d042f10dbaec7fb66764bf4b636e7a2949b.tar
yuzu-13c82d042f10dbaec7fb66764bf4b636e7a2949b.tar.gz
yuzu-13c82d042f10dbaec7fb66764bf4b636e7a2949b.tar.bz2
yuzu-13c82d042f10dbaec7fb66764bf4b636e7a2949b.tar.lz
yuzu-13c82d042f10dbaec7fb66764bf4b636e7a2949b.tar.xz
yuzu-13c82d042f10dbaec7fb66764bf4b636e7a2949b.tar.zst
yuzu-13c82d042f10dbaec7fb66764bf4b636e7a2949b.zip
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp
index 5ee4b8adc..e523c4923 100644
--- a/src/core/hle/kernel/k_scheduler.cpp
+++ b/src/core/hle/kernel/k_scheduler.cpp
@@ -721,7 +721,7 @@ void KScheduler::SwitchContextStep2() {
}
void KScheduler::ScheduleImpl() {
- KThread* previous_thread = current_thread.load();
+ KThread* previous_thread = GetCurrentThread();
KThread* next_thread = state.highest_priority_thread;
state.needs_scheduling = false;
@@ -733,10 +733,15 @@ void KScheduler::ScheduleImpl() {
// If we're not actually switching thread, there's nothing to do.
if (next_thread == current_thread.load()) {
+ previous_thread->EnableDispatch();
guard.Unlock();
return;
}
+ if (next_thread->GetCurrentCore() != core_id) {
+ next_thread->SetCurrentCore(core_id);
+ }
+
current_thread.store(next_thread);
KProcess* const previous_process = system.Kernel().CurrentProcess();
@@ -747,11 +752,7 @@ void KScheduler::ScheduleImpl() {
Unload(previous_thread);
std::shared_ptr<Common::Fiber>* old_context;
- if (previous_thread != nullptr) {
- old_context = &previous_thread->GetHostContext();
- } else {
- old_context = &idle_thread->GetHostContext();
- }
+ old_context = &previous_thread->GetHostContext();
guard.Unlock();
Common::Fiber::YieldTo(*old_context, *switch_fiber);