Memory: register page tables into a list for rasterizer cache marking

This commit is contained in:
Weiyi Wang 2018-12-10 22:13:10 -05:00
parent 9d616e5951
commit 88161b8ac6
3 changed files with 23 additions and 2 deletions

View File

@ -402,8 +402,13 @@ ResultCode Process::Unmap(VAddr target, VAddr source, u32 size, VMAPermission pe
} }
Kernel::Process::Process(KernelSystem& kernel) Kernel::Process::Process(KernelSystem& kernel)
: Object(kernel), handle_table(kernel), kernel(kernel), vm_manager(kernel.memory) {} : Object(kernel), handle_table(kernel), kernel(kernel), vm_manager(kernel.memory) {
Kernel::Process::~Process() {}
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 { SharedPtr<Process> KernelSystem::GetProcessById(u32 process_id) const {
auto itr = std::find_if( auto itr = std::find_if(

View File

@ -70,6 +70,7 @@ public:
PageTable* current_page_table = nullptr; PageTable* current_page_table = nullptr;
RasterizerCacheMarker cache_marker; RasterizerCacheMarker cache_marker;
std::vector<PageTable*> page_table_list;
}; };
MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {} MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {}
@ -146,6 +147,15 @@ u8* MemorySystem::GetPointerForRasterizerCache(VAddr addr) {
UNREACHABLE(); 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`. * This function should only be called for virtual addreses with attribute `PageType::Special`.
*/ */

View File

@ -281,6 +281,12 @@ public:
*/ */
void RasterizerMarkRegionCached(PAddr start, u32 size, bool cached); 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: private:
template <typename T> template <typename T>
T Read(const VAddr vaddr); T Read(const VAddr vaddr);