Merge pull request #2952 from MerryMage/page-tables

Switchable Page Tables
This commit is contained in:
B3n30 2017-09-25 08:29:32 +02:00 committed by GitHub
commit d881dee818
12 changed files with 56 additions and 27 deletions

View file

@ -178,16 +178,13 @@ static void SwitchContext(Thread* new_thread) {
ready_queue.remove(new_thread->current_priority, new_thread);
new_thread->status = THREADSTATUS_RUNNING;
Core::CPU().LoadContext(new_thread->context);
Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
if (previous_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();
SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table);
}
Core::CPU().LoadContext(new_thread->context);
Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
} else {
current_thread = nullptr;
// Note: We do not reset the current process and current page table when idling because