mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-16 07:20:59 +00:00
PPU: Fix LWARX/LDARX on TSX path
This commit is contained in:
parent
e423128a32
commit
3be687cd18
@ -1033,15 +1033,36 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)
|
|||||||
|
|
||||||
ppu.raddr = addr;
|
ppu.raddr = addr;
|
||||||
|
|
||||||
u64 count = 0;
|
for (u64 count = 0; g_use_rtm; [&]()
|
||||||
|
|
||||||
while (g_use_rtm) [[likely]]
|
|
||||||
{
|
{
|
||||||
ppu.rtime = vm::reservation_acquire(addr, sizeof(T)) & -128;
|
if (++count < 20) [[likely]]
|
||||||
|
{
|
||||||
|
busy_wait(300);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::this_thread::yield();
|
||||||
|
}
|
||||||
|
}())
|
||||||
|
{
|
||||||
|
ppu.rtime = vm::reservation_acquire(addr, sizeof(T));
|
||||||
|
|
||||||
|
if (ppu.rtime & 127)
|
||||||
|
{
|
||||||
|
if (!(ppu.state & cpu_flag::wait))
|
||||||
|
{
|
||||||
|
ppu.state += cpu_flag::wait;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ppu.rdata = data;
|
ppu.rdata = data;
|
||||||
|
|
||||||
if ((vm::reservation_acquire(addr, sizeof(T)) & -128) == ppu.rtime) [[likely]]
|
if (vm::reservation_acquire(addr, sizeof(T)) == ppu.rtime) [[likely]]
|
||||||
{
|
{
|
||||||
|
ppu.test_stopped();
|
||||||
|
|
||||||
if (count >= 10) [[unlikely]]
|
if (count >= 10) [[unlikely]]
|
||||||
{
|
{
|
||||||
ppu_log.error("%s took too long: %u", sizeof(T) == 4 ? "LWARX" : "LDARX", count);
|
ppu_log.error("%s took too long: %u", sizeof(T) == 4 ? "LWARX" : "LDARX", count);
|
||||||
@ -1049,11 +1070,6 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)
|
|||||||
|
|
||||||
return static_cast<T>(ppu.rdata << data_off >> size_off);
|
return static_cast<T>(ppu.rdata << data_off >> size_off);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_mm_pause();
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ppu.rtime = vm::reservation_acquire(addr, sizeof(T));
|
ppu.rtime = vm::reservation_acquire(addr, sizeof(T));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user