void sys_spinlock_initialize(vm::ptr<atomic_t<u32>> lock) { sys_spinlock.Log("sys_spinlock_initialize(lock_addr=0x%x)", lock.addr()); // prx: set 0 and sync lock->exchange(be_t<u32>::make(0)); }
void sys_spinlock_unlock(vm::ptr<atomic_t<u32>> lock) { sys_spinlock.Log("sys_spinlock_unlock(lock_addr=0x%x)", lock.addr()); // prx: sync and set 0 lock->exchange(be_t<u32>::make(0)); }
void sys_spinlock_initialize(vm::ptr<atomic_be_t<u32>> lock) { sysPrxForUser.Log("sys_spinlock_initialize(lock=*0x%x)", lock); // prx: set 0 and sync lock->exchange(be_t<u32>::make(0)); }
void sys_spinlock_unlock(vm::ptr<atomic_be_t<u32>> lock) { sysPrxForUser.Log("sys_spinlock_unlock(lock=*0x%x)", lock); // prx: sync and set 0 lock->exchange(be_t<u32>::make(0)); g_sys_spinlock_wm.notify(lock.addr()); }
s32 sys_spinlock_trylock(vm::ptr<atomic_t<u32>> lock) { sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.addr()); // prx: exchange with 0xabadcafe, translate exchanged value if (lock->exchange(be_t<u32>::make(0xabadcafe)).data()) { return CELL_EBUSY; } return CELL_OK; }
s32 sys_spinlock_trylock(vm::ptr<std::atomic<be_t<u32>>> lock) { sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.addr()); // prx: exchange with 0xabadcafe, translate exchanged value if (lock->exchange(be_t<u32>::MakeFromBE(se32(0xabadcafe))).ToBE()) { return CELL_EBUSY; } return CELL_OK; }
void sys_spinlock_lock(vm::ptr<atomic_be_t<u32>> lock) { sysPrxForUser.Log("sys_spinlock_lock(lock=*0x%x)", lock); // prx: exchange with 0xabadcafe, repeat until exchanged with 0 while (lock->exchange(be_t<u32>::make(0xabadcafe)).data()) { g_sys_spinlock_wm.wait_op(lock.addr(), [lock](){ return lock->read_relaxed().data() == 0; }); if (Emu.IsStopped()) { sysPrxForUser.Warning("sys_spinlock_lock(lock=*0x%x) aborted", lock); break; } } }
void sys_spinlock_lock(vm::ptr<atomic_t<u32>> lock) { sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.addr()); // prx: exchange with 0xabadcafe, repeat until exchanged with 0 while (lock->exchange(be_t<u32>::make(0xabadcafe)).data()) { while (lock->read_relaxed().data()) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack if (Emu.IsStopped()) { break; } } if (Emu.IsStopped()) { sys_spinlock.Warning("sys_spinlock_lock(0x%x) aborted", lock.addr()); break; } } }
void sys_spinlock_lock(vm::ptr<std::atomic<be_t<u32>>> lock) { sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.addr()); // prx: exchange with 0xabadcafe, repeat until exchanged with 0 while (lock->exchange(be_t<u32>::MakeFromBE(se32(0xabadcafe))).ToBE()) { while (lock->load(std::memory_order_relaxed).ToBE()) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack if (Emu.IsStopped()) { break; } } if (Emu.IsStopped()) { sys_spinlock.Warning("sys_spinlock_lock(0x%x) aborted", lock.addr()); break; } } }