Avoid reservation notifications in liblv2.sprx

This commit is contained in:
Eladash 2022-09-03 06:46:16 +03:00 committed by Ivan
parent 572a2a06d1
commit 92514e33bb
2 changed files with 19 additions and 4 deletions

View file

@ -2642,11 +2642,9 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
}())
{
// Test a common pattern in lwmutex
constexpr u64 mutex_free = u64{static_cast<u32>(0 - 1)} << 32;
const bool may_be_lwmutex_related = sizeof(T) == 8 ?
(new_data == mutex_free && old_data == u64{ppu.id} << 32) : (old_data == mutex_free && new_data == u64{ppu.id} << 32);
extern atomic_t<u32> liblv2_begin, liblv2_end;
if (!may_be_lwmutex_related)
if (ppu.cia < liblv2_begin || ppu.cia >= liblv2_end)
{
res.notify_all(-128);
}