kernel: Let the kernel handle all page table changes when switching processes

It will both change the page table in memory and notify the CPU about the change by itself. This way there is no need to call memory.SetCurrentPageTable() when kernel.setCurrentProcess() and the management is kept internally in the kernel
This commit is contained in:
bamsbamx 2019-06-26 00:39:11 +02:00
parent ac9755306c
commit dbfd830695
6 changed files with 25 additions and 11 deletions

View file

@ -47,7 +47,18 @@ std::shared_ptr<Process> KernelSystem::GetCurrentProcess() const {
}
void KernelSystem::SetCurrentProcess(std::shared_ptr<Process> process) {
current_process = std::move(process);
current_process = process;
SetCurrentMemPageTable(&process->vm_manager.page_table);
}
void KernelSystem::SetCurrentMemPageTable(Memory::PageTable* page_table) {
memory.SetCurrentPageTable(page_table);
current_cpu->PageTableChanged(); // notify the CPU the page table in memory has changed
}
void KernelSystem::SetCPU(std::shared_ptr<ARM_Interface> cpu) {
current_cpu = cpu;
thread_manager->SetCPU(*cpu);
}
ThreadManager& KernelSystem::GetThreadManager() {