diff --git a/src/core/core.cpp b/src/core/core.cpp index f5c640fe5..df0ff93bd 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -189,6 +189,7 @@ System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) { } kernel->GetThreadManager().SetCPU(*cpu_core); + memory->SetCPU(*cpu_core); if (Settings::values.enable_dsp_lle) { dsp_core = std::make_unique(*memory, diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 7080b30dc..c1e9c6b9a 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -65,15 +65,21 @@ public: PageTable* current_page_table = nullptr; RasterizerCacheMarker cache_marker; std::vector page_table_list; + + ARM_Interface* cpu = nullptr; }; MemorySystem::MemorySystem() : impl(std::make_unique()) {} MemorySystem::~MemorySystem() = default; +void MemorySystem::SetCPU(ARM_Interface& cpu) { + impl->cpu = &cpu; +} + void MemorySystem::SetCurrentPageTable(PageTable* page_table) { impl->current_page_table = page_table; - if (Core::System::GetInstance().IsPoweredOn()) { - Core::CPU().PageTableChanged(); + if (impl->cpu != nullptr) { + impl->cpu->PageTableChanged(); } } diff --git a/src/core/memory.h b/src/core/memory.h index f154affc2..4a72f184e 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -12,6 +12,8 @@ #include "common/common_types.h" #include "core/mmio.h" +class ARM_Interface; + namespace Kernel { class Process; } @@ -214,6 +216,9 @@ public: MemorySystem(); ~MemorySystem(); + /// Sets CPU to notify page table change + void SetCPU(ARM_Interface& cpu); + /** * Maps an allocated buffer onto a region of the emulated process address space. *