Implement cpu_thread::if_suspended

Use it for opportunistic guaranteed GETLLAR execution (TSX-FA).
This commit is contained in:
Nekotekina 2020-10-17 14:55:31 +03:00
parent f5c575961f
commit adf50b7c4b
4 changed files with 61 additions and 6 deletions

View file

@ -2428,11 +2428,23 @@ bool spu_thread::process_mfc_cmd()
mov_rdata(temp, rdata);
}
for (u64 i = 0;; [&]()
for (u64 i = 0; i != umax; [&]()
{
if (state & cpu_flag::pause)
{
check_state();
verify(HERE), cpu_thread::if_suspended<-1>(this, [&]
{
// Guaranteed success
ntime = vm::reservation_acquire(addr, 128);
mov_rdata(rdata, *vm::get_super_ptr<spu_rdata_t>(addr));
});
// Exit loop
if ((ntime & 127) == 0)
{
i = -1;
return;
}
}
if (++i < 25) [[likely]]