2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

vm_manager: Amend the returned values for invalid memory queries in QueryMemory()

The kernel returns a memory info instance with the base address set to
the end of the address space, and the size of said block as
0 - address_space_end, it doesn't set both of said members to zero.
This commit is contained in:
Lioncash 2018-12-12 13:26:33 -05:00
parent a8cc03502b
commit eb5f3f67f6
2 changed files with 7 additions and 4 deletions

View file

@ -28,7 +28,7 @@ static const char* GetMemoryStateName(MemoryState state) {
"IpcBuffer0", "Stack", "IpcBuffer0", "Stack",
"ThreadLocal", "TransferMemoryIsolated", "ThreadLocal", "TransferMemoryIsolated",
"TransferMemory", "ProcessMemory", "TransferMemory", "ProcessMemory",
"Unknown2", "IpcBuffer1", "Inaccessible", "IpcBuffer1",
"IpcBuffer3", "KernelStack", "IpcBuffer3", "KernelStack",
}; };
@ -312,10 +312,10 @@ MemoryInfo VMManager::QueryMemory(VAddr address) const {
memory_info.size = vma->second.size; memory_info.size = vma->second.size;
memory_info.state = ToSvcMemoryState(vma->second.meminfo_state); memory_info.state = ToSvcMemoryState(vma->second.meminfo_state);
} else { } else {
memory_info.base_address = 0; memory_info.base_address = address_space_end;
memory_info.permission = static_cast<u32>(VMAPermission::None); memory_info.permission = static_cast<u32>(VMAPermission::None);
memory_info.size = 0; memory_info.size = 0 - address_space_end;
memory_info.state = static_cast<u32>(MemoryState::Unmapped); memory_info.state = static_cast<u32>(MemoryState::Inaccessible);
} }
return memory_info; return memory_info;

View file

@ -105,6 +105,9 @@ enum class MemoryState : u32 {
ProcessMemory = 0x0F | FlagIPC3 | FlagIPC1 | FlagMapped | FlagMemoryPoolAllocated, ProcessMemory = 0x0F | FlagIPC3 | FlagIPC1 | FlagMapped | FlagMemoryPoolAllocated,
// Used to signify an inaccessible or invalid memory region with memory queries
Inaccessible = 0x10,
IpcBuffer1 = 0x11 | FlagIPC3 | FlagIPC1 | FlagMapped | FlagQueryPhysicalAddressAllowed | IpcBuffer1 = 0x11 | FlagIPC3 | FlagIPC1 | FlagMapped | FlagQueryPhysicalAddressAllowed |
FlagSharedDevice | FlagSharedDeviceAligned | FlagMemoryPoolAllocated, FlagSharedDevice | FlagSharedDeviceAligned | FlagMemoryPoolAllocated,