mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +00:00
Correctness fix for RSXIOMem
- Make RSXIOMem volatile. - Hint the compiler to check only once the address returned.
This commit is contained in:
parent
b7da3ea5cd
commit
fc253165e2
@ -1086,8 +1086,8 @@ s32 cellGcmUnmapEaIoAddress(u32 ea)
|
||||
|
||||
for (u32 i = 0; i < size; i++)
|
||||
{
|
||||
RSXIOMem.io[ea + i] = offsetTable.ioAddress[ea + i] = 0xFFFF;
|
||||
RSXIOMem.ea[io + i] = offsetTable.eaAddress[io + i] = 0xFFFF;
|
||||
RSXIOMem.io[ea + i].release(offsetTable.ioAddress[ea + i] = 0xFFFF);
|
||||
RSXIOMem.ea[io + i].release(offsetTable.eaAddress[io + i] = 0xFFFF);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1109,8 +1109,8 @@ s32 cellGcmUnmapIoAddress(u32 io)
|
||||
|
||||
for (u32 i = 0; i < size; i++)
|
||||
{
|
||||
RSXIOMem.io[ea + i] = offsetTable.ioAddress[ea + i] = 0xFFFF;
|
||||
RSXIOMem.ea[io + i] = offsetTable.eaAddress[io + i] = 0xFFFF;
|
||||
RSXIOMem.io[ea + i].release(offsetTable.ioAddress[ea + i] = 0xFFFF);
|
||||
RSXIOMem.ea[io + i].release(offsetTable.eaAddress[io + i] = 0xFFFF);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -196,8 +196,8 @@ s32 sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 flags)
|
||||
|
||||
for (u32 i = 0; i < size; i++)
|
||||
{
|
||||
RSXIOMem.io[ea + i] = io + i;
|
||||
RSXIOMem.ea[io + i] = ea + i;
|
||||
RSXIOMem.io[ea + i].release(io + i);
|
||||
RSXIOMem.ea[io + i].release(ea + i);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
@ -221,8 +221,8 @@ s32 sys_rsx_context_iounmap(u32 context_id, u32 io, u32 size)
|
||||
const u32 end = (io >>= 20) + (size >>= 20);
|
||||
for (u32 ea = RSXIOMem.ea[io]; io < end;)
|
||||
{
|
||||
RSXIOMem.io[ea++] = 0xFFFF;
|
||||
RSXIOMem.ea[io++] = 0xFFFF;
|
||||
RSXIOMem.io[ea++].release(0xFFFF);
|
||||
RSXIOMem.ea[io++].release(0xFFFF);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -27,21 +27,25 @@ extern u64 get_system_time();
|
||||
|
||||
struct RSXIOTable
|
||||
{
|
||||
u16 ea[4096];
|
||||
u16 io[3072];
|
||||
atomic_t<u16> ea[4096];
|
||||
atomic_t<u16> io[3072];
|
||||
|
||||
// try to get the real address given a mapped address
|
||||
// return non zero on success
|
||||
inline u32 RealAddr(u32 offs)
|
||||
{
|
||||
const u32 upper = this->ea[offs >> 20];
|
||||
u32 result = this->ea[offs >> 20].load();
|
||||
|
||||
if (static_cast<s16>(upper) < 0)
|
||||
if (static_cast<s16>(result) < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (upper << 20) | (offs & 0xFFFFF);
|
||||
result <<= 20; result |= (offs & 0xFFFFF);
|
||||
|
||||
ASSUME(result != 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user