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:
@ -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() {
|
||||
|
Reference in New Issue
Block a user