mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
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:
parent
d1d1b2effd
commit
158019b50f
3 changed files with 6 additions and 13 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue