Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPU: New GETLLAR technique #8051

Merged
merged 4 commits into from Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 26 additions & 10 deletions rpcs3/Emu/Cell/PPUThread.cpp
Expand Up @@ -1033,27 +1033,43 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)

ppu.raddr = addr;

u64 count = 0;

while (g_use_rtm) [[likely]]
for (u64 count = 0; g_use_rtm; [&]()
{
if (++count < 20) [[likely]]
{
busy_wait(300);
}
else
{
std::this_thread::yield();
}
}())
{
ppu.rtime = vm::reservation_acquire(addr, sizeof(T)) & -128;
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;

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]]
{
ppu_log.error("%s took too long: %u", sizeof(T) == 4 ? "LWARX" : "LDARX", count);
}

return static_cast<T>(ppu.rdata << data_off >> size_off);
}
else
{
_mm_pause();
count++;
}
}

ppu.rtime = vm::reservation_acquire(addr, sizeof(T));
Expand Down