mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-02 00:15:06 +01:00
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:
parent
bb776e25a9
commit
ac9755306c
@ -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,
|
||||||
|
@ -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(
|
||||||
¤t_thread->owner_process->vm_manager.page_table);
|
¤t_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);
|
||||||
|
@ -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 {
|
||||||
|
@ -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.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user