diff options
author | Sergi Granell | 2017-11-13 19:57:37 +0100 |
---|---|---|
committer | Sergi Granell | 2017-11-13 19:57:37 +0100 |
commit | d1637f55db3de854da585b1ce9de4f4005f82770 (patch) | |
tree | 91811170884e5ae15aa8da38aae523c0377e82c6 | |
parent | Fix psp2kern/types.h include in psp2kern headers (diff) | |
download | vds-libraries-d1637f55db3de854da585b1ce9de4f4005f82770.tar.gz |
Add more kernel threadmgr NIDs, psp2kern/kernel/threadmgr.h cleanups
-rw-r--r-- | include/kernel/kernel/threadmgr.h | 389 | ||||
-rw-r--r-- | nids/360/SceKernelThreadMgr.yml | 4 |
2 files changed, 200 insertions, 193 deletions
diff --git a/include/kernel/kernel/threadmgr.h b/include/kernel/kernel/threadmgr.h index b4814e2..dc04a01 100644 --- a/include/kernel/kernel/threadmgr.h +++ b/include/kernel/kernel/threadmgr.h @@ -18,84 +18,84 @@ typedef int (*SceKernelThreadEntry)(SceSize args, void *argp); /** Additional options used when creating threads. */ typedef struct SceKernelThreadOptParam { - /** Size of the ::SceKernelThreadOptParam structure. */ - SceSize size; - /** Attributes */ - SceUInt32 attr; + /** Size of the ::SceKernelThreadOptParam structure. */ + SceSize size; + /** Attributes */ + SceUInt32 attr; } SceKernelThreadOptParam; /** Structure to hold the status information for a thread * @see sceKernelGetThreadInfo */ typedef struct SceKernelThreadInfo { - /** Size of the structure */ - SceSize size; - /** The UID of the process where the thread belongs */ - SceUID processId; //Needs confirmation - /** Nul terminated name of the thread */ - char name[32]; - /** Thread attributes */ - SceUInt attr; - /** Thread status */ - int status; - /** Thread entry point */ - SceKernelThreadEntry entry; - /** Thread stack pointer */ - void *stack; - /** Thread stack size */ - int stackSize; - /** Initial priority */ - int initPriority; - /** Current priority */ - int currentPriority; - /** Initial CPU affinity mask */ - int initCpuAffinityMask; - /** Current CPU affinity mask */ - int currentCpuAffinityMask; - /** Current CPU ID */ - int currentCpuId; - /** Last executed CPU ID */ - int lastExecutedCpuId; - /** Wait type */ - int waitType; - /** Wait id */ - SceUID waitId; - /** Exit status of the thread */ - int exitStatus; - /** Number of clock cycles run */ - SceKernelSysClock runClocks; - /** Interrupt preemption count */ - SceUInt intrPreemptCount; - /** Thread preemption count */ - SceUInt threadPreemptCount; - /** Thread release count */ - SceUInt threadReleaseCount; - /** Function notify callback UID */ - SceUID fNotifyCallback; - /** Reserved */ - int reserved; + /** Size of the structure */ + SceSize size; + /** The UID of the process where the thread belongs */ + SceUID processId; //Needs confirmation + /** Nul terminated name of the thread */ + char name[32]; + /** Thread attributes */ + SceUInt attr; + /** Thread status */ + int status; + /** Thread entry point */ + SceKernelThreadEntry entry; + /** Thread stack pointer */ + void *stack; + /** Thread stack size */ + int stackSize; + /** Initial priority */ + int initPriority; + /** Current priority */ + int currentPriority; + /** Initial CPU affinity mask */ + int initCpuAffinityMask; + /** Current CPU affinity mask */ + int currentCpuAffinityMask; + /** Current CPU ID */ + int currentCpuId; + /** Last executed CPU ID */ + int lastExecutedCpuId; + /** Wait type */ + int waitType; + /** Wait id */ + SceUID waitId; + /** Exit status of the thread */ + int exitStatus; + /** Number of clock cycles run */ + SceKernelSysClock runClocks; + /** Interrupt preemption count */ + SceUInt intrPreemptCount; + /** Thread preemption count */ + SceUInt threadPreemptCount; + /** Thread release count */ + SceUInt threadReleaseCount; + /** Function notify callback UID */ + SceUID fNotifyCallback; + /** Reserved */ + int reserved; } SceKernelThreadInfo; /** Statistics about a running thread. * @see sceKernelGetThreadRunStatus. */ typedef struct SceKernelThreadRunStatus { - SceSize size; - struct { - SceUID processId; - SceUID threadId; - int priority; - } cpuInfo[4]; + SceSize size; + struct { + SceUID processId; + SceUID threadId; + int priority; + } cpuInfo[4]; } SceKernelThreadRunStatus; /* Sure there must be more than this, but haven't seen them */ typedef enum SceThreadStatus { - SCE_THREAD_RUNNING = 1, - SCE_THREAD_READY = 2, - SCE_THREAD_WAITING = 4, - SCE_THREAD_SUSPEND = 8, - SCE_THREAD_STOPPED = 16, - SCE_THREAD_KILLED = 32, /* Thread manager has killed the thread (stack overflow) */ + SCE_THREAD_RUNNING = 1, + SCE_THREAD_READY = 2, + SCE_THREAD_WAITING = 4, + SCE_THREAD_SUSPEND = 8, + SCE_THREAD_STOPPED = 16, + SCE_THREAD_KILLED = 32, /* Thread manager has killed the thread (stack overflow) */ } SceThreadStatus; /** @@ -309,30 +309,30 @@ int sceKernelGetThreadRunStatus(SceUID thid, SceKernelThreadRunStatus *status); /** Additional options used when creating semaphores. */ typedef struct SceKernelSemaOptParam { - /** Size of the ::SceKernelSemaOptParam structure. */ - SceSize size; + /** Size of the ::SceKernelSemaOptParam structure. */ + SceSize size; } SceKernelSemaOptParam; /** Current state of a semaphore. * @see sceKernelGetSemaInfo. */ typedef struct SceKernelSemaInfo { - /** Size of the ::SceKernelSemaInfo structure. */ - SceSize size; - /** The UID of the semaphore */ - SceUID semaId; - /** NUL-terminated name of the semaphore. */ - char name[32]; - /** Attributes. */ - SceUInt attr; - /** The initial count the semaphore was created with. */ - int initCount; - /** The current count. */ - int currentCount; - /** The maximum count. */ - int maxCount; - /** The number of threads waiting on the semaphore. */ - int numWaitThreads; + /** Size of the ::SceKernelSemaInfo structure. */ + SceSize size; + /** The UID of the semaphore */ + SceUID semaId; + /** NUL-terminated name of the semaphore. */ + char name[32]; + /** Attributes. */ + SceUInt attr; + /** The initial count the semaphore was created with. */ + int initCount; + /** The current count. */ + int currentCount; + /** The maximum count. */ + int maxCount; + /** The number of threads waiting on the semaphore. */ + int numWaitThreads; } SceKernelSemaInfo; /** @@ -341,7 +341,7 @@ typedef struct SceKernelSemaInfo { * @par Example: * @code * int semaid; - * semaid = sceKernelCreateSema("MyMutex", 0, 1, 1, 0); + * semaid = sceKernelCreateSema("MySema", 0, 1, 1, 0); * @endcode * * @param name - Specifies the name of the sema @@ -444,31 +444,31 @@ int sceKernelGetSemaInfo(SceUID semaid, SceKernelSemaInfo *info); /** Additional options used when creating mutexes. */ typedef struct SceKernelMutexOptParam { - /** Size of the ::SceKernelMutexOptParam structure. */ - SceSize size; - int ceilingPriority; + /** Size of the ::SceKernelMutexOptParam structure. */ + SceSize size; + int ceilingPriority; } SceKernelMutexOptParam; /** Current state of a mutex. * @see sceKernelGetMutexInfo. */ typedef struct SceKernelMutexInfo { - /** Size of the ::SceKernelMutexInfo structure. */ - SceSize size; - /** The UID of the mutex. */ - SceUID mutexId; - /** NUL-terminated name of the mutex. */ - char name[32]; - /** Attributes. */ - SceUInt attr; - /** The initial count the mutex was created with. */ - int initCount; - /** The current count. */ - int currentCount; - /** The UID of the current owner of the mutex. */ - SceUID currentOwnerId; - /** The number of threads waiting on the mutex. */ - int numWaitThreads; + /** Size of the ::SceKernelMutexInfo structure. */ + SceSize size; + /** The UID of the mutex. */ + SceUID mutexId; + /** NUL-terminated name of the mutex. */ + char name[32]; + /** Attributes. */ + SceUInt attr; + /** The initial count the mutex was created with. */ + int initCount; + /** The current count. */ + int currentCount; + /** The UID of the current owner of the mutex. */ + SceUID currentOwnerId; + /** The number of threads waiting on the mutex. */ + int numWaitThreads; } SceKernelMutexInfo; /** @@ -570,42 +570,59 @@ int sceKernelCancelMutex(SceUID mutexid, int newCount, int *numWaitThreads); */ int sceKernelGetMutexInfo(SceUID mutexid, SceKernelMutexInfo *info); +typedef struct SceKernelLwMutexWork { + SceInt64 data[4]; +} SceKernelLwMutexWork; + +typedef struct SceKernelLwMutexOptParam { + SceSize size; +} SceKernelLwMutexOptParam; + +int sceKernelCreateLwMutex(SceKernelLwMutexWork *pWork,const char *pName, unsigned int attr, int initCount, const SceKernelLwMutexOptParam *pOptParam); +int sceKernelDeleteLwMutex(SceKernelLwMutexWork *pWork); +int sceKernelLockLwMutex(SceKernelLwMutexWork *pWork, int lockCount, unsigned int *pTimeout); +int sceKernelUnlockLwMutex(SceKernelLwMutexWork *pWork, int unlockCount); + +int sceKernelInitializeFastMutex(void *mutex, const char *name, int unk0, int unk1); +int sceKernelLockFastMutex(void *mutex); +int sceKernelUnlockFastMutex(void *mutex); +int sceKernelDeleteFastMutex(void *mutex); /* Event flags. */ /** Structure to hold the event flag information */ typedef struct SceKernelEventFlagInfo { - SceSize size; - SceUID evfId; // Needs confirmation - char name[32]; - SceUInt attr; - SceUInt initPattern; - SceUInt currentPattern; - int numWaitThreads; + SceSize size; + SceUID evfId; // Needs confirmation + char name[32]; + SceUInt attr; + SceUInt initPattern; + SceUInt currentPattern; + int numWaitThreads; } SceKernelEventFlagInfo; typedef struct SceKernelEventFlagOptParam { - SceSize size; + SceSize size; } SceKernelEventFlagOptParam; typedef struct SceKernelEventFlagOptParam SceKernelEventFlagOptParam; /** Event flag creation attributes */ typedef enum SceEventFlagAttributes { - /** Allow the event flag to be waited upon by multiple threads */ - SCE_EVENT_WAITMULTIPLE = 0x1000 + /** Allow the event flag to be waited upon by multiple threads */ + SCE_EVENT_WAITMULTIPLE = 0x1000 } SceEventFlagAttributes; /** Event flag wait types */ typedef enum SceEventFlagWaitTypes { - /** Wait for all bits in the pattern to be set */ - SCE_EVENT_WAITAND = 0, - /** Wait for one or more bits in the pattern to be set */ - SCE_EVENT_WAITOR = 1, - /** Clear all the bits when it matches */ - SCE_EVENT_WAITCLEAR = 2, - /** Clear the wait pattern when it matches */ - SCE_EVENT_WAITCLEAR_PAT = 4 + /** Wait for all bits in the pattern to be set */ + SCE_EVENT_WAITAND = 0, + /** Wait for one or more bits in the pattern to be set */ + SCE_EVENT_WAITOR = 1, + /** Clear all the bits when it matches */ + SCE_EVENT_WAITCLEAR = 2, + /** Clear the wait pattern when it matches */ + SCE_EVENT_WAITCLEAR_PAT = 4 } SceEventFlagWaitTypes; /** @@ -699,6 +716,20 @@ int sceKernelDeleteEventFlag(int evid); */ int sceKernelGetEventFlagInfo(SceUID event, SceKernelEventFlagInfo *info); +/* Condition variables */ + +typedef struct SceKernelLwCondWork { + SceInt64 data[4]; +} SceKernelLwCondWork; + +typedef struct SceKernelLwCondOptParam { + SceSize size; +} SceKernelLwCondOptParam; + +int sceKernelCreateLwCond(SceKernelLwCondWork *pWork, const char *pName, unsigned int attr, SceKernelLwMutexWork *pLwMutex, const SceKernelLwCondOptParam *pOptParam); +int sceKernelDeleteLwCond(SceKernelLwCondWork *pWork); +int sceKernelSignalLwCond(SceKernelLwCondWork *pWork); +int sceKernelWaitLwCond(SceKernelLwCondWork *pWork, unsigned int *pTimeout); /* Callbacks. */ @@ -707,22 +738,22 @@ typedef int (*SceKernelCallbackFunction)(int notifyId, int notifyCount, int noti /** Structure to hold the status information for a callback */ typedef struct SceKernelCallbackInfo { - /** Size of the structure (i.e. sizeof(SceKernelCallbackInfo)) */ - SceSize size; - /** The UID of the callback. */ - SceUID callbackId; // Needs confirmation - /** The name given to the callback */ - char name[32]; - /** The thread id associated with the callback */ - SceUID threadId; - /** Pointer to the callback function */ - SceKernelCallbackFunction callback; - /** User supplied argument for the callback */ - void *common; - /** Unknown */ - int notifyCount; - /** Unknown */ - int notifyArg; + /** Size of the structure (i.e. sizeof(SceKernelCallbackInfo)) */ + SceSize size; + /** The UID of the callback. */ + SceUID callbackId; // Needs confirmation + /** The name given to the callback */ + char name[32]; + /** The thread id associated with the callback */ + SceUID threadId; + /** Pointer to the callback function */ + SceKernelCallbackFunction callback; + /** User supplied argument for the callback */ + void *common; + /** Unknown */ + int notifyCount; + /** Unknown */ + int notifyArg; } SceKernelCallbackInfo; /** @@ -917,14 +948,14 @@ int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv); /** Message Pipe status info */ typedef struct SceKernelMppInfo { - SceSize size; - SceUID mppId; // Needs confirmation - char name[32]; - SceUInt attr; - int bufSize; - int freeSize; - int numSendWaitThreads; - int numReceiveWaitThreads; + SceSize size; + SceUID mppId; // Needs confirmation + char name[32]; + SceUInt attr; + int bufSize; + int freeSize; + int numSendWaitThreads; + int numReceiveWaitThreads; } SceKernelMppInfo; /** @@ -941,14 +972,14 @@ int sceKernelGetMsgPipeInfo(SceUID uid, SceKernelMppInfo *info); /* Misc. */ typedef struct SceKernelSystemInfo { - SceSize size; - SceUInt32 activeCpuMask; - - struct { - SceKernelSysClock idleClock; - SceUInt32 comesOutOfIdleCount; - SceUInt32 threadSwitchCount; - } cpuInfo[4]; + SceSize size; + SceUInt32 activeCpuMask; + + struct { + SceKernelSysClock idleClock; + SceUInt32 comesOutOfIdleCount; + SceUInt32 threadSwitchCount; + } cpuInfo[4]; } SceKernelSystemInfo; /** @@ -964,21 +995,21 @@ int sceKernelGetSystemInfo(SceKernelSystemInfo *info); /** Threadmgr types */ typedef enum SceKernelIdListType { - SCE_KERNEL_TMID_Thread = 1, - SCE_KERNEL_TMID_Semaphore = 2, - SCE_KERNEL_TMID_EventFlag = 3, - SCE_KERNEL_TMID_Mbox = 4, - SCE_KERNEL_TMID_Vpl = 5, - SCE_KERNEL_TMID_Fpl = 6, - SCE_KERNEL_TMID_Mpipe = 7, - SCE_KERNEL_TMID_Callback = 8, - SCE_KERNEL_TMID_ThreadEventHandler = 9, - SCE_KERNEL_TMID_Alarm = 10, - SCE_KERNEL_TMID_VTimer = 11, - SCE_KERNEL_TMID_SleepThread = 64, - SCE_KERNEL_TMID_DelayThread = 65, - SCE_KERNEL_TMID_SuspendThread = 66, - SCE_KERNEL_TMID_DormantThread = 67, + SCE_KERNEL_TMID_Thread = 1, + SCE_KERNEL_TMID_Semaphore = 2, + SCE_KERNEL_TMID_EventFlag = 3, + SCE_KERNEL_TMID_Mbox = 4, + SCE_KERNEL_TMID_Vpl = 5, + SCE_KERNEL_TMID_Fpl = 6, + SCE_KERNEL_TMID_Mpipe = 7, + SCE_KERNEL_TMID_Callback = 8, + SCE_KERNEL_TMID_ThreadEventHandler = 9, + SCE_KERNEL_TMID_Alarm = 10, + SCE_KERNEL_TMID_VTimer = 11, + SCE_KERNEL_TMID_SleepThread = 64, + SCE_KERNEL_TMID_DelayThread = 65, + SCE_KERNEL_TMID_SuspendThread = 66, + SCE_KERNEL_TMID_DormantThread = 67, } SceKernelIdListType; /** @@ -990,34 +1021,6 @@ typedef enum SceKernelIdListType { */ SceKernelIdListType sceKernelGetThreadmgrUIDClass(SceUID uid); - -typedef struct SceKernelLwMutexWork { - SceInt64 data[4]; -} SceKernelLwMutexWork; - -typedef struct SceKernelLwMutexOptParam { - SceSize size; -} SceKernelLwMutexOptParam; - -int sceKernelCreateLwMutex(SceKernelLwMutexWork *pWork,const char *pName, unsigned int attr, int initCount, const SceKernelLwMutexOptParam *pOptParam); -int sceKernelDeleteLwMutex(SceKernelLwMutexWork *pWork); -int sceKernelLockLwMutex(SceKernelLwMutexWork *pWork, int lockCount, unsigned int *pTimeout); -int sceKernelUnlockLwMutex(SceKernelLwMutexWork *pWork, int unlockCount); - -typedef struct SceKernelLwCondWork { - SceInt64 data[4]; -} SceKernelLwCondWork; - -typedef struct SceKernelLwCondOptParam { - SceSize size; -} SceKernelLwCondOptParam; - -int sceKernelCreateLwCond(SceKernelLwCondWork *pWork, const char *pName, unsigned int attr, SceKernelLwMutexWork *pLwMutex, const SceKernelLwCondOptParam *pOptParam); -int sceKernelDeleteLwCond(SceKernelLwCondWork *pWork); -int sceKernelSignalLwCond(SceKernelLwCondWork *pWork); -int sceKernelWaitLwCond(SceKernelLwCondWork *pWork, unsigned int *pTimeout); - - /** * Get the system time (wide version) * diff --git a/nids/360/SceKernelThreadMgr.yml b/nids/360/SceKernelThreadMgr.yml index 81d32e5..04a9ec3 100644 --- a/nids/360/SceKernelThreadMgr.yml +++ b/nids/360/SceKernelThreadMgr.yml @@ -119,6 +119,7 @@ modules: sceKernelDelayThreadCB: 0x9C0180E1 sceKernelDeleteCallback: 0x3A7E17F6 sceKernelDeleteEventFlag: 0x71ECB352 + sceKernelDeleteFastMutex: 0x11FE84A1 sceKernelDeleteMutex: 0x0A912340 sceKernelDeleteSema: 0x16A35E58 sceKernelDeleteThread: 0xAC834F3F @@ -131,12 +132,14 @@ modules: sceKernelGetSystemTimeWide: 0xF4EE4FA9 sceKernelGetThreadCpuAffinityMask: 0x83DC703D sceKernelGetThreadCurrentPriority: 0x01414F0B + sceKernelGetThreadId: 0x59D06540 sceKernelGetThreadStackFreeSize: 0x7B278A0B sceKernelGetThreadTLSAddr: 0x66EEA46A sceKernelGetThreadmgrUIDClass: 0x0A20775A sceKernelGetTimerBaseWide: 0xA6D11DD3 sceKernelGetTimerTimeWide: 0xC1286004 sceKernelInitializeFastMutex: 0xAF8E1266 + sceKernelLockFastMutex: 0x70627F3A sceKernelLockMutex: 0x16AC80C5 sceKernelNotifyCallback: 0xC3E00919 sceKernelPollEventFlag: 0x76C6555B @@ -158,6 +161,7 @@ modules: sceKernelTryLockMutex: 0x270993A6 sceKernelTryLockReadRWLock: 0xFC2B5A50 sceKernelTryLockWriteRWLock: 0xA96F2E5A + sceKernelUnlockFastMutex: 0xDB395782 sceKernelUnlockMutex: 0x1E82E5D0 sceKernelUnlockReadRWLock: 0xDE1B9EEE sceKernelUnlockWriteRWLock: 0x94A73797 |