mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 14:01:25 +12:00
* Optimizations 1) Some headers simplified for better compilation time 2) Some templates simplified for smaller executable size 3) Eliminate std::future to fix compilation for mingw64 4) PKG installation can be cancelled now 5) cellGame fixes 6) XAudio2 fix for mingw64 7) PPUInterpreter bug fixed (Clang) * any_pod<> implemented Aliases: any16, any32, any64 rsx::make_command fixed
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#include "stdafx.h"
|
|
#include "Emu/System.h"
|
|
#include "Emu/Cell/PPUModule.h"
|
|
|
|
#include "sysPrxForUser.h"
|
|
|
|
#include "Emu/Memory/wait_engine.h"
|
|
|
|
extern _log::channel sysPrxForUser;
|
|
|
|
void sys_spinlock_initialize(vm::ptr<atomic_be_t<u32>> lock)
|
|
{
|
|
sysPrxForUser.trace("sys_spinlock_initialize(lock=*0x%x)", lock);
|
|
|
|
lock->exchange(0);
|
|
}
|
|
|
|
void sys_spinlock_lock(vm::ptr<atomic_be_t<u32>> lock)
|
|
{
|
|
sysPrxForUser.trace("sys_spinlock_lock(lock=*0x%x)", lock);
|
|
|
|
// prx: exchange with 0xabadcafe, repeat until exchanged with 0
|
|
vm::wait_op(lock.addr(), 4, WRAP_EXPR(!lock->exchange(0xabadcafe)));
|
|
}
|
|
|
|
s32 sys_spinlock_trylock(vm::ptr<atomic_be_t<u32>> lock)
|
|
{
|
|
sysPrxForUser.trace("sys_spinlock_trylock(lock=*0x%x)", lock);
|
|
|
|
if (lock->exchange(0xabadcafe))
|
|
{
|
|
return CELL_EBUSY;
|
|
}
|
|
|
|
return CELL_OK;
|
|
}
|
|
|
|
void sys_spinlock_unlock(vm::ptr<atomic_be_t<u32>> lock)
|
|
{
|
|
sysPrxForUser.trace("sys_spinlock_unlock(lock=*0x%x)", lock);
|
|
|
|
lock->exchange(0);
|
|
|
|
vm::notify_at(lock.addr(), 4);
|
|
}
|
|
|
|
void sysPrxForUser_sys_spinlock_init()
|
|
{
|
|
REG_FUNC(sysPrxForUser, sys_spinlock_initialize);
|
|
REG_FUNC(sysPrxForUser, sys_spinlock_lock);
|
|
REG_FUNC(sysPrxForUser, sys_spinlock_trylock);
|
|
REG_FUNC(sysPrxForUser, sys_spinlock_unlock);
|
|
}
|