Skip to content

Commit 4f2328f

Browse files
committed
sys_rsx: Avoid modifying arguments
1 parent e2e6e89 commit 4f2328f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

rpcs3/Emu/Cell/lv2/sys_rsx.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,20 +477,23 @@ error_code sys_rsx_context_iomap(cpu_thread& cpu, u32 context_id, u32 io, u32 ea
477477
}
478478
}
479479

480-
io >>= 20, ea >>= 20, size >>= 20;
481-
482480
rsx::eng_lock fifo_lock(render);
483481
std::scoped_lock lock(render->sys_rsx_mtx);
484482

485-
for (u32 i = 0; i < size; i++)
483+
for (u32 i = 0; i < size; i += _1m)
486484
{
487485
auto& table = render->iomap_table;
488486

489-
// TODO: Investigate relaxed memory ordering
490-
const u32 prev_ea = table.ea[io + i];
491-
table.ea[io + i].release((ea + i) << 20);
492-
if (prev_ea + 1) table.io[prev_ea >> 20].release(-1); // Clear previous mapping if exists
493-
table.io[ea + i].release((io + i) << 20);
487+
const u32 prev_ea = table.ea[(io + i) / _1m];
488+
489+
table.ea[(io + i) / _1m].release(ea + i);
490+
491+
if (prev_ea != umax)
492+
{
493+
table.io[prev_ea / _1m].release(-1); // Clear previous mapping if exists
494+
}
495+
496+
table.io[(ea + i) / _1m].release(io + i);
494497
}
495498

496499
return CELL_OK;

0 commit comments

Comments
 (0)