mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-16 23:17:29 +00:00
Add missing EALIGN check for sys_mmapper_search_and_map
This commit is contained in:
parent
a832581201
commit
0a5b6ad928
@ -346,14 +346,22 @@ error_code sys_mmapper_search_and_map(ppu_thread& ppu, u32 start_addr, u32 mem_i
|
||||
|
||||
const auto area = vm::get(vm::any, start_addr);
|
||||
|
||||
if (!area || start_addr < 0x20000000 || start_addr >= 0xC0000000)
|
||||
if (!area || start_addr != area->addr || start_addr < 0x20000000 || start_addr >= 0xC0000000)
|
||||
{
|
||||
return {CELL_EINVAL, start_addr};
|
||||
}
|
||||
|
||||
const auto mem = idm::get<lv2_obj, lv2_memory>(mem_id, [&](lv2_memory& mem)
|
||||
const auto mem = idm::get<lv2_obj, lv2_memory>(mem_id, [&](lv2_memory& mem) -> CellError
|
||||
{
|
||||
const u32 page_alignment = area->flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000;
|
||||
|
||||
if (mem.align < page_alignment)
|
||||
{
|
||||
return CELL_EALIGN;
|
||||
}
|
||||
|
||||
mem.counter++;
|
||||
return {};
|
||||
});
|
||||
|
||||
if (!mem)
|
||||
@ -361,6 +369,11 @@ error_code sys_mmapper_search_and_map(ppu_thread& ppu, u32 start_addr, u32 mem_i
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if (mem.ret)
|
||||
{
|
||||
return mem.ret;
|
||||
}
|
||||
|
||||
const u32 addr = area->alloc(mem->size, mem->align, &mem->shm, mem->align == 0x10000 ? SYS_MEMORY_PAGE_SIZE_64K : SYS_MEMORY_PAGE_SIZE_1M);
|
||||
|
||||
if (!addr)
|
||||
|
Loading…
Reference in New Issue
Block a user