mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-29 20:04:49 +01:00
* Replace `int` with `s32` as return type for syscalls. * Renamed `SC_Something.*` files with the proper lv2 name `sys_something.*`. * Moving away from the lv2, those functions and folders that doesn't correspond to lv2 functions. E.g. module functions from sys_io, sysPrxForUser, cellGcmSys. * Splitted some files (memory -> memory+mmapper) and merged other ones (event+event_flag ->event, spu+spu_thread -> spu), according to common sense, PSDevWiki docs, and checking firmware files. * Removed external functions from `SysCalls.h`. NOTE: What should we do about: cellGcmCallback? It's not a lv2 syscall but it appears on the sc_table and it is actually called in games. Is this some kind of hack?
45 lines
920 B
C++
45 lines
920 B
C++
#pragma once
|
|
|
|
struct sys_semaphore_attribute
|
|
{
|
|
be_t<u32> protocol;
|
|
be_t<u32> pshared; // undefined
|
|
be_t<u64> ipc_key; // undefined
|
|
be_t<int> flags; // undefined
|
|
be_t<u32> pad; // not used
|
|
union
|
|
{
|
|
char name[8];
|
|
u64 name_u64;
|
|
};
|
|
};
|
|
|
|
struct Semaphore
|
|
{
|
|
std::mutex m_mutex;
|
|
SleepQueue m_queue;
|
|
int m_value;
|
|
u32 signal;
|
|
|
|
const int max;
|
|
const u32 protocol;
|
|
const u64 name;
|
|
|
|
Semaphore(int initial_count, int max_count, u32 protocol, u64 name)
|
|
: m_value(initial_count)
|
|
, signal(0)
|
|
, max(max_count)
|
|
, protocol(protocol)
|
|
, name(name)
|
|
{
|
|
}
|
|
};
|
|
|
|
// SysCalls
|
|
s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count);
|
|
s32 sys_semaphore_destroy(u32 sem_id);
|
|
s32 sys_semaphore_wait(u32 sem_id, u64 timeout);
|
|
s32 sys_semaphore_trywait(u32 sem_id);
|
|
s32 sys_semaphore_post(u32 sem_id, int count);
|
|
s32 sys_semaphore_get_value(u32 sem_id, mem32_t count);
|