Rsx: fix translation when address is negative

move address shift to where it should be, extend io table to catch all possible values.
This commit is contained in:
eladash 2018-08-20 13:44:37 +03:00 committed by kd-11
parent d1d1b2effd
commit 158019b50f
3 changed files with 6 additions and 13 deletions

View file

@ -80,8 +80,7 @@ void InitOffsetTable()
memset(offsetTable.eaAddress.get_ptr(), 0xFF, 512 * sizeof(u16));
memset(IoMapTable, 0, 3072 * sizeof(u16));
memset(RSXIOMem.ea, 0xFF, 512 * sizeof(u16));
memset(RSXIOMem.io, 0xFF, 3072 * sizeof(u16));
memset(&RSXIOMem, 0xFF, sizeof(RSXIOMem));
}
//----------------------------------------------------------------------------

View file

@ -124,8 +124,7 @@ s32 sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_dma_cont
dmaControl.put = 0;
dmaControl.ref = 0xFFFFFFFF;
memset(RSXIOMem.ea, 0xFF, 512 * sizeof(u16));
memset(RSXIOMem.io, 0xFF, 3072 * sizeof(u16));
memset(&RSXIOMem, 0xFF, sizeof(RSXIOMem));
if (false/*system_mode == CELL_GCM_SYSTEM_MODE_IOMAP_512MB*/)
rsx::get_current_renderer()->main_mem_size = 0x20000000; //512MB

View file

@ -29,26 +29,21 @@ extern u64 get_system_time();
struct RSXIOTable
{
u16 ea[512];
u16 ea[4096];
u16 io[3072];
// try to get the real address given a mapped address
// return non zero on success
inline u32 RealAddr(u32 offs)
{
if (offs & 0xE0000000)
{
return 0; // offset is beyond the limit
}
const u32 upper = this->ea[offs >> 20];
const s32 upper = this->ea[offs >> 20] << 20;
if (upper < 0)
if (static_cast<s16>(upper) < 0)
{
return 0;
}
return upper | (offs & 0xFFFFF);
return (upper << 20) | (offs & 0xFFFFF);
}
};