Memory: register page tables into a list for rasterizer cache marking
This commit is contained in:
parent
9d616e5951
commit
88161b8ac6
|
@ -402,8 +402,13 @@ ResultCode Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission pe
|
|||
}
|
||||
|
||||
Kernel::Process::Process(KernelSystem& kernel)
|
||||
: Object(kernel), handle_table(kernel), kernel(kernel), vm_manager(kernel.memory) {}
|
||||
Kernel::Process::~Process() {}
|
||||
: Object(kernel), handle_table(kernel), kernel(kernel), vm_manager(kernel.memory) {
|
||||
|
||||
kernel.memory.RegisterPageTable(&vm_manager.page_table);
|
||||
}
|
||||
Kernel::Process::~Process() {
|
||||
kernel.memory.UnregisterPageTable(&vm_manager.page_table);
|
||||
}
|
||||
|
||||
SharedPtr<Process> KernelSystem::GetProcessById(u32 process_id) const {
|
||||
auto itr = std::find_if(
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
|
||||
PageTable* current_page_table = nullptr;
|
||||
RasterizerCacheMarker cache_marker;
|
||||
std::vector<PageTable*> page_table_list;
|
||||
};
|
||||
|
||||
MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {}
|
||||
|
@ -146,6 +147,15 @@ u8* MemorySystem::GetPointerForRasterizerCache(VAddr addr) {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void MemorySystem::RegisterPageTable(PageTable* page_table) {
|
||||
impl->page_table_list.push_back(page_table);
|
||||
}
|
||||
|
||||
void MemorySystem::UnregisterPageTable(PageTable* page_table) {
|
||||
impl->page_table_list.erase(
|
||||
std::find(impl->page_table_list.begin(), impl->page_table_list.end(), page_table));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should only be called for virtual addreses with attribute `PageType::Special`.
|
||||
*/
|
||||
|
|
|
@ -281,6 +281,12 @@ public:
|
|||
*/
|
||||
void RasterizerMarkRegionCached(PAddr start, u32 size, bool cached);
|
||||
|
||||
/// Registers page table for rasterizer cache marking
|
||||
void RegisterPageTable(PageTable* page_table);
|
||||
|
||||
/// Unregisters page table for rasterizer cache marking
|
||||
void UnregisterPageTable(PageTable* page_table);
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
T Read(const VAddr vaddr);
|
||||
|
|
Reference in New Issue