mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
Implement cpu_thread::if_suspended
Use it for opportunistic guaranteed GETLLAR execution (TSX-FA).
This commit is contained in:
parent
f5c575961f
commit
adf50b7c4b
4 changed files with 61 additions and 6 deletions
|
@ -1189,10 +1189,27 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)
|
|||
ppu.use_full_rdata = false;
|
||||
}
|
||||
|
||||
for (u64 count = 0;; [&]()
|
||||
for (u64 count = 0; count != umax; [&]()
|
||||
{
|
||||
if (ppu.state)
|
||||
{
|
||||
if (ppu.state & cpu_flag::pause)
|
||||
{
|
||||
verify(HERE), cpu_thread::if_suspended<-1>(&ppu, [&]()
|
||||
{
|
||||
// Guaranteed success
|
||||
ppu.rtime = vm::reservation_acquire(addr, sizeof(T)) & -128;
|
||||
mov_rdata(ppu.rdata, *vm::get_super_ptr<spu_rdata_t>(addr & -128));
|
||||
});
|
||||
|
||||
// Exit loop
|
||||
if ((ppu.rtime & 127) == 0)
|
||||
{
|
||||
count = -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ppu.check_state();
|
||||
}
|
||||
else if (++count < 20) [[likely]]
|
||||
|
@ -1275,6 +1292,10 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)
|
|||
return static_cast<T>(rdata << data_off >> size_off);
|
||||
}
|
||||
}
|
||||
|
||||
be_t<u64> rdata;
|
||||
std::memcpy(&rdata, &ppu.rdata[addr & 0x78], 8);
|
||||
return static_cast<T>(rdata << data_off >> size_off);
|
||||
}
|
||||
|
||||
extern u32 ppu_lwarx(ppu_thread& ppu, u32 addr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue