mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
rsx: Fix data written to RSX semaphores and the initial data of them (#8235)
This commit is contained in:
parent
eecb22e749
commit
8a0425570c
3 changed files with 17 additions and 13 deletions
|
@ -204,8 +204,8 @@ error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_d
|
||||||
for (int i = 0; i < 256; ++i)
|
for (int i = 0; i < 256; ++i)
|
||||||
{
|
{
|
||||||
reports.semaphore[i].val = 0x1337C0D3;
|
reports.semaphore[i].val = 0x1337C0D3;
|
||||||
reports.semaphore[i].pad = 0x1337BABE;
|
reports.semaphore[i].zero = 0x1337BABE;
|
||||||
reports.semaphore[i].timestamp = -1; // technically different but should be fine
|
reports.semaphore[i].zero2 = 0x1337BEEF1337F001;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2048; ++i)
|
for (int i = 0; i < 2048; ++i)
|
||||||
|
|
|
@ -87,8 +87,8 @@ struct RsxDmaControl
|
||||||
struct alignas(16) RsxSemaphore
|
struct alignas(16) RsxSemaphore
|
||||||
{
|
{
|
||||||
be_t<u32> val;
|
be_t<u32> val;
|
||||||
be_t<u32> pad;
|
be_t<u32> zero;
|
||||||
be_t<u64> timestamp;
|
be_t<u64> zero2;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct alignas(16) RsxNotify
|
struct alignas(16) RsxNotify
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
rsx->sync();
|
rsx->sync();
|
||||||
|
|
||||||
const u32 offset = method_registers.semaphore_offset_406e();
|
const u32 offset = method_registers.semaphore_offset_406e() & -16;
|
||||||
const u32 ctxt = method_registers.semaphore_context_dma_406e();
|
const u32 ctxt = method_registers.semaphore_context_dma_406e();
|
||||||
|
|
||||||
// By avoiding doing this on flip's semaphore release
|
// By avoiding doing this on flip's semaphore release
|
||||||
|
@ -139,15 +139,19 @@ namespace rsx
|
||||||
|
|
||||||
const u32 addr = get_address(offset, ctxt, HERE);
|
const u32 addr = get_address(offset, ctxt, HERE);
|
||||||
|
|
||||||
if (g_use_rtm) [[likely]]
|
atomic_t<u64>* res{};
|
||||||
|
|
||||||
|
// TODO: Check if possible to write on reservations
|
||||||
|
if (!g_use_rtm && rsx->label_addr >> 28 != addr >> 28) [[likely]]
|
||||||
{
|
{
|
||||||
vm::_ref<atomic_be_t<u32>>(addr) = arg;
|
res = &vm::reservation_lock(addr, 4);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
vm::_ref<atomic_t<RsxSemaphore>>(addr).store({arg, 0, 0});
|
||||||
|
|
||||||
|
if (res)
|
||||||
{
|
{
|
||||||
auto& res = vm::reservation_lock(addr, 4);
|
res->release(*res & -128);
|
||||||
vm::write32(addr, arg);
|
|
||||||
res &= -128;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm::reservation_notifier(addr, 4).notify_all();
|
vm::reservation_notifier(addr, 4).notify_all();
|
||||||
|
@ -226,7 +230,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
arg,
|
arg,
|
||||||
0,
|
0,
|
||||||
rsx->timestamp()
|
0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +246,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
val,
|
val,
|
||||||
0,
|
0,
|
||||||
rsx->timestamp()
|
0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue