mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-13 16:58:52 -05:00
vm_manager: Migrate memory querying to the VMManager interface
Gets rid of the need to directly access the managed VMAs outside of the memory manager itself just for querying memory.
This commit is contained in:
@ -302,6 +302,25 @@ ResultCode VMManager::HeapFree(VAddr target, u64 size) {
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
MemoryInfo VMManager::QueryMemory(VAddr address) const {
|
||||
const auto vma = FindVMA(address);
|
||||
MemoryInfo memory_info{};
|
||||
|
||||
if (IsValidHandle(vma)) {
|
||||
memory_info.base_address = vma->second.base;
|
||||
memory_info.permission = static_cast<u32>(vma->second.permissions);
|
||||
memory_info.size = vma->second.size;
|
||||
memory_info.state = ToSvcMemoryState(vma->second.meminfo_state);
|
||||
} else {
|
||||
memory_info.base_address = 0;
|
||||
memory_info.permission = static_cast<u32>(VMAPermission::None);
|
||||
memory_info.size = 0;
|
||||
memory_info.state = static_cast<u32>(MemoryState::Unmapped);
|
||||
}
|
||||
|
||||
return memory_info;
|
||||
}
|
||||
|
||||
ResultCode VMManager::MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size, MemoryState state) {
|
||||
const auto vma = FindVMA(src_addr);
|
||||
|
||||
|
Reference in New Issue
Block a user