1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 11:13:19 +01:00

mfc: clamp atomic cmd's addr

This commit is contained in:
eladash 2018-06-21 15:24:47 +03:00 committed by Ivan
parent fa55a8072c
commit ac99fd764d

View File

@ -997,15 +997,16 @@ bool SPUThread::do_list_transfer(spu_mfc_cmd& args)
void SPUThread::do_putlluc(const spu_mfc_cmd& args)
{
if (raddr && args.eal == raddr)
const u32 addr = args.eal & -128u;
if (raddr && addr == raddr)
{
ch_event_stat |= SPU_EVENT_LR;
raddr = 0;
}
const u32 addr = args.eal;
auto& data = vm::_ref<decltype(rdata)>(addr);
const auto to_write = _ref<decltype(rdata)>(args.lsa & 0x3ffff);
const auto to_write = _ref<decltype(rdata)>(args.lsa & 0x3ff80);
// Store unconditionally
if (LIKELY(g_use_rtm))
@ -1174,14 +1175,15 @@ bool SPUThread::process_mfc_cmd(spu_mfc_cmd args)
{
case MFC_GETLLAR_CMD:
{
auto& data = vm::_ref<decltype(rdata)>(args.eal);
const u32 addr = args.eal & -128u;
auto& data = vm::_ref<decltype(rdata)>(addr);
if (raddr && raddr != args.eal)
if (raddr && raddr != addr)
{
ch_event_stat |= SPU_EVENT_LR;
}
raddr = args.eal;
raddr = addr;
const bool is_polling = false; // TODO
@ -1254,7 +1256,7 @@ bool SPUThread::process_mfc_cmd(spu_mfc_cmd args)
}
// Copy to LS
_ref<decltype(rdata)>(args.lsa & 0x3ffff) = rdata;
_ref<decltype(rdata)>(args.lsa & 0x3ff80) = rdata;
ch_atomic_stat.set_value(MFC_GETLLAR_SUCCESS);
return true;
}
@ -1262,12 +1264,13 @@ bool SPUThread::process_mfc_cmd(spu_mfc_cmd args)
case MFC_PUTLLC_CMD:
{
// Store conditionally
auto& data = vm::_ref<decltype(rdata)>(args.eal);
const auto to_write = _ref<decltype(rdata)>(args.lsa & 0x3ffff);
const u32 addr = args.eal & -128u;
auto& data = vm::_ref<decltype(rdata)>(addr);
const auto to_write = _ref<decltype(rdata)>(args.lsa & 0x3ff80);
bool result = false;
if (raddr == args.eal && rtime == vm::reservation_acquire(raddr, 128))
if (raddr == addr && rtime == vm::reservation_acquire(raddr, 128))
{
if (LIKELY(g_use_rtm))
{