mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 11:05:46 +00: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:
parent
1d3d7d08eb
commit
d7ba5372f3
4 changed files with 33 additions and 18 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue