summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar MerryMage2017-09-24 22:42:42 +0100
committerGravatar MerryMage2017-09-24 22:42:42 +0100
commitc02bbb7030efd072511bd0051a44d9e503016f74 (patch)
treecf830eadae6493ee83b7de8b44c10c89d668b5ca /src/core/hle/kernel/thread.cpp
parentMerge pull request #2921 from jroweboy/batch-fix-2 (diff)
downloadyuzu-c02bbb7030efd072511bd0051a44d9e503016f74.tar.gz
yuzu-c02bbb7030efd072511bd0051a44d9e503016f74.tar.xz
yuzu-c02bbb7030efd072511bd0051a44d9e503016f74.zip
memory: Add GetCurrentPageTable/SetCurrentPageTable
Don't expose Memory::current_page_table as a global.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 324415a36..61378211f 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -178,16 +178,13 @@ static void SwitchContext(Thread* new_thread) {
178 ready_queue.remove(new_thread->current_priority, new_thread); 178 ready_queue.remove(new_thread->current_priority, new_thread);
179 new_thread->status = THREADSTATUS_RUNNING; 179 new_thread->status = THREADSTATUS_RUNNING;
180 180
181 Core::CPU().LoadContext(new_thread->context);
182 Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
183
184 if (previous_process != current_thread->owner_process) { 181 if (previous_process != current_thread->owner_process) {
185 Kernel::g_current_process = current_thread->owner_process; 182 Kernel::g_current_process = current_thread->owner_process;
186 Memory::current_page_table = &Kernel::g_current_process->vm_manager.page_table; 183 SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table);
187 // We have switched processes and thus, page tables, clear the instruction cache so we
188 // don't keep stale data from the previous process.
189 Core::CPU().ClearInstructionCache();
190 } 184 }
185
186 Core::CPU().LoadContext(new_thread->context);
187 Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
191 } else { 188 } else {
192 current_thread = nullptr; 189 current_thread = nullptr;
193 // Note: We do not reset the current process and current page table when idling because 190 // Note: We do not reset the current process and current page table when idling because