Minor EFAULT fix in sys_semaphore_get_value/sys_event_flag_get
ESRCH preceeds EFAULT in both syscalls.
This commit is contained in:
@@ -410,11 +410,6 @@ error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr<u64> flags)
|
|||||||
|
|
||||||
sys_event_flag.trace("sys_event_flag_get(id=0x%x, flags=*0x%x)", id, flags);
|
sys_event_flag.trace("sys_event_flag_get(id=0x%x, flags=*0x%x)", id, flags);
|
||||||
|
|
||||||
if (!flags)
|
|
||||||
{
|
|
||||||
return CELL_EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto flag = idm::check<lv2_obj, lv2_event_flag>(id, [](lv2_event_flag& flag)
|
const auto flag = idm::check<lv2_obj, lv2_event_flag>(id, [](lv2_event_flag& flag)
|
||||||
{
|
{
|
||||||
return +flag.pattern;
|
return +flag.pattern;
|
||||||
@@ -422,10 +417,15 @@ error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr<u64> flags)
|
|||||||
|
|
||||||
if (!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
*flags = 0;
|
if (flags) *flags = 0;
|
||||||
return CELL_ESRCH;
|
return CELL_ESRCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!flags)
|
||||||
|
{
|
||||||
|
return CELL_EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
*flags = flag.ret;
|
*flags = flag.ret;
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,11 +265,6 @@ error_code sys_semaphore_get_value(ppu_thread& ppu, u32 sem_id, vm::ptr<s32> cou
|
|||||||
|
|
||||||
sys_semaphore.trace("sys_semaphore_get_value(sem_id=0x%x, count=*0x%x)", sem_id, count);
|
sys_semaphore.trace("sys_semaphore_get_value(sem_id=0x%x, count=*0x%x)", sem_id, count);
|
||||||
|
|
||||||
if (!count)
|
|
||||||
{
|
|
||||||
return CELL_EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto sema = idm::check<lv2_obj, lv2_sema>(sem_id, [](lv2_sema& sema)
|
const auto sema = idm::check<lv2_obj, lv2_sema>(sem_id, [](lv2_sema& sema)
|
||||||
{
|
{
|
||||||
return std::max<s32>(0, sema.val);
|
return std::max<s32>(0, sema.val);
|
||||||
@@ -280,6 +275,11 @@ error_code sys_semaphore_get_value(ppu_thread& ppu, u32 sem_id, vm::ptr<s32> cou
|
|||||||
return CELL_ESRCH;
|
return CELL_ESRCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!count)
|
||||||
|
{
|
||||||
|
return CELL_EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
*count = sema.ret;
|
*count = sema.ret;
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user