sys_rsx/cellgcm: return EINVAL if the io map requast's size is 0

This commit is contained in:
eladash 2018-05-19 15:46:29 +03:00 committed by kd-11
parent 0a7902d313
commit 97515a0941
3 changed files with 9 additions and 11 deletions

View file

@ -992,8 +992,7 @@ s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset)
{ {
cellGcmSys.warning("cellGcmMapMainMemory(ea=0x%x, size=0x%x, offset=*0x%x)", ea, size, offset); cellGcmSys.warning("cellGcmMapMainMemory(ea=0x%x, size=0x%x, offset=*0x%x)", ea, size, offset);
if (size == 0) return CELL_OK; if (!size || (ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE;
if ((ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE;
u32 io = RSXIOMem.Map(ea, size); u32 io = RSXIOMem.Map(ea, size);

View file

@ -182,12 +182,15 @@ s32 sys_rsx_context_free(u32 context_id)
s32 sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 flags) s32 sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 flags)
{ {
sys_rsx.warning("sys_rsx_context_iomap(context_id=0x%x, io=0x%x, ea=0x%x, size=0x%x, flags=0x%llx)", context_id, io, ea, size, flags); sys_rsx.warning("sys_rsx_context_iomap(context_id=0x%x, io=0x%x, ea=0x%x, size=0x%x, flags=0x%llx)", context_id, io, ea, size, flags);
if (size == 0) return CELL_OK;
if (RSXIOMem.Map(ea, size, io)) if (!RSXIOMem.Map(ea, size, io))
return CELL_OK; {
return CELL_EINVAL; return CELL_EINVAL;
} }
return CELL_OK;
}
/* /*
* lv2 SysCall 673 (0x2A1): sys_rsx_context_iounmap * lv2 SysCall 673 (0x2A1): sys_rsx_context_iounmap
* @param context_id (IN): RSX context, E.g. 0x55555555 (in vsh.self) * @param context_id (IN): RSX context, E.g. 0x55555555 (in vsh.self)

View file

@ -18,8 +18,6 @@ bool VirtualMemoryBlock::IsInMyRange(const u32 addr, const u32 size)
u32 VirtualMemoryBlock::Map(u32 realaddr, u32 size) u32 VirtualMemoryBlock::Map(u32 realaddr, u32 size)
{ {
verify(HERE), (size);
for (u32 addr = m_range_start; addr <= m_range_start + m_range_size - 1 - GetReservedAmount() - size;) for (u32 addr = m_range_start; addr <= m_range_start + m_range_size - 1 - GetReservedAmount() - size;)
{ {
bool is_good_addr = true; bool is_good_addr = true;
@ -48,9 +46,7 @@ u32 VirtualMemoryBlock::Map(u32 realaddr, u32 size)
bool VirtualMemoryBlock::Map(u32 realaddr, u32 size, u32 addr) bool VirtualMemoryBlock::Map(u32 realaddr, u32 size, u32 addr)
{ {
verify(HERE), (size); if (!size || !IsInMyRange(addr, size))
if (!IsInMyRange(addr, size))
{ {
return false; return false;
} }