本文整理汇总了C++中SysCallBase类的典型用法代码示例。如果您正苦于以下问题:C++ SysCallBase类的具体用法?C++ SysCallBase怎么用?C++ SysCallBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SysCallBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sys_semaphore_trywait
int sys_semaphore_trywait(u32 sem_id)
{
sys_sem.Log("sys_semaphore_trywait(sem_id=%d)", sem_id);
Semaphore* sem;
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
{
return CELL_ESRCH;
}
std::lock_guard<std::mutex> lock(sem->m_mutex);
if (sem->m_value > 0)
{
sem->m_value--;
return CELL_OK;
}
else
{
return CELL_EBUSY;
}
}
示例2: sys_spu_thread_group_resume
//175
s32 sys_spu_thread_group_resume(u32 id)
{
sc_spu.Log("sys_spu_thread_group_resume(id=%d)", id);
SpuGroupInfo* group_info;
if(!Emu.GetIdManager().GetIDData(id, group_info))
{
return CELL_ESRCH;
}
// TODO: check group state
for (u32 i = 0; i < group_info->list.size(); i++)
{
if (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
{
t->Resume();
}
}
return CELL_OK;
}
示例3: sys_spu_thread_set_argument
//166
int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
{
sc_spu.Warning("sys_spu_thread_set_argument(id=0x%x, arg_addr=0x%x)", id, arg.GetAddr());
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
if(!arg.IsGood())
{
return CELL_EFAULT;
}
thr->SetArg(0, arg->arg1);
thr->SetArg(1, arg->arg2);
thr->SetArg(2, arg->arg3);
thr->SetArg(3, arg->arg4);
return CELL_OK;
}
示例4: sys_interrupt_tag_destroy
s32 sys_interrupt_tag_destroy(u32 intrtag)
{
sys_interrupt.Warning("sys_interrupt_tag_destroy(intrtag=0x%x)", intrtag);
LV2_LOCK;
const auto tag = idm::get<lv2_int_tag_t>(intrtag);
if (!tag)
{
return CELL_ESRCH;
}
if (tag->handler)
{
return CELL_EBUSY;
}
idm::remove<lv2_int_tag_t>(intrtag);
return CELL_OK;
}
示例5: _sys_lwmutex_destroy
s32 _sys_lwmutex_destroy(u32 lwmutex_id)
{
sys_lwmutex.Warning("_sys_lwmutex_destroy(lwmutex_id=0x%x)", lwmutex_id);
LV2_LOCK;
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
if (!mutex)
{
return CELL_ESRCH;
}
if (!mutex->sq.empty())
{
return CELL_EBUSY;
}
Emu.GetIdManager().remove<lv2_lwmutex_t>(lwmutex_id);
return CELL_OK;
}
示例6: sys_cond_signal
s32 sys_cond_signal(u32 cond_id)
{
sys_cond.Log("sys_cond_signal(cond_id=%d)", cond_id);
LV2_LOCK;
std::shared_ptr<cond_t> cond;
if (!Emu.GetIdManager().GetIDData(cond_id, cond))
{
return CELL_ESRCH;
}
if (cond->waiters)
{
cond->signaled++;
cond->waiters--;
cond->cv.notify_one();
}
return CELL_OK;
}
示例7: sys_cond_destroy
s32 sys_cond_destroy(u32 cond_id)
{
sys_cond.Warning("sys_cond_destroy(cond_id=%d)", cond_id);
LV2_LOCK(0);
Cond* cond;
if (!Emu.GetIdManager().GetIDData(cond_id, cond))
{
return CELL_ESRCH;
}
if (!cond->m_queue.finalize())
{
return CELL_EBUSY;
}
cond->mutex->cond_count--;
Emu.GetIdManager().RemoveID(cond_id);
Emu.GetSyncPrimManager().EraseSyncPrimData(TYPE_COND, cond_id);
return CELL_OK;
}
示例8: sys_raw_spu_set_int_mask
s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
{
sys_spu.Log("sys_raw_spu_set_int_mask(id=%d, class_id=%d, mask=0x%llx)", id, class_id, mask);
if (class_id != 0 && class_id != 2)
{
return CELL_EINVAL;
}
const auto thread = Emu.GetCPU().GetRawSPUThread(id);
if (!thread)
{
return CELL_ESRCH;
}
auto& tag = class_id ? thread->int2 : thread->int0;
tag.mask.exchange(mask);
return CELL_OK;
}
示例9: sys_event_port_destroy
s32 sys_event_port_destroy(u32 eport_id)
{
sys_event.warning("sys_event_port_destroy(eport_id=0x%x)", eport_id);
LV2_LOCK;
const auto port = idm::get<lv2_event_port_t>(eport_id);
if (!port)
{
return CELL_ESRCH;
}
if (!port->queue.expired())
{
return CELL_EISCONN;
}
idm::remove<lv2_event_port_t>(eport_id);
return CELL_OK;
}
示例10: _sys_lwmutex_trylock
s32 _sys_lwmutex_trylock(u32 lwmutex_id)
{
sys_lwmutex.Log("_sys_lwmutex_trylock(lwmutex_id=0x%x)", lwmutex_id);
LV2_LOCK;
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
if (!mutex)
{
return CELL_ESRCH;
}
if (!mutex->sq.empty() || !mutex->signaled)
{
return CELL_EBUSY;
}
mutex->signaled--;
return CELL_OK;
}
示例11: sys_rwlock_destroy
s32 sys_rwlock_destroy(u32 rw_lock_id)
{
sys_rwlock.Warning("sys_rwlock_destroy(rw_lock_id=0x%x)", rw_lock_id);
LV2_LOCK;
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
if (!rwlock)
{
return CELL_ESRCH;
}
if (rwlock->readers || rwlock->writer || rwlock->rsq.size() || rwlock->wsq.size())
{
return CELL_EBUSY;
}
idm::remove<lv2_rwlock_t>(rw_lock_id);
return CELL_OK;
}
示例12: sys_event_flag_destroy
s32 sys_event_flag_destroy(u32 id)
{
sys_event_flag.Warning("sys_event_flag_destroy(id=0x%x)", id);
LV2_LOCK;
const auto eflag = idm::get<lv2_event_flag_t>(id);
if (!eflag)
{
return CELL_ESRCH;
}
if (!eflag->sq.empty())
{
return CELL_EBUSY;
}
idm::remove<lv2_event_flag_t>(id);
return CELL_OK;
}
示例13: sys_cond_signal
s32 sys_cond_signal(u32 cond_id)
{
sys_cond.Log("sys_cond_signal(cond_id=0x%x)", cond_id);
LV2_LOCK;
const auto cond = Emu.GetIdManager().get<lv2_cond_t>(cond_id);
if (!cond)
{
return CELL_ESRCH;
}
// signal one waiting thread; protocol is ignored in current implementation
if (!cond->sq.empty())
{
cond->notify(lv2_lock, cond->sq.begin());
cond->sq.pop_front();
}
return CELL_OK;
}
示例14: sys_timer_usleep
s32 sys_timer_usleep(u64 sleep_time)
{
sys_timer.trace("sys_timer_usleep(sleep_time=0x%llx)", sleep_time);
const u64 start_time = get_system_time();
u64 passed;
while (sleep_time > (passed = get_system_time() - start_time) + 1000)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
if (sleep_time > passed)
{
std::this_thread::sleep_for(std::chrono::microseconds(sleep_time - passed));
}
return CELL_OK;
}
示例15: sys_timer_destroy
s32 sys_timer_destroy(u32 timer_id)
{
sys_timer.warning("sys_timer_destroy(timer_id=0x%x)", timer_id);
LV2_LOCK;
const auto timer = idm::get<lv2_timer_t>(timer_id);
if (!timer)
{
return CELL_ESRCH;
}
if (!timer->port.expired())
{
return CELL_EISCONN;
}
idm::remove<lv2_timer_t>(timer_id);
return CELL_OK;
}