mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-07 09:10:00 +01:00
Prefer vm::ptr<>::ptr over vm::get_addr.
Prefer vm::_ptr/base over vm::g_base_addr with offset.
Added methods atomic_t<>::bts and atomic_t<>::btr .
Removed obsolute rsx:🧵:Read/WriteIO32 methods.
Removed wrong check in semaphore_release.
Added handling for PUTRx commands for RawSPU MFC proxy.
Prefer overloaded methods of v128 instead of _mm_... in VPKSHUS ppu interpreter precise.
Fixed more potential overflows that may result in wrong behaviour.
Added io/size alignment check for sys_rsx_context_iounmap.
Added rsx::constants::local_mem_base which represents RSX local memory base address.
Removed obsolute rsx:🧵:main_mem_addr/ioSize/ioAddress members.
48 lines
1 KiB
C++
48 lines
1 KiB
C++
#pragma once
|
|
|
|
#include "vm.h"
|
|
#include "Utilities/cond.h"
|
|
|
|
#include "Utilities/Atomic.h"
|
|
|
|
class notifier;
|
|
|
|
namespace vm
|
|
{
|
|
|
|
// Get reservation status for further atomic update: last update timestamp
|
|
inline atomic_t<u64>& reservation_acquire(u32 addr, u32 size)
|
|
{
|
|
// Access reservation info: stamp and the lock bit
|
|
return reinterpret_cast<atomic_t<u64>*>(g_reservations)[addr / 128];
|
|
}
|
|
|
|
// Update reservation status
|
|
inline void reservation_update(u32 addr, u32 size, bool lsb = false)
|
|
{
|
|
// Update reservation info with new timestamp
|
|
reservation_acquire(addr, size) += 128;
|
|
}
|
|
|
|
// Get reservation sync variable
|
|
inline shared_cond& reservation_notifier(u32 addr, u32 size)
|
|
{
|
|
return *reinterpret_cast<shared_cond*>(g_reservations2 + addr / 128 * 8);
|
|
}
|
|
|
|
void reservation_lock_internal(atomic_t<u64>&);
|
|
|
|
inline atomic_t<u64>& reservation_lock(u32 addr, u32 size)
|
|
{
|
|
auto& res = vm::reservation_acquire(addr, size);
|
|
|
|
if (UNLIKELY(res.bts(0)))
|
|
{
|
|
reservation_lock_internal(res);
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
} // namespace vm
|