mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
SPU: Implement Accurate DMA (#8822)
This commit is contained in:
parent
ddfa077c3e
commit
73d23eb6e6
12 changed files with 170 additions and 60 deletions
|
|
@ -440,16 +440,20 @@ namespace vm
|
|||
g_mutex.unlock();
|
||||
}
|
||||
|
||||
bool reservation_lock_internal(u32 addr, atomic_t<u64>& res)
|
||||
u64 reservation_lock_internal(u32 addr, atomic_t<u64>& res, u64 lock_bits)
|
||||
{
|
||||
for (u64 i = 0;; i++)
|
||||
{
|
||||
if (!res.bts(0)) [[likely]]
|
||||
if (u64 rtime = res; !(rtime & 127) && reservation_trylock(res, rtime, lock_bits)) [[likely]]
|
||||
{
|
||||
break;
|
||||
return rtime;
|
||||
}
|
||||
|
||||
if (i < 15)
|
||||
if (auto cpu = get_current_cpu_thread(); cpu && cpu->state)
|
||||
{
|
||||
cpu->check_state();
|
||||
}
|
||||
else if (i < 15)
|
||||
{
|
||||
busy_wait(500);
|
||||
}
|
||||
|
|
@ -458,14 +462,12 @@ namespace vm
|
|||
// TODO: Accurate locking in this case
|
||||
if (!(g_pages[addr / 4096].flags & page_writable))
|
||||
{
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void _page_map(u32 addr, u8 flags, u32 size, utils::shm* shm)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue