mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-11 06:40:39 +00:00
rsx: Fix gcm unmap events
This commit is contained in:
parent
b56b425b19
commit
c53f0dd7b5
@ -222,6 +222,8 @@ error_code sys_rsx_context_iounmap(u32 context_id, u32 io, u32 size)
|
|||||||
return CELL_EINVAL;
|
return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vm::reader_lock rlock;
|
||||||
|
|
||||||
std::scoped_lock lock(s_rsxmem_mtx);
|
std::scoped_lock lock(s_rsxmem_mtx);
|
||||||
|
|
||||||
const u32 end = (io >>= 20) + (size >>= 20);
|
const u32 end = (io >>= 20) + (size >>= 20);
|
||||||
|
@ -2398,25 +2398,45 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (!m_rsx_thread_exiting && address < rsx::constants::local_mem_base)
|
if (!m_rsx_thread_exiting && address < rsx::constants::local_mem_base)
|
||||||
{
|
{
|
||||||
u32 ea = address >> 20, io = RSXIOMem.io[ea];
|
if (!isHLE)
|
||||||
|
{
|
||||||
|
// Each bit represents io entry to be unmapped
|
||||||
|
u64 unmap_status[512 / 64]{};
|
||||||
|
|
||||||
|
for (u32 ea = address >> 20, end = ea + size >> 20; ea < end; ea++)
|
||||||
|
{
|
||||||
|
u32 io = RSXIOMem.io[ea];
|
||||||
|
|
||||||
if (io < 512)
|
if (io < 512)
|
||||||
{
|
{
|
||||||
if (!isHLE)
|
unmap_status[io / 64] |= 1ull << (io & 63);
|
||||||
|
RSXIOMem.ea[io].raw() = 0xFFFF;
|
||||||
|
RSXIOMem.io[ea].raw() = 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (u32 i = 0; i < std::size(unmap_status); i++)
|
||||||
{
|
{
|
||||||
const u64 unmap_key = u64((1ull << (size >> 20)) - 1) << (io & 0x3f);
|
// TODO: Check order when sending multiple events
|
||||||
const u64 gcm_flag = 0x100000000ull << (io >> 6);
|
if (u64 to_unmap = unmap_status[i])
|
||||||
sys_event_port_send(fxm::get<SysRsxConfig>()->rsx_event_port, 0, gcm_flag, unmap_key);
|
{
|
||||||
|
// Each 64 entries are grouped by a bit
|
||||||
|
const u64 io_event = 0x100000000ull << i;
|
||||||
|
sys_event_port_send(fxm::get<SysRsxConfig>()->rsx_event_port, 0, io_event, to_unmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// TODO: Fix this
|
||||||
|
u32 ea = address >> 20, io = RSXIOMem.io[ea];
|
||||||
|
|
||||||
for (const u32 end = ea + (size >> 20); ea < end;)
|
for (const u32 end = ea + (size >> 20); ea < end;)
|
||||||
{
|
{
|
||||||
offsetTable.ioAddress[ea++] = 0xFFFF;
|
offsetTable.ioAddress[ea++] = 0xFFFF;
|
||||||
offsetTable.eaAddress[io++] = 0xFFFF;
|
offsetTable.eaAddress[io++] = 0xFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Queue up memory invalidation
|
// Queue up memory invalidation
|
||||||
std::lock_guard lock(m_mtx_task);
|
std::lock_guard lock(m_mtx_task);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user