rsx: Fix data written to RSX semaphores and the initial data of them (#8235)

This commit is contained in:
Eladash 2020-05-16 11:55:56 +03:00 committed by GitHub
parent eecb22e749
commit 8a0425570c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 13 deletions

View file

@ -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)
{
reports.semaphore[i].val = 0x1337C0D3;
reports.semaphore[i].pad = 0x1337BABE;
reports.semaphore[i].timestamp = -1; // technically different but should be fine
reports.semaphore[i].zero = 0x1337BABE;
reports.semaphore[i].zero2 = 0x1337BEEF1337F001;
}
for (int i = 0; i < 2048; ++i)

View file

@ -87,8 +87,8 @@ struct RsxDmaControl
struct alignas(16) RsxSemaphore
{
be_t<u32> val;
be_t<u32> pad;
be_t<u64> timestamp;
be_t<u32> zero;
be_t<u64> zero2;
};
struct alignas(16) RsxNotify

View file

@ -126,7 +126,7 @@ namespace rsx
{
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();
// By avoiding doing this on flip's semaphore release
@ -139,15 +139,19 @@ namespace rsx
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);
vm::write32(addr, arg);
res &= -128;
res->release(*res & -128);
}
vm::reservation_notifier(addr, 4).notify_all();
@ -226,7 +230,7 @@ namespace rsx
{
arg,
0,
rsx->timestamp()
0
});
}
@ -242,7 +246,7 @@ namespace rsx
{
val,
0,
rsx->timestamp()
0
});
}