mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-03 16:02:26 +00:00
fix memory direct query
i wish there were tests for this
This commit is contained in:
parent
ab60f290dc
commit
5535e51f82
@ -332,15 +332,19 @@ int MemoryManager::DirectMemoryQuery(PAddr addr, bool find_next,
|
||||
std::scoped_lock lk{mutex};
|
||||
|
||||
auto dmem_area = FindDmemArea(addr);
|
||||
while (dmem_area != dmem_map.end() && dmem_area->second.is_free && find_next) {
|
||||
dmem_area++;
|
||||
}
|
||||
|
||||
if (dmem_area == dmem_map.end() || dmem_area->second.is_free) {
|
||||
if (addr >= dmem_area->second.base + dmem_area->second.size) {
|
||||
if (!find_next) {
|
||||
LOG_ERROR(Core, "Unable to find allocated direct memory region to query!");
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
||||
dmem_area++;
|
||||
if (dmem_area == dmem_map.end()) {
|
||||
LOG_ERROR(Core, "Unable to find allocated direct memory region to query!");
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
}
|
||||
|
||||
const auto& area = dmem_area->second;
|
||||
out_info->start = area.base;
|
||||
out_info->end = area.GetEnd();
|
||||
|
Loading…
Reference in New Issue
Block a user