1
0
Fork 0

cpu_core: Separate cpu_core and memory

This makes cpu_core and memory being completely independent components inside the system, having a simpler and more understandable initialization process
The thread which casues page table changes in memory will be responsible to notify the cpu_core too
This commit is contained in:
bamsbamx 2019-06-22 18:21:50 +02:00
parent bb776e25a9
commit ac9755306c
4 changed files with 1 additions and 12 deletions

View File

@ -189,7 +189,6 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
} }
kernel->GetThreadManager().SetCPU(*cpu_core); kernel->GetThreadManager().SetCPU(*cpu_core);
memory->SetCPU(*cpu_core);
if (Settings::values.enable_dsp_lle) { if (Settings::values.enable_dsp_lle) {
dsp_core = std::make_unique<AudioCore::DspLle>(*memory, dsp_core = std::make_unique<AudioCore::DspLle>(*memory,

View File

@ -114,6 +114,7 @@ void ThreadManager::SwitchContext(Thread* new_thread) {
kernel.SetCurrentProcess(SharedFrom(current_thread->owner_process)); kernel.SetCurrentProcess(SharedFrom(current_thread->owner_process));
kernel.memory.SetCurrentPageTable( kernel.memory.SetCurrentPageTable(
&current_thread->owner_process->vm_manager.page_table); &current_thread->owner_process->vm_manager.page_table);
cpu->PageTableChanged(); // notify the CPU the page table in memory has changed
} }
cpu->LoadContext(new_thread->context); cpu->LoadContext(new_thread->context);

View File

@ -66,22 +66,14 @@ public:
RasterizerCacheMarker cache_marker; RasterizerCacheMarker cache_marker;
std::vector<PageTable*> page_table_list; std::vector<PageTable*> page_table_list;
ARM_Interface* cpu = nullptr;
AudioCore::DspInterface* dsp = nullptr; AudioCore::DspInterface* dsp = nullptr;
}; };
MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {} MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {}
MemorySystem::~MemorySystem() = default; MemorySystem::~MemorySystem() = default;
void MemorySystem::SetCPU(ARM_Interface& cpu) {
impl->cpu = &cpu;
}
void MemorySystem::SetCurrentPageTable(PageTable* page_table) { void MemorySystem::SetCurrentPageTable(PageTable* page_table) {
impl->current_page_table = page_table; impl->current_page_table = page_table;
if (impl->cpu != nullptr) {
impl->cpu->PageTableChanged();
}
} }
PageTable* MemorySystem::GetCurrentPageTable() const { PageTable* MemorySystem::GetCurrentPageTable() const {

View File

@ -220,9 +220,6 @@ public:
MemorySystem(); MemorySystem();
~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. * Maps an allocated buffer onto a region of the emulated process address space.
* *