kernel: Nullability check for current_cpu when changing memory page table

This attempts to fix segfault in some tests where page table is set before initializing cpu core (intended behaviour? might be worth a check...)
see: src/tests/core/arm/arm_test_common.cpp
see: src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp
This commit is contained in:
bamsbamx 2019-06-26 11:51:42 +02:00
parent dbfd830695
commit ed095f3bff

View File

@ -53,8 +53,10 @@ void KernelSystem::SetCurrentProcess(std::shared_ptr<Process> process) {
void KernelSystem::SetCurrentMemPageTable(Memory::PageTable* page_table) { void KernelSystem::SetCurrentMemPageTable(Memory::PageTable* page_table) {
memory.SetCurrentPageTable(page_table); memory.SetCurrentPageTable(page_table);
if (current_cpu != nullptr) {
current_cpu->PageTableChanged(); // notify the CPU the page table in memory has changed current_cpu->PageTableChanged(); // notify the CPU the page table in memory has changed
} }
}
void KernelSystem::SetCPU(std::shared_ptr<ARM_Interface> cpu) { void KernelSystem::SetCPU(std::shared_ptr<ARM_Interface> cpu) {
current_cpu = cpu; current_cpu = cpu;