summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2017-07-22 04:28:03 +0200
committerSubv <subv2112@gmail.com>2017-09-10 22:14:31 +0200
commitc34ec5e77cd9e83fcf5c929f3951557d5269b7a6 (patch)
treebfa5e3a17063f74a5cd2f3e7b7c63442281fb24e /src
parentKernel/Memory: Give each Process its own page table. (diff)
downloadyuzu-c34ec5e77cd9e83fcf5c929f3951557d5269b7a6.tar
yuzu-c34ec5e77cd9e83fcf5c929f3951557d5269b7a6.tar.gz
yuzu-c34ec5e77cd9e83fcf5c929f3951557d5269b7a6.tar.bz2
yuzu-c34ec5e77cd9e83fcf5c929f3951557d5269b7a6.tar.lz
yuzu-c34ec5e77cd9e83fcf5c929f3951557d5269b7a6.tar.xz
yuzu-c34ec5e77cd9e83fcf5c929f3951557d5269b7a6.tar.zst
yuzu-c34ec5e77cd9e83fcf5c929f3951557d5269b7a6.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/thread.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index f5f2eb2f7..b7f094f46 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -178,8 +178,18 @@ static void SwitchContext(Thread* new_thread) {
Core::CPU().LoadContext(new_thread->context);
Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
+
+ if (!previous_thread || previous_thread->owner_process != current_thread->owner_process) {
+ Kernel::g_current_process = current_thread->owner_process;
+ Memory::current_page_table = &Kernel::g_current_process->vm_manager.page_table;
+ // We have switched processes and thus, page tables, clear the instruction cache so we
+ // don't keep stale data from the previous process.
+ Core::CPU().ClearInstructionCache();
+ }
} else {
current_thread = nullptr;
+ // Note: We do not reset the current process and current page table when idling because
+ // technically we haven't changed processes, our threads are just paused.
}
}