From 4576a31f47dbdb72a107c4d29cbb7761884d0bb9 Mon Sep 17 00:00:00 2001 From: eladash Date: Tue, 29 May 2018 20:34:33 +0300 Subject: [PATCH] fix memory mapping alignment --- rpcs3/Emu/Cell/lv2/sys_mmapper.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp index f772f1d3b5..571b3164aa 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp @@ -279,7 +279,14 @@ error_code sys_mmapper_map_shared_memory(u32 addr, u32 mem_id, u64 flags) const auto mem = idm::get(mem_id, [&](lv2_memory& mem) -> CellError { - if (addr % mem.align) + const u32 page_alignment = area->flags & SYS_MEMORY_PAGE_SIZE_1M ? 0x100000 : 0x10000; + + if (mem.align < page_alignment) + { + return CELL_EINVAL; + } + + if (addr % page_alignment) { return CELL_EALIGN; }