mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
Fix vm::reservation_update
This commit is contained in:
parent
acee590733
commit
ee953f7953
@ -79,6 +79,28 @@ namespace vm
|
||||
// Memory pages
|
||||
std::array<memory_page, 0x100000000 / 4096> g_pages{};
|
||||
|
||||
void reservation_update(u32 addr, u32 size, bool lsb)
|
||||
{
|
||||
u64 old = UINT64_MAX;
|
||||
const auto cpu = get_current_cpu_thread();
|
||||
|
||||
while (true)
|
||||
{
|
||||
const auto [ok, rtime] = try_reservation_update(addr, size, lsb);
|
||||
if (ok || old / 128 < rtime / 128)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
old = rtime;
|
||||
|
||||
if (cpu && cpu->test_stopped())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void _register_lock(cpu_thread* _cpu)
|
||||
{
|
||||
for (u32 i = 0, max = g_cfg.core.ppu_threads;;)
|
||||
|
@ -14,12 +14,17 @@ namespace vm
|
||||
}
|
||||
|
||||
// Update reservation status
|
||||
inline void reservation_update(u32 addr, u32 size, bool lsb = false)
|
||||
inline std::pair<bool, u64> try_reservation_update(u32 addr, u32 size, bool lsb = false)
|
||||
{
|
||||
// Update reservation info with new timestamp
|
||||
reservation_acquire(addr, size) += 128;
|
||||
auto& res = reservation_acquire(addr, size);
|
||||
const u64 rtime = res;
|
||||
|
||||
return {!(rtime & 127) && res.compare_and_swap_test(rtime, rtime + 128), rtime};
|
||||
}
|
||||
|
||||
void reservation_update(u32 addr, u32 size, bool lsb = false);
|
||||
|
||||
// Get reservation sync variable
|
||||
inline atomic_t<u64>& reservation_notifier(u32 addr, u32 size)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user