当前位置: 首页>>代码示例>>C++>>正文


C++ SysCallBase::CheckId方法代码示例

本文整理汇总了C++中SysCallBase::CheckId方法的典型用法代码示例。如果您正苦于以下问题:C++ SysCallBase::CheckId方法的具体用法?C++ SysCallBase::CheckId怎么用?C++ SysCallBase::CheckId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SysCallBase的用法示例。


在下文中一共展示了SysCallBase::CheckId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sys_lwcond_signal_all

int sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
{
	sys_lwcond.Log("sys_lwcond_signal_all(lwcond_addr=0x%x)", lwcond.GetAddr());

	if (!lwcond.IsGood()) return CELL_EFAULT;
	LWCond* lwc;
	u32 id = (u32)lwcond->lwcond_queue;
	if (!sys_lwcond.CheckId(id, lwc)) return CELL_ESRCH;

	lwc->signal_all();

	return CELL_OK;
}
开发者ID:Komsomilka,项目名称:rpcs3,代码行数:13,代码来源:SC_Lwcond.cpp

示例2: sys_lwcond_signal_to

int sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id)
{
	sys_lwcond.Log("sys_lwcond_signal_to(lwcond_addr=0x%x, ppu_thread_id=%d)", lwcond.GetAddr(), ppu_thread_id);

	if (!lwcond.IsGood()) return CELL_EFAULT;
	LWCond* lwc;
	u32 id = (u32)lwcond->lwcond_queue;
	if (!sys_lwcond.CheckId(id, lwc)) return CELL_ESRCH;

	if (!lwc->signal_to(ppu_thread_id)) return CELL_EPERM;

	return CELL_OK;
}
开发者ID:Komsomilka,项目名称:rpcs3,代码行数:13,代码来源:SC_Lwcond.cpp

示例3: sys_event_flag_clear

s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn)
{
	sys_event_flag.Log("sys_event_flag_clear(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);

	EventFlag* ef;
	if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;

	const u32 tid = GetCurrentPPUThread().GetId();
	ef->m_mutex.lock(tid);
	ef->flags &= bitptn;
	ef->m_mutex.unlock(tid);
	return CELL_OK;
}
开发者ID:Darkclaw16,项目名称:rpcs3,代码行数:13,代码来源:sys_event_flag.cpp

示例4: sys_event_flag_trywait

s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<u64> result)
{
	sys_event_flag.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
		eflag_id, bitptn, mode, result.addr());

	if (result) *result = 0;

	switch (mode & 0xf)
	{
	case SYS_EVENT_FLAG_WAIT_AND: break;
	case SYS_EVENT_FLAG_WAIT_OR: break;
	default: return CELL_EINVAL;
	}

	switch (mode & ~0xf)
	{
	case 0: break; // ???
	case SYS_EVENT_FLAG_WAIT_CLEAR: break;
	case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
	default: return CELL_EINVAL;
	}

	EventFlag* ef;
	if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;

	const u32 tid = GetCurrentPPUThread().GetId();
	ef->m_mutex.lock(tid);

	u64 flags = ef->flags;

	if (((mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & bitptn) == bitptn) ||
		((mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & bitptn)))
	{
		if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
		{
			ef->flags &= ~bitptn;
		}
		else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
		{
			ef->flags = 0;
		}

		if (result) *result = flags;

		ef->m_mutex.unlock(tid);
		return CELL_OK;
	}

	ef->m_mutex.unlock(tid);
	return CELL_EBUSY;
}
开发者ID:Darkclaw16,项目名称:rpcs3,代码行数:51,代码来源:sys_event_flag.cpp

示例5: sys_mmapper_free_memory

s32 sys_mmapper_free_memory(u32 mem_id)
{
	sys_mmapper.Warning("sys_mmapper_free_memory(mem_id=0x%x)", mem_id);

	// Check if this mem ID is valid.
	mmapper_info* info;
	if(!sys_mmapper.CheckId(mem_id, info))
		return CELL_ESRCH;

	// Release the allocated memory and remove the ID.
	sys_mmapper.RemoveId(mem_id);

	return CELL_OK;
}
开发者ID:Darkclaw16,项目名称:rpcs3,代码行数:14,代码来源:sys_mmapper.cpp

示例6: sys_mmapper_map_memory

int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags)
{
	sc_mem.Warning("sys_mmapper_map_memory(start_addr=0x%x, mem_id=0x%x, flags=0x%llx)", start_addr, mem_id, flags);

	mmapper_info* info;
	if(!sc_mem.CheckId(mem_id, info)) return CELL_ESRCH;

	if(!Memory.Map(start_addr, info->addr, info->size))
	{
		sc_mem.Error("sys_mmapper_map_memory failed!");
	}

	return CELL_OK;
}
开发者ID:Kokainshik,项目名称:rpcs3,代码行数:14,代码来源:SC_Memory.cpp

示例7: sys_rwlock_trywlock

s32 sys_rwlock_trywlock(u32 rw_lock_id)
{
	sys_rwlock.Log("sys_rwlock_trywlock(rw_lock_id=%d)", rw_lock_id);

	RWLock* rw;
	if (!sys_rwlock.CheckId(rw_lock_id, rw)) return CELL_ESRCH;
	const u32 tid = GetCurrentPPUThread().GetId();

	if (!rw->wlock_check(tid)) return CELL_EDEADLK;

	if (!rw->wlock_trylock(tid, false)) return CELL_EBUSY;

	return CELL_OK;
}
开发者ID:Subv,项目名称:rpcs3,代码行数:14,代码来源:sys_rwlock.cpp

示例8: sys_lwcond_wait

int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
{
	sys_lwcond.Log("sys_lwcond_wait(lwcond_addr=0x%x, timeout=%lld)", lwcond.GetAddr(), timeout);

	if (!lwcond.IsGood()) return CELL_EFAULT;
	LWCond* lwc;
	u32 id = (u32)lwcond->lwcond_queue;
	if (!sys_lwcond.CheckId(id, lwc)) return CELL_ESRCH;
	const u32 tid = GetCurrentPPUThread().GetId();

	mem_ptr_t<sys_lwmutex_t> lwmutex(lwcond->lwmutex);

	if ((u32)lwmutex->owner.GetOwner() != tid) return CELL_EPERM; // caller must own this lwmutex
	lwc->begin_waiting(tid);

	u32 counter = 0;
	const u32 max_counter = timeout ? (timeout / 1000) : 20000;
	bool was_locked = true;
	do
	{
		if (Emu.IsStopped())
		{
			ConLog.Warning("sys_lwcond_wait(sq id=%d, ...) aborted", id);
			return CELL_ETIMEDOUT;
		}
		if (was_locked) lwmutex->unlock(tid);
		Sleep(1);
		if (was_locked = (lwmutex->trylock(tid) == CELL_OK))
		{
			if (lwc->check(tid))
			{
				return CELL_OK;
			}
		}

		if (counter++ > max_counter)
		{
			if (!timeout) 
			{
				sys_lwcond.Warning("sys_lwcond_wait(lwcond_addr=0x%x): TIMEOUT", lwcond.GetAddr());
				counter = 0;
			}
			else
			{
				lwc->stop_waiting(tid);
				return CELL_ETIMEDOUT;
			}
		}		
	} while (true);
}
开发者ID:Komsomilka,项目名称:rpcs3,代码行数:50,代码来源:SC_Lwcond.cpp

示例9: sys_rwlock_destroy

s32 sys_rwlock_destroy(u32 rw_lock_id)
{
	sys_rwlock.Warning("sys_rwlock_destroy(rw_lock_id=%d)", rw_lock_id);

	RWLock* rw;
	if (!sys_rwlock.CheckId(rw_lock_id, rw)) return CELL_ESRCH;

	std::lock_guard<std::mutex> lock(rw->m_lock);

	if (rw->wlock_queue.size() || rw->rlock_list.size() || rw->wlock_thread) return CELL_EBUSY;

	Emu.GetIdManager().RemoveID(rw_lock_id);

	return CELL_OK;
}
开发者ID:Subv,项目名称:rpcs3,代码行数:15,代码来源:sys_rwlock.cpp

示例10: sys_memory_container_destroy

int sys_memory_container_destroy(u32 cid)
{
	sc_mem.Warning("sys_memory_container_destroy(cid=%d)", cid);

	// Check if this container ID is valid.
	MemoryContainerInfo* ct;
	if(!sc_mem.CheckId(cid, ct))
		return CELL_ESRCH;

	// Release the allocated memory and remove the ID.
	Memory.Free(ct->addr);
	Emu.GetIdManager().RemoveID(cid);

	return CELL_OK;
}
开发者ID:trismegistvs,项目名称:rpcs3,代码行数:15,代码来源:SC_Memory.cpp

示例11: sys_memory_container_destroy

int sys_memory_container_destroy(u32 cid)
{
	sc_mem.Warning("sys_memory_container_destroy(cid=0x%x)", cid);

	MemoryContainerInfo* ct;

	if(!sc_mem.CheckId(cid, ct))
	{
		return CELL_ESRCH;
	}

	Memory.Free(ct->addr);
	Emu.GetIdManager().RemoveID(cid);
	return CELL_OK;
}
开发者ID:Kokainshik,项目名称:rpcs3,代码行数:15,代码来源:SC_Memory.cpp

示例12: sys_mmapper_free_memory

s32 sys_mmapper_free_memory(u32 mem_id)
{
	sys_mmapper.Warning("sys_mmapper_free_memory(mem_id=0x%x)", mem_id);

	// Check if this mem ID is valid.
	mmapper_info* info;
	if(!sys_mmapper.CheckId(mem_id, info))
		return CELL_ESRCH;

	// Release the allocated memory and remove the ID.
	Memory.Free(info->addr);
	Emu.GetIdManager().RemoveID(mem_id);

	return CELL_OK;
}
开发者ID:Claudio1234a,项目名称:rpcs3,代码行数:15,代码来源:sys_mmapper.cpp

示例13: sys_semaphore_post

int sys_semaphore_post(u32 sem, int count)
{
	sys_sem.Log("sys_semaphore_post(sem=%d, count=%d)", sem, count);

	semaphore* sem_data = nullptr;
	if(!sys_sem.CheckId(sem, sem_data)) return CELL_ESRCH;

	while(count--)
	{
		sem_data->sem_count++;  // Increment internal counter for sys_semaphore_get_value.
		sem_data->sem.Post();
	}

	return CELL_OK;
}
开发者ID:0179cool,项目名称:rpcs3,代码行数:15,代码来源:SC_Semaphore.cpp

示例14: sys_event_flag_destroy

s32 sys_event_flag_destroy(u32 eflag_id)
{
	sys_event_flag.Warning("sys_event_flag_destroy(eflag_id=%d)", eflag_id);

	EventFlag* ef;
	if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;

	if (ef->waiters.size()) // ???
	{
		return CELL_EBUSY;
	}

	Emu.GetIdManager().RemoveID(eflag_id);

	return CELL_OK;
}
开发者ID:Darkclaw16,项目名称:rpcs3,代码行数:16,代码来源:sys_event_flag.cpp

示例15: sys_event_flag_get

int sys_event_flag_get(u32 eflag_id, mem64_t flags)
{
	sys_event_flag.Warning("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.GetAddr());
	
	EventFlag* ef;
	if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;

	if (!flags.IsGood())
	{
		return CELL_EFAULT;
	}

	flags = ef->flags; // ???

	return CELL_OK;
}
开发者ID:AMMAREN,项目名称:rpcs3,代码行数:16,代码来源:SC_Event_flag.cpp


注:本文中的SysCallBase::CheckId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。