summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-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) {
178 178
179 Core::CPU().LoadContext(new_thread->context); 179 Core::CPU().LoadContext(new_thread->context);
180 Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); 180 Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
181
182 if (!previous_thread || previous_thread->owner_process != current_thread->owner_process) {
183 Kernel::g_current_process = current_thread->owner_process;
184 Memory::current_page_table = &Kernel::g_current_process->vm_manager.page_table;
185 // We have switched processes and thus, page tables, clear the instruction cache so we
186 // don't keep stale data from the previous process.
187 Core::CPU().ClearInstructionCache();
188 }
181 } else { 189 } else {
182 current_thread = nullptr; 190 current_thread = nullptr;
191 // Note: We do not reset the current process and current page table when idling because
192 // technically we haven't changed processes, our threads are just paused.
183 } 193 }
184} 194}
185 195