vitasdk
Documentation of the vitasdk

Detailed Description

Exports for Kernel.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub




Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceThreadmgrForDriver_stub



Functions

int ksceKernelCreateCallback (const char *name, unsigned int attr, SceKernelCallbackFunction func, void *arg)
 Create callback. More...
 
int ksceKernelDeleteCallback (SceUID cb)
 Delete a callback. More...
 
int ksceKernelNotifyCallback (SceUID cb, int arg2)
 Notify a callback. More...
 
int ksceKernelCancelCallback (SceUID cb)
 Cancel a callback ? More...
 
int ksceKernelGetCallbackCount (SceUID cb)
 Get the callback count. More...
 
int ksceKernelCheckCallback (void)
 Check callback ? More...
 
SceUID ksceKernelCreateCond (const char *name, SceUInt attr, SceUID mutexId, const SceKernelCondOptParam *option)
 Creates a new condition variable. More...
 
int ksceKernelDeleteCond (SceUID condId)
 Destroy a condition variable. More...
 
int ksceKernelWaitCond (SceUID condId, unsigned int *timeout)
 Waits for a signal of a condition variable. More...
 
int ksceKernelSignalCond (SceUID condId)
 Signals a condition variable. More...
 
int ksceKernelSignalCondAll (SceUID condId)
 Signals a condition variable to all threads waiting for it. More...
 
int ksceKernelSignalCondTo (SceUID condId, SceUID threadId)
 Signals a condition variable to a specific thread waiting for it. More...
 
 VITASDK_BUILD_ASSERT_EQ (0x48, SceArmCpuRegisters)
 
 VITASDK_BUILD_ASSERT_EQ (0x90, SceThreadCpuRegisters)
 
 VITASDK_BUILD_ASSERT_EQ (8, SceKernelThreadContextInfo)
 
int ksceKernelGetThreadIdList (SceUID pid, SceUID *ids, int n, int *copy_count)
 Retrieve a list of all threads belonging to a process. More...
 
int ksceKernelGetThreadCpuRegisters (SceUID thid, SceThreadCpuRegisters *registers)
 Query the state of the registers for a suspended thread. More...
 
int ksceKernelGetThreadContextInfo (SceKernelThreadContextInfo *pInfo)
 Obtain the context information for the thread scheduled on this CPU. More...
 
int ksceKernelChangeThreadSuspendStatus (SceUID thid, int status)
 Change the thread suspension status to another value. More...
 
SceUID ksceKernelGetUserThreadId (SceUID thid)
 Get thread PUID from GUID. More...
 
int ksceKernelIsThreadDebugSuspended (SceUID thid)
 Get thread suspend status. More...
 
int ksceKernelDebugSuspendThread (SceUID thid, int status)
 Debug suspend a thread. More...
 
int ksceKernelDebugResumeThread (SceUID thid, int status)
 Debug resume a thread. More...
 
int ksceKernelGetThreadInfoForDebugger (SceUID thid, int a2, void *pInfo)
 
int ksceKernelGetVfpRegisterForDebugger (SceUID thid, void *pVfpRegister)
 
struct SceKernelFaultingProcessInfo SCE_DEPRECATED_EX (SceKernelFaultingProcessInfo, "This structure has been replaced by SceKernelThreadContextInfo")
 
int ksceKernelGetEventFlagInfo (SceUID evfid, SceKernelEventFlagInfo *info)
 Get event flags info. More...
 
SceUID ksceKernelCreateEventFlag (const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt)
 Create an event flag. More...
 
int ksceKernelSetEventFlag (SceUID evfid, unsigned int bits)
 Set an event flag bit pattern. More...
 
int ksceKernelClearEventFlag (SceUID evfid, unsigned int bits)
 Clear a event flag bit pattern. More...
 
int ksceKernelPollEventFlag (SceUID evfid, unsigned int bits, unsigned int wait, unsigned int *outBits)
 Poll an event flag for a given bit pattern. More...
 
int ksceKernelWaitEventFlag (SceUID evfid, unsigned int bits, unsigned int wait, unsigned int *outBits, SceUInt *timeout)
 Wait for an event flag for a given bit pattern. More...
 
int ksceKernelWaitEventFlagCB (SceUID evfid, unsigned int bits, unsigned int wait, unsigned int *outBits, SceUInt *timeout)
 Wait for an event flag for a given bit pattern with callback. More...
 
int ksceKernelDeleteEventFlag (SceUID evfid)
 Delete an event flag. More...
 
 VITASDK_BUILD_ASSERT_EQ (0x40, SceKernelFastMutex)
 
int ksceKernelInitializeFastMutex (SceKernelFastMutex *fast_mutex, const char *name, int attr, void *opt)
 
int ksceKernelFinalizeFastMutex (SceKernelFastMutex *fast_mutex)
 
int ksceKernelLockFastMutex (SceKernelFastMutex *fast_mutex)
 
int ksceKernelTryLockFastMutex (SceKernelFastMutex *fast_mutex)
 
int ksceKernelUnlockFastMutex (SceKernelFastMutex *fast_mutex)
 
int ksceKernelGetFastMutexInfo (SceKernelFastMutex *fast_mutex, void *info)
 
 VITASDK_BUILD_ASSERT_EQ (0x38, SceKernelLwCondInfo)
 
int ksceKernelGetLwCondInfo (SceUID lwcond_id, SceKernelLwCondInfo *info)
 
 VITASDK_BUILD_ASSERT_EQ (0x40, SceKernelLwMutexInfo)
 
int ksceKernelGetLwMutexInfo (SceUID lwmtxid, SceKernelLwMutexInfo *info)
 
SceKernelIdListType ksceKernelGetThreadmgrUIDClass (SceUID uid)
 Get the type of a Threadmgr uid. More...
 
SceUInt32 ksceKernelGetSystemTimeLow (void)
 Get the system time. More...
 
SceInt64 ksceKernelGetSystemTimeWide (void)
 Get the system time (wide version) More...
 
void * ksceKernelGetThreadTLSAddr (SceUID thid, int key)
 ksceKernelGetThreadTLSAddr gets an address to a 4 bytes area of TLS memory for the specified thread More...
 
void * ksceKernelGetTLSAddr (int key)
 ksceKernelGetTLSAddr get pointer to TLS key area for current thread More...
 
int ksceKernelSetPermission (int value)
 Set Permission. More...
 
SceUID ksceKernelGetProcessId (void)
 Gets the current process PID. More...
 
SceUID ksceKernelGetProcessIdFromTLS (void)
 Get Process id from Thread Local Storage. More...
 
SceUID ksceKernelSetProcessIdToTLS (SceUID pid)
 Set Process id to Thread Local Storage. More...
 
int ksceKernelRunWithStack (SceSize stack_size, int(*to_call)(void *), void *args)
 Runs a function with larger stack size. More...
 
 VITASDK_BUILD_ASSERT_EQ (0x3C, SceKernelMsgPipeInfo)
 
int ksceKernelGetMsgPipeInfo (SceUID msgpipe_id, SceKernelMsgPipeInfo *info)
 Get msgpipe info. More...
 
SceUID ksceKernelCreateMsgPipe (const char *name, int type, int attr, SceSize bufSize, void *opt)
 Create a message pipe. More...
 
int ksceKernelDeleteMsgPipe (SceUID uid)
 Delete a message pipe. More...
 
int ksceKernelSendMsgPipeVector (SceUID uid, const MsgPipeSendData *v, unsigned int n, int unk1, void *unk2, unsigned int *timeout)
 Send a message to a pipe. More...
 
int ksceKernelTrySendMsgPipeVector (SceUID uid, const MsgPipeSendData *v, SceSize size, int unk1, void *unk2)
 Try to send a message to a pipe. More...
 
int ksceKernelReceiveMsgPipeVector (SceUID uid, const MsgPipeRecvData *v, unsigned int n, int unk1, void *unk2, unsigned int *timeout)
 Receive a message from a pipe. More...
 
int ksceKernelTryReceiveMsgPipeVector (SceUID uid, const MsgPipeRecvData *v, SceSize size, int unk1, void *unk2)
 Receive a message from a pipe. More...
 
int ksceKernelCancelMsgPipe (SceUID uid, int *psend, int *precv)
 Cancel a message pipe. More...
 
SceUID ksceKernelCreateMutex (const char *name, SceUInt attr, int initCount, SceKernelMutexOptParam *option)
 Creates a new mutex. More...
 
int ksceKernelDeleteMutex (SceUID mutexid)
 Destroy a mutex. More...
 
int ksceKernelLockMutex (SceUID mutexid, int lockCount, unsigned int *timeout)
 Lock a mutex. More...
 
int ksceKernelTryLockMutex (SceUID mutexid, int lockCount)
 Try to lock a mutex (non-blocking) More...
 
int ksceKernelUnlockMutex (SceUID mutexid, int unlockCount)
 Try to unlock a mutex (non-blocking) More...
 
int ksceKernelCancelMutex (SceUID mutexid, int newCount, int *numWaitThreads)
 Cancels a mutex. More...
 
int ksceKernelGetMutexInfo (SceUID mutexid, SceKernelMutexInfo *info)
 Retrieve information about a mutex. More...
 
int ksceKernelGetSemaInfo (SceUID semaid, SceKernelSemaInfo *info)
 Get semaphore info. More...
 
SceUID ksceKernelCreateSema (const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option)
 Creates a new semaphore. More...
 
int ksceKernelDeleteSema (SceUID semaid)
 Destroy a semaphore. More...
 
int ksceKernelSignalSema (SceUID semaid, int signal)
 Send a signal to a semaphore. More...
 
int ksceKernelWaitSema (SceUID semaid, int signal, SceUInt *timeout)
 Lock a semaphore. More...
 
int ksceKernelPollSema (SceUID semaid, int signal)
 Poll a semaphore. More...
 
SceUID ksceKernelCreateThread (const char *name, SceKernelThreadEntry entry, int initPriority, SceSize stackSize, SceUInt attr, int cpuAffinityMask, const SceKernelThreadOptParam *option)
 Create a thread. More...
 
int ksceKernelDeleteThread (SceUID thid)
 Delate a thread. More...
 
int ksceKernelStartThread (SceUID thid, SceSize arglen, void *argp)
 Start a created thread. More...
 
int ksceKernelExitThread (int status)
 Exit a thread. More...
 
int ksceKernelExitDeleteThread (int status)
 Exit a thread and delete itself. More...
 
int ksceKernelWaitThreadEnd (SceUID thid, int *stat, SceUInt *timeout)
 Wait until a thread has ended. More...
 
int ksceKernelWaitThreadEndCB (SceUID thid, int *stat, SceUInt *timeout)
 Wait until a thread has ended and handle callbacks if necessary. More...
 
int ksceKernelDelayThread (SceUInt delay)
 Delay the current thread by a specified number of microseconds. More...
 
int ksceKernelDelayThreadCB (SceUInt delay)
 Delay the current thread by a specified number of microseconds and handle any callbacks. More...
 
int ksceKernelChangeThreadPriority (SceUID thid, int priority)
 Change the threads current priority. More...
 
int ksceKernelGetThreadId (void)
 Get the current thread Id. More...
 
int ksceKernelGetThreadCurrentPriority (void)
 Get the current priority of the thread you are in. More...
 
int ksceKernelGetThreadStackFreeSize (SceUID thid)
 Get the free stack size for a thread. More...
 
int ksceKernelGetThreadInfo (SceUID thid, SceKernelThreadInfo *info)
 Get the thread info by thread id. More...
 
int ksceKernelEnqueueWorkQueue (SceUID uid, const char *name, SceKernelWorkQueueWorkFunction work, void *args)
 Enqueue work to a workqueue. More...
 

Typedefs

typedef SceArmCpuRegisters ArmCpuRegisters
 
typedef SceThreadCpuRegisters ThreadCpuRegisters
 
typedef int(* SceKernelWorkQueueWorkFunction) (void *args)
 

Macros

#define ksceKernelGetFaultingProcessInfo(info)   ksceKernelGetThreadContextInfo((SceKernelThreadContextInfo*)info)
 
#define ksceKernelDeleteFastMutex(__fast_mutex__)   ksceKernelFinalizeFastMutex((__fast_mutex__))
 

Data Structure Documentation

◆ SceArmCpuRegisters

struct SceArmCpuRegisters

Structure representing all ARM registers.

Data Fields
uint32_t r0
uint32_t r1
uint32_t r2
uint32_t r3
uint32_t r4
uint32_t r5
uint32_t r6
uint32_t r7
uint32_t r8
uint32_t r9
uint32_t r10
uint32_t r11
uint32_t r12
uint32_t sp
uint32_t lr
uint32_t pc
uint32_t cpsr
uint32_t fpscr

◆ SceThreadCpuRegisters

struct SceThreadCpuRegisters

Structure containing a threads register states.

Data Fields
union SceThreadCpuRegisters SCE_DEPRECATED_EX

◆ SceKernelThreadContextInfo

struct SceKernelThreadContextInfo
Data Fields
ScePID process_id
SceUID thread_id

◆ SceKernelFaultingProcessInfo

struct SceKernelFaultingProcessInfo
Data Fields
SceUID pid
SceUID faultingThreadId

◆ SceKernelFastMutex

struct SceKernelFastMutex
Data Fields
SceUInt8 data[0x40]

◆ SceKernelLwCondInfo

struct SceKernelLwCondInfo
Data Fields
SceSize size
SceUID lwcond_id
char name[0x20]
int attr
SceKernelLwCondWork * work
SceKernelLwMutexWork * lwmutex
int num_wait_threads

◆ SceKernelLwMutexInfo

struct SceKernelLwMutexInfo
Data Fields
SceSize size
SceUID mtxid
char name[0x20]
int attr
SceKernelLwMutexWork * work
int init_count
int current_count
SceUID current_owner_id
SceUInt32 num_wait_threads

◆ SceKernelMsgPipeInfo

struct SceKernelMsgPipeInfo
Data Fields
SceSize size
SceUID msgpipe_id
char name[0x20]
int attr
SceSize buffer_size
SceSize free_size
int num_send_wait_threads
int num_receive_wait_threads

◆ MsgPipeSendData

struct MsgPipeSendData
Data Fields
const void * message
SceSize size

◆ MsgPipeRecvData

struct MsgPipeRecvData
Data Fields
void * message
SceSize size

◆ SceThreadCpuRegisters.SCE_DEPRECATED_EX

union SceThreadCpuRegisters.SCE_DEPRECATED_EX
Data Fields
SCE_DEPRECATED_EX __unnamed__
SceArmCpuRegisters entry[2]

◆ SceThreadCpuRegisters.SCE_DEPRECATED_EX.__unnamed46__

struct SceThreadCpuRegisters.SCE_DEPRECATED_EX.__unnamed46__
Data Fields
SceArmCpuRegisters user Set of registers used for user mode.
SceArmCpuRegisters kernel Set of registers used for kernel mode.

Macro Definition Documentation

◆ ksceKernelGetFaultingProcessInfo

#define ksceKernelGetFaultingProcessInfo (   info)    ksceKernelGetThreadContextInfo((SceKernelThreadContextInfo*)info)

◆ ksceKernelDeleteFastMutex

#define ksceKernelDeleteFastMutex (   __fast_mutex__)    ksceKernelFinalizeFastMutex((__fast_mutex__))

Typedef Documentation

◆ ArmCpuRegisters

◆ ThreadCpuRegisters

◆ SceKernelWorkQueueWorkFunction

typedef int(* SceKernelWorkQueueWorkFunction) (void *args)

Function Documentation

◆ ksceKernelCreateCallback()

int ksceKernelCreateCallback ( const char *  name,
unsigned int  attr,
SceKernelCallbackFunction  func,
void *  arg 
)

Create callback.

Example:
int cbid;
cbid = ksceKernelCreateCallback("Exit Callback", 0, exit_cb, NULL);
int ksceKernelCreateCallback(const char *name, unsigned int attr, SceKernelCallbackFunction func, void *arg)
Create callback.
Parameters
name- A textual name for the callback
func- A pointer to a function that will be called as the callback
arg- Argument for the callback ?
Returns
>= 0 A callback id which can be used in subsequent functions, < 0 an error.

◆ ksceKernelDeleteCallback()

int ksceKernelDeleteCallback ( SceUID  cb)

Delete a callback.

Parameters
cb- The UID of the specified callback
Returns
0 on success, < 0 on error

◆ ksceKernelNotifyCallback()

int ksceKernelNotifyCallback ( SceUID  cb,
int  arg2 
)

Notify a callback.

Parameters
cb- The UID of the specified callback
arg2- Passed as arg2 into the callback function
Returns
0 on success, < 0 on error

◆ ksceKernelCancelCallback()

int ksceKernelCancelCallback ( SceUID  cb)

Cancel a callback ?

Parameters
cb- The UID of the specified callback
Returns
0 on success, < 0 on error

◆ ksceKernelGetCallbackCount()

int ksceKernelGetCallbackCount ( SceUID  cb)

Get the callback count.

Parameters
cb- The UID of the specified callback
Returns
The callback count, < 0 on error

◆ ksceKernelCheckCallback()

int ksceKernelCheckCallback ( void  )

Check callback ?

Returns
Something or another

◆ ksceKernelCreateCond()

SceUID ksceKernelCreateCond ( const char *  name,
SceUInt  attr,
SceUID  mutexId,
const SceKernelCondOptParam option 
)

Creates a new condition variable.

Example:
SceUID condId;
condId = ksceKernelCreateCond("MyCond", 0, mutexId, NULL);
SceUID ksceKernelCreateCond(const char *name, SceUInt attr, SceUID mutexId, const SceKernelCondOptParam *option)
Creates a new condition variable.
int SceUID
UIDs are used to describe many different kernel objects.
Definition: types.h:90
Parameters
name- Specifies the name of the condition variable
attr- Condition variable attribute flags (normally set to 0)
mutexId- Mutex to be related to the condition variable
option- Condition variable options (normally set to 0)
Returns
A condition variable id

◆ ksceKernelDeleteCond()

int ksceKernelDeleteCond ( SceUID  condId)

Destroy a condition variable.

Parameters
conditionvariableid - The condition variable id returned from ksceKernelCreateCond
Returns
Returns the value 0 if it's successful, otherwise -1

◆ ksceKernelWaitCond()

int ksceKernelWaitCond ( SceUID  condId,
unsigned int *  timeout 
)

Waits for a signal of a condition variable.

Parameters
condId- The condition variable id returned from ksceKernelCreateCond
timeout- Timeout in microseconds (assumed)
Returns
< 0 On error.

◆ ksceKernelSignalCond()

int ksceKernelSignalCond ( SceUID  condId)

Signals a condition variable.

Parameters
condId- The condition variable id returned from ksceKernelCreateCond
Returns
< 0 On error.

◆ ksceKernelSignalCondAll()

int ksceKernelSignalCondAll ( SceUID  condId)

Signals a condition variable to all threads waiting for it.

Parameters
condId- The condition variable id returned from ksceKernelCreateCond
Returns
< 0 On error.

◆ ksceKernelSignalCondTo()

int ksceKernelSignalCondTo ( SceUID  condId,
SceUID  threadId 
)

Signals a condition variable to a specific thread waiting for it.

Parameters
condId- The condition variable id returned from ksceKernelCreateCond
threadId- The thread id returned from ksceKernelCreateThread
Returns
< 0 On error.

◆ VITASDK_BUILD_ASSERT_EQ() [1/7]

VITASDK_BUILD_ASSERT_EQ ( 0x48  ,
SceArmCpuRegisters   
)

◆ VITASDK_BUILD_ASSERT_EQ() [2/7]

VITASDK_BUILD_ASSERT_EQ ( 0x90  ,
SceThreadCpuRegisters   
)

◆ VITASDK_BUILD_ASSERT_EQ() [3/7]

VITASDK_BUILD_ASSERT_EQ ( ,
SceKernelThreadContextInfo   
)

◆ ksceKernelGetThreadIdList()

int ksceKernelGetThreadIdList ( SceUID  pid,
SceUID ids,
int  n,
int *  copy_count 
)

Retrieve a list of all threads belonging to a process.

Parameters
[in]pidThe process to query.
[out]idsThe list of thread ids. Can be NULL if output is not required.
[in]nThe max number of thread ids to copy out.
[out]copy_countThe number of thread ids copied.
Returns
The number of threads within the process, else < 0 on error.

◆ ksceKernelGetThreadCpuRegisters()

int ksceKernelGetThreadCpuRegisters ( SceUID  thid,
SceThreadCpuRegisters registers 
)

Query the state of the registers for a suspended thread.

The registers returned are the user/kernel set for the requested thread. It's not certain that user/kernel is correct representation, instead it could be current/exception. The thread provided must be suspended for this function to succeed.

Parameters
[in]thidThe thread to query.
[out]registersThe set of registers belonging to the thread.
Returns
Zero on success, else < 0 on error.

◆ ksceKernelGetThreadContextInfo()

int ksceKernelGetThreadContextInfo ( SceKernelThreadContextInfo pInfo)

Obtain the context information for the thread scheduled on this CPU.

This function can be called from an exception handler to obtain information about the thread that was interrupted.

Parameters
[out]pInfoContext information of the thread
Returns
Zero on success, < 0 on error

◆ ksceKernelChangeThreadSuspendStatus()

int ksceKernelChangeThreadSuspendStatus ( SceUID  thid,
int  status 
)

Change the thread suspension status to another value.

More research needs to be done to find out exactly what each status actually means. Some examples of useful scenarios: When handling an exception changing the status to 0x1002 (on a newly suspended thread) will stop the kernel rethrowing the same exception. When resuming a suspended thread changing the status to 2 will allow it to resume.

Note
The valid mask for status is 0xF7F03.
Parameters
[in]thidThe thread to change.
[in]statusThe new status for suspension.
Returns
Zero on success, else < 0 on error.

◆ ksceKernelGetUserThreadId()

SceUID ksceKernelGetUserThreadId ( SceUID  thid)

Get thread PUID from GUID.

Parameters
[in]thid- The thread global uid.
Returns
thread_puid on success, else < 0 on error.

◆ ksceKernelIsThreadDebugSuspended()

int ksceKernelIsThreadDebugSuspended ( SceUID  thid)

Get thread suspend status.

Parameters
[in]thid- The thread global uid.
Returns
Suspend status on success, else <0 on error.

◆ ksceKernelDebugSuspendThread()

int ksceKernelDebugSuspendThread ( SceUID  thid,
int  status 
)

Debug suspend a thread.

Note
The valid mask for status is 0xF7F03.
Parameters
[in]thidThe thread global uid.
[in]statusThe suspend status.
Returns
Zero on success, else <0 on error.

◆ ksceKernelDebugResumeThread()

int ksceKernelDebugResumeThread ( SceUID  thid,
int  status 
)

Debug resume a thread.

Note
The valid mask for status is 0xF7F03.
Parameters
[in]thidThe thread global uid.
[in]statusThe suspend status to resume from.
Returns
Zero on success, else <0 on error.

◆ ksceKernelGetThreadInfoForDebugger()

int ksceKernelGetThreadInfoForDebugger ( SceUID  thid,
int  a2,
void *  pInfo 
)

◆ ksceKernelGetVfpRegisterForDebugger()

int ksceKernelGetVfpRegisterForDebugger ( SceUID  thid,
void *  pVfpRegister 
)

◆ SCE_DEPRECATED_EX()

struct SceKernelFaultingProcessInfo SCE_DEPRECATED_EX ( SceKernelFaultingProcessInfo  ,
"This structure has been replaced by SceKernelThreadContextInfo  
)

◆ ksceKernelGetEventFlagInfo()

int ksceKernelGetEventFlagInfo ( SceUID  evfid,
SceKernelEventFlagInfo info 
)

Get event flags info.

Parameters
[in]evfid- The event flags guid.
[out]info- The info output buffer pointer.
Returns
0 on success, < 0 on error

◆ ksceKernelCreateEventFlag()

SceUID ksceKernelCreateEventFlag ( const char *  name,
int  attr,
int  bits,
SceKernelEventFlagOptParam opt 
)

Create an event flag.

Parameters
name- The name of the event flag.
attr- Attributes from SceEventFlagAttributes
bits- Initial bit pattern.
opt- Options, set to NULL
Returns
< 0 on error. >= 0 event flag id.
Example:
int evid;
evfid = ksceKernelCreateEventFlag("wait_event_flags", 0, 0, NULL);
SceUID ksceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt)
Create an event flag.

◆ ksceKernelSetEventFlag()

int ksceKernelSetEventFlag ( SceUID  evfid,
unsigned int  bits 
)

Set an event flag bit pattern.

Parameters
evid- The event id returned by ksceKernelCreateEventFlag.
bits- The bit pattern to set.
Returns
< 0 On error

◆ ksceKernelClearEventFlag()

int ksceKernelClearEventFlag ( SceUID  evfid,
unsigned int  bits 
)

Clear a event flag bit pattern.

Parameters
evid- The event id returned by ksceKernelCreateEventFlag
bits- The bits to clean
Returns
< 0 on Error

◆ ksceKernelPollEventFlag()

int ksceKernelPollEventFlag ( SceUID  evfid,
unsigned int  bits,
unsigned int  wait,
unsigned int *  outBits 
)

Poll an event flag for a given bit pattern.

Parameters
evid- The event id returned by ksceKernelCreateEventFlag.
bits- The bit pattern to poll for.
wait- Wait type, one or more of SceEventFlagWaitTypes or'ed together
outBits- The bit pattern that was matched.
Returns
< 0 On error

◆ ksceKernelWaitEventFlag()

int ksceKernelWaitEventFlag ( SceUID  evfid,
unsigned int  bits,
unsigned int  wait,
unsigned int *  outBits,
SceUInt timeout 
)

Wait for an event flag for a given bit pattern.

Parameters
evid- The event id returned by ksceKernelCreateEventFlag.
bits- The bit pattern to poll for.
wait- Wait type, one or more of SceEventFlagWaitTypes or'ed together
outBits- The bit pattern that was matched.
timeout- Timeout in microseconds
Returns
< 0 On error

◆ ksceKernelWaitEventFlagCB()

int ksceKernelWaitEventFlagCB ( SceUID  evfid,
unsigned int  bits,
unsigned int  wait,
unsigned int *  outBits,
SceUInt timeout 
)

Wait for an event flag for a given bit pattern with callback.

Parameters
evid- The event id returned by ksceKernelCreateEventFlag.
bits- The bit pattern to poll for.
wait- Wait type, one or more of SceEventFlagWaitTypes or'ed together
outBits- The bit pattern that was matched.
timeout- Timeout in microseconds
Returns
< 0 On error

◆ ksceKernelDeleteEventFlag()

int ksceKernelDeleteEventFlag ( SceUID  evfid)

Delete an event flag.

Parameters
evid- The event id returned by ksceKernelCreateEventFlag.
Returns
< 0 On error

◆ VITASDK_BUILD_ASSERT_EQ() [4/7]

VITASDK_BUILD_ASSERT_EQ ( 0x40  ,
SceKernelFastMutex   
)

◆ ksceKernelInitializeFastMutex()

int ksceKernelInitializeFastMutex ( SceKernelFastMutex fast_mutex,
const char *  name,
int  attr,
void *  opt 
)

◆ ksceKernelFinalizeFastMutex()

int ksceKernelFinalizeFastMutex ( SceKernelFastMutex fast_mutex)

◆ ksceKernelLockFastMutex()

int ksceKernelLockFastMutex ( SceKernelFastMutex fast_mutex)

◆ ksceKernelTryLockFastMutex()

int ksceKernelTryLockFastMutex ( SceKernelFastMutex fast_mutex)

◆ ksceKernelUnlockFastMutex()

int ksceKernelUnlockFastMutex ( SceKernelFastMutex fast_mutex)

◆ ksceKernelGetFastMutexInfo()

int ksceKernelGetFastMutexInfo ( SceKernelFastMutex fast_mutex,
void *  info 
)

◆ VITASDK_BUILD_ASSERT_EQ() [5/7]

VITASDK_BUILD_ASSERT_EQ ( 0x38  ,
SceKernelLwCondInfo   
)

◆ ksceKernelGetLwCondInfo()

int ksceKernelGetLwCondInfo ( SceUID  lwcond_id,
SceKernelLwCondInfo info 
)

◆ VITASDK_BUILD_ASSERT_EQ() [6/7]

VITASDK_BUILD_ASSERT_EQ ( 0x40  ,
SceKernelLwMutexInfo   
)

◆ ksceKernelGetLwMutexInfo()

int ksceKernelGetLwMutexInfo ( SceUID  lwmtxid,
SceKernelLwMutexInfo info 
)

◆ ksceKernelGetThreadmgrUIDClass()

SceKernelIdListType ksceKernelGetThreadmgrUIDClass ( SceUID  uid)

Get the type of a Threadmgr uid.

Parameters
uid- The uid to get the type from
Returns
The type, < 0 on error

◆ ksceKernelGetSystemTimeLow()

SceUInt32 ksceKernelGetSystemTimeLow ( void  )

Get the system time.

Returns
The system time

◆ ksceKernelGetSystemTimeWide()

SceInt64 ksceKernelGetSystemTimeWide ( void  )

Get the system time (wide version)

Returns
The system time

◆ ksceKernelGetThreadTLSAddr()

void* ksceKernelGetThreadTLSAddr ( SceUID  thid,
int  key 
)

ksceKernelGetThreadTLSAddr gets an address to a 4 bytes area of TLS memory for the specified thread

Parameters
thid- The UID of the thread to access TLS
key- the TLS keyslot index
Returns
pointer to TLS memory

◆ ksceKernelGetTLSAddr()

void* ksceKernelGetTLSAddr ( int  key)

ksceKernelGetTLSAddr get pointer to TLS key area for current thread

Parameters
key- the TLS keyslot index
Returns
pointer to TLS key value

◆ ksceKernelSetPermission()

int ksceKernelSetPermission ( int  value)

Set Permission.

Parameters
[in]value- The new permission
Returns
previous permission value

◆ ksceKernelGetProcessId()

SceUID ksceKernelGetProcessId ( void  )

Gets the current process PID.

Returns
Current PID

◆ ksceKernelGetProcessIdFromTLS()

SceUID ksceKernelGetProcessIdFromTLS ( void  )

Get Process id from Thread Local Storage.

Returns
current process id

◆ ksceKernelSetProcessIdToTLS()

SceUID ksceKernelSetProcessIdToTLS ( SceUID  pid)

Set Process id to Thread Local Storage.

Parameters
[in]value- The new process id
Returns
previous process id

◆ ksceKernelRunWithStack()

int ksceKernelRunWithStack ( SceSize  stack_size,
int(*)(void *)  to_call,
void *  args 
)

Runs a function with larger stack size.

Parameters
[in]stack_sizeThe stack size
[in]to_callTo call
argsThe arguments
Returns
Zero on success

◆ VITASDK_BUILD_ASSERT_EQ() [7/7]

VITASDK_BUILD_ASSERT_EQ ( 0x3C  ,
SceKernelMsgPipeInfo   
)

◆ ksceKernelGetMsgPipeInfo()

int ksceKernelGetMsgPipeInfo ( SceUID  msgpipe_id,
SceKernelMsgPipeInfo info 
)

Get msgpipe info.

Parameters
[in]msgpipe_id- The msg pipe guid.
[out]info- The info output buffer pointer.
Returns
0 on success, < 0 on error

◆ ksceKernelCreateMsgPipe()

SceUID ksceKernelCreateMsgPipe ( const char *  name,
int  type,
int  attr,
SceSize  bufSize,
void *  opt 
)

Create a message pipe.

Parameters
name- Name of the pipe
type- The type of memory attribute to use internally (set to 0x40)
attr- Set to 12
bufSize- The size of the internal buffer in multiples of 0x1000 (4KB)
opt- Message pipe options (set to NULL)
Returns
The UID of the created pipe, < 0 on error

◆ ksceKernelDeleteMsgPipe()

int ksceKernelDeleteMsgPipe ( SceUID  uid)

Delete a message pipe.

Parameters
uid- The UID of the pipe
Returns
0 on success, < 0 on error

◆ ksceKernelSendMsgPipeVector()

int ksceKernelSendMsgPipeVector ( SceUID  uid,
const MsgPipeSendData v,
unsigned int  n,
int  unk1,
void *  unk2,
unsigned int *  timeout 
)

Send a message to a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown - async vs sync? use 0 for sync
unk2- Unknown - use NULL
timeout- Timeout for send in us. use NULL to wait indefinitely
Returns
0 on success, < 0 on error

◆ ksceKernelTrySendMsgPipeVector()

int ksceKernelTrySendMsgPipeVector ( SceUID  uid,
const MsgPipeSendData v,
SceSize  size,
int  unk1,
void *  unk2 
)

Try to send a message to a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown - use 0
unk2- Unknown - use NULL
Returns
0 on success, < 0 on error

◆ ksceKernelReceiveMsgPipeVector()

int ksceKernelReceiveMsgPipeVector ( SceUID  uid,
const MsgPipeRecvData v,
unsigned int  n,
int  unk1,
void *  unk2,
unsigned int *  timeout 
)

Receive a message from a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown - async vs sync? use 0 for sync
unk2- Unknown - use NULL
timeout- Timeout for receive in us. use NULL to wait indefinitely
Returns
0 on success, < 0 on error

◆ ksceKernelTryReceiveMsgPipeVector()

int ksceKernelTryReceiveMsgPipeVector ( SceUID  uid,
const MsgPipeRecvData v,
SceSize  size,
int  unk1,
void *  unk2 
)

Receive a message from a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown - use 0
unk2- Unknown - use NULL
Returns
0 on success, < 0 on error

◆ ksceKernelCancelMsgPipe()

int ksceKernelCancelMsgPipe ( SceUID  uid,
int *  psend,
int *  precv 
)

Cancel a message pipe.

Parameters
uid- UID of the pipe to cancel
psend- Receive number of sending threads, NULL is valid
precv- Receive number of receiving threads, NULL is valid
Returns
0 on success, < 0 on error

◆ ksceKernelCreateMutex()

SceUID ksceKernelCreateMutex ( const char *  name,
SceUInt  attr,
int  initCount,
SceKernelMutexOptParam option 
)

Creates a new mutex.

Example:
int mutexid;
mutexid = ksceKernelCreateMutex("MyMutex", 0, 1, NULL);
SceUID ksceKernelCreateMutex(const char *name, SceUInt attr, int initCount, SceKernelMutexOptParam *option)
Creates a new mutex.
Parameters
name- Specifies the name of the mutex
attr- Mutex attribute flags (normally set to 0)
initCount- Mutex initial value
option- Mutex options (normally set to 0)
Returns
A mutex id

◆ ksceKernelDeleteMutex()

int ksceKernelDeleteMutex ( SceUID  mutexid)

Destroy a mutex.

Parameters
mutexid- The mutex id returned from ksceKernelCreateMutex
Returns
Returns the value 0 if it's successful, otherwise -1

◆ ksceKernelLockMutex()

int ksceKernelLockMutex ( SceUID  mutexid,
int  lockCount,
unsigned int *  timeout 
)

Lock a mutex.

Parameters
mutexid- The mutex id returned from ksceKernelCreateMutex
lockCount- The value to increment to the lock count of the mutex
timeout- Timeout in microseconds (assumed)
Returns
< 0 On error.

◆ ksceKernelTryLockMutex()

int ksceKernelTryLockMutex ( SceUID  mutexid,
int  lockCount 
)

Try to lock a mutex (non-blocking)

Parameters
mutexid- The mutex id returned from ksceKernelCreateMutex
lockCount- The value to increment to the lock count of the mutex
Returns
< 0 On error.

◆ ksceKernelUnlockMutex()

int ksceKernelUnlockMutex ( SceUID  mutexid,
int  unlockCount 
)

Try to unlock a mutex (non-blocking)

Parameters
mutexid- The mutex id returned from ksceKernelCreateMutex
unlockCount- The value to decrement to the lock count of the mutex
Returns
< 0 On error.

◆ ksceKernelCancelMutex()

int ksceKernelCancelMutex ( SceUID  mutexid,
int  newCount,
int *  numWaitThreads 
)

Cancels a mutex.

Parameters
mutexid- The mutex id returned from ksceKernelCreateMutex
newCount- The new lock count of the mutex
numWaitThreads- Number of threads waiting for the mutex
Returns
< 0 On error.

◆ ksceKernelGetMutexInfo()

int ksceKernelGetMutexInfo ( SceUID  mutexid,
SceKernelMutexInfo info 
)

Retrieve information about a mutex.

Parameters
mutexid- UID of the mutex to retrieve info for.
info- Pointer to a SceKernelMutexInfo struct to receive the info.
Returns
< 0 on error.

◆ ksceKernelGetSemaInfo()

int ksceKernelGetSemaInfo ( SceUID  semaid,
SceKernelSemaInfo info 
)

Get semaphore info.

Parameters
[in]semaid- The semaphore guid.
[out]info- The info output buffer pointer.
Returns
0 on success, < 0 on error

◆ ksceKernelCreateSema()

SceUID ksceKernelCreateSema ( const char *  name,
SceUInt  attr,
int  initVal,
int  maxVal,
SceKernelSemaOptParam option 
)

Creates a new semaphore.

Example:
int semaid;
semaid = ksceKernelCreateSema("MySema", 0, 1, 1, NULL);
SceUID ksceKernelCreateSema(const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option)
Creates a new semaphore.
Parameters
name- Specifies the name of the sema
attr- Sema attribute flags (normally set to 0)
initVal- Sema initial value
maxVal- Sema maximum value
option- Sema options (normally set to 0)
Returns
A semaphore id

◆ ksceKernelDeleteSema()

int ksceKernelDeleteSema ( SceUID  semaid)

Destroy a semaphore.

Parameters
semaid- The semaid returned from a previous create call.
Returns
Returns the value 0 if it's successful, otherwise -1

◆ ksceKernelSignalSema()

int ksceKernelSignalSema ( SceUID  semaid,
int  signal 
)

Send a signal to a semaphore.

Example:
// Signal the sema
int ksceKernelSignalSema(SceUID semaid, int signal)
Send a signal to a semaphore.
Parameters
semaid- The sema id returned from ksceKernelCreateSema
signal- The amount to signal the sema (i.e. if 2 then increment the sema by 2)
Returns
< 0 On error.

◆ ksceKernelWaitSema()

int ksceKernelWaitSema ( SceUID  semaid,
int  signal,
SceUInt timeout 
)

Lock a semaphore.

Example:
ksceKernelWaitSema(semaid, 1, NULL);
int ksceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout)
Lock a semaphore.
Parameters
semaid- The sema id returned from ksceKernelCreateSema
signal- The value to wait for (i.e. if 1 then wait till reaches a signal state of 1)
timeout- Timeout in microseconds (assumed).
Returns
< 0 on error.

◆ ksceKernelPollSema()

int ksceKernelPollSema ( SceUID  semaid,
int  signal 
)

Poll a semaphore.

Parameters
semaid- UID of the semaphore to poll.
signal- The value to test for.
Returns
< 0 on error.

◆ ksceKernelCreateThread()

SceUID ksceKernelCreateThread ( const char *  name,
SceKernelThreadEntry  entry,
int  initPriority,
SceSize  stackSize,
SceUInt  attr,
int  cpuAffinityMask,
const SceKernelThreadOptParam option 
)

Create a thread.

Example:
SceUID thid;
thid = ksceKernelCreateThread("my_thread", threadFunc, 0x10000100, 0x10000, 0, 0, NULL);
SceUID ksceKernelCreateThread(const char *name, SceKernelThreadEntry entry, int initPriority, SceSize stackSize, SceUInt attr, int cpuAffinityMask, const SceKernelThreadOptParam *option)
Create a thread.
Parameters
name- An arbitrary thread name.
entry- The thread function to run when started.
initPriority- The initial priority of the thread. Less if higher priority.
stackSize- The size of the initial stack.
attr- The thread attributes, zero or more of ::SceThreadAttributes.
cpuAffinityMask- The CPU affinity mask
option- Additional options specified by SceKernelThreadOptParam.
Returns
UID of the created thread, or an error code.

◆ ksceKernelDeleteThread()

int ksceKernelDeleteThread ( SceUID  thid)

Delate a thread.

Parameters
thid- UID of the thread to be deleted.
Returns
< 0 on error.

◆ ksceKernelStartThread()

int ksceKernelStartThread ( SceUID  thid,
SceSize  arglen,
void *  argp 
)

Start a created thread.

Parameters
thid- Thread id from ksceKernelCreateThread
arglen- Length of the data pointed to by argp, in bytes
argp- Pointer to the arguments.

◆ ksceKernelExitThread()

int ksceKernelExitThread ( int  status)

Exit a thread.

Parameters
status- Exit status.

◆ ksceKernelExitDeleteThread()

int ksceKernelExitDeleteThread ( int  status)

Exit a thread and delete itself.

Parameters
status- Exit status

◆ ksceKernelWaitThreadEnd()

int ksceKernelWaitThreadEnd ( SceUID  thid,
int *  stat,
SceUInt timeout 
)

Wait until a thread has ended.

Parameters
thid- Id of the thread to wait for.
stat- Exit status.
timeout- Timeout in microseconds (assumed).
Returns
< 0 on error.

◆ ksceKernelWaitThreadEndCB()

int ksceKernelWaitThreadEndCB ( SceUID  thid,
int *  stat,
SceUInt timeout 
)

Wait until a thread has ended and handle callbacks if necessary.

Parameters
thid- Id of the thread to wait for.
stat- Exit status.
timeout- Timeout in microseconds (assumed).
Returns
< 0 on error.

◆ ksceKernelDelayThread()

int ksceKernelDelayThread ( SceUInt  delay)

Delay the current thread by a specified number of microseconds.

Parameters
delay- Delay in microseconds.
Example:
ksceKernelDelayThread(1000000); // Delay for a second
int ksceKernelDelayThread(SceUInt delay)
Delay the current thread by a specified number of microseconds.

◆ ksceKernelDelayThreadCB()

int ksceKernelDelayThreadCB ( SceUInt  delay)

Delay the current thread by a specified number of microseconds and handle any callbacks.

Parameters
delay- Delay in microseconds.
Example:
ksceKernelDelayThread(1000000); // Delay for a second

◆ ksceKernelChangeThreadPriority()

int ksceKernelChangeThreadPriority ( SceUID  thid,
int  priority 
)

Change the threads current priority.

Parameters
thid- The ID of the thread (from ksceKernelCreateThread or ksceKernelGetThreadId)
priority- The new priority (the lower the number the higher the priority)
Example:
int thid = ksceKernelGetThreadId();
// Change priority of current thread to 16
int ksceKernelChangeThreadPriority(SceUID thid, int priority)
Change the threads current priority.
int ksceKernelGetThreadId(void)
Get the current thread Id.
Returns
0 if successful, otherwise the error code.

◆ ksceKernelGetThreadId()

int ksceKernelGetThreadId ( void  )

Get the current thread Id.

Returns
The thread id of the calling thread.

◆ ksceKernelGetThreadCurrentPriority()

int ksceKernelGetThreadCurrentPriority ( void  )

Get the current priority of the thread you are in.

Returns
The current thread priority

◆ ksceKernelGetThreadStackFreeSize()

int ksceKernelGetThreadStackFreeSize ( SceUID  thid)

Get the free stack size for a thread.

Parameters
thid- The thread ID
Returns
The free size.

◆ ksceKernelGetThreadInfo()

int ksceKernelGetThreadInfo ( SceUID  thid,
SceKernelThreadInfo info 
)

Get the thread info by thread id.

Parameters
thid- The thread id for get info.
info- The info output.
Returns
< 0 on error.

◆ ksceKernelEnqueueWorkQueue()

int ksceKernelEnqueueWorkQueue ( SceUID  uid,
const char *  name,
SceKernelWorkQueueWorkFunction  work,
void *  args 
)

Enqueue work to a workqueue.

Parameters
[in]uidUID of the workqueue (0x10023 for the SceKernelGlobalWorkQueue)
[in]nameName of the work to enqueue
[in]workWork function to enqueue
[in]argsArgument to pass to the work function
Returns
Zero on success