95 #define OS_CONTEXT_TAG 0x4F53436F6E747874ull
138 CHECK_OFFSET(
OSContext, 0x1b8, spinLockCount);
142 CHECK_OFFSET(
OSContext, 0x2e0, coretime);
143 CHECK_OFFSET(
OSContext, 0x2f8, starttime);
174 #define OS_THREAD_TAG 0x74487244u
175 #pragma pack(push, 1)
204 UNKNOWN(0x35C - 0x338);
233 UNKNOWN(0x57c - 0x3a0);
238 UNKNOWN(0x5c0 - 0x5bc);
269 UNKNOWN(0x69c - 0x5f4);
273 CHECK_OFFSET(
OSThread, 0x324, state);
274 CHECK_OFFSET(
OSThread, 0x325, attr);
276 CHECK_OFFSET(
OSThread, 0x328, suspendCounter);
277 CHECK_OFFSET(
OSThread, 0x32c, priority);
278 CHECK_OFFSET(
OSThread, 0x330, basePriority);
279 CHECK_OFFSET(
OSThread, 0x334, exitValue);
280 CHECK_OFFSET(
OSThread, 0x35c, queue);
281 CHECK_OFFSET(
OSThread, 0x360, link);
282 CHECK_OFFSET(
OSThread, 0x368, joinQueue);
283 CHECK_OFFSET(
OSThread, 0x378, mutex);
284 CHECK_OFFSET(
OSThread, 0x37c, mutexQueue);
285 CHECK_OFFSET(
OSThread, 0x38c, activeLink);
286 CHECK_OFFSET(
OSThread, 0x394, stackStart);
287 CHECK_OFFSET(
OSThread, 0x398, stackEnd);
288 CHECK_OFFSET(
OSThread, 0x39c, entryPoint);
289 CHECK_OFFSET(
OSThread, 0x57c, specific);
290 CHECK_OFFSET(
OSThread, 0x5c0, name);
291 CHECK_OFFSET(
OSThread, 0x5c8, userStackPointer);
292 CHECK_OFFSET(
OSThread, 0x5cc, cleanupCallback);
293 CHECK_OFFSET(
OSThread, 0x5d0, deallocator);
294 CHECK_OFFSET(
OSThread, 0x5d4, cancelState);
295 CHECK_OFFSET(
OSThread, 0x5d8, requestFlag);
296 CHECK_OFFSET(
OSThread, 0x5dc, needSuspend);
297 CHECK_OFFSET(
OSThread, 0x5e0, suspendResult);
298 CHECK_OFFSET(
OSThread, 0x5e4, suspendQueue);
360 OSThreadAttributes attributes);
OSThreadCleanupCallbackFn cleanupCallback
Called just before thread is terminated, set with OSSetThreadCleanupCallback.
OSThreadDeallocatorFn deallocator
Called just after a thread is terminated, set with OSSetThreadDeallocator.
void OSSetThreadSpecific(uint32_t id, uint32_t value)
int32_t priority
Actual priority of thread.
OSThreadLink link
Link used for thread queue.
OSThreadQueue * queue
Queue the thread is currently waiting on.
BOOL OSCreateThread(OSThread *thread, OSThreadEntryPointFn entry, int32_t argc, char *argv, void *stack, uint32_t stackSize, int32_t priority, OSThreadAttributes attributes)
int32_t OSCheckThreadStackUsage(OSThread *thread)
int32_t suspendCounter
Suspend count (increased by OSSuspendThread).
uint64_t tag
Should always be set to the value OS_CONTEXT_TAG.
OSThread * OSGetDefaultThread(uint32_t coreID)
int32_t basePriority
Base priority of thread, 0 is highest priority, 31 is lowest priority.
uint8_t OSThreadAttributes
A bitfield of enum OS_THREAD_ATTRIB.
OSThread * OSGetCurrentThread()
int32_t OSGetThreadPriority(OSThread *thread)
void OSCancelThread(OSThread *thread)
uint32_t OSThreadRequest
A value from enum OS_THREAD_REQUEST.
const char * name
Thread name, accessed with OSSetThreadName and OSGetThreadName.
uint16_t id
Unique thread ID.
void OSSleepTicks(OSTime ticks)
void * stackStart
Stack start (top, highest address)
void(* OSThreadDeallocatorFn)(OSThread *thread, void *stack)
BOOL OSIsThreadSuspended(OSThread *thread)
Start the thread detached.
const char * OSGetThreadName(OSThread *thread)
int32_t exitValue
Exit value.
OSThreadLink activeLink
Link for global active thread queue.
BOOL OSSetThreadRunQuantum(OSThread *thread, uint32_t quantum)
OSThreadAttributes attr
Bitfield of OS_THREAD_ATTRIB.
uint32_t OSSuspendThread(OSThread *thread)
OSThreadState state
Bitfield of OS_THREAD_STATE.
void OSDetachThread(OSThread *thread)
Allow the thread to run any CPU.
uint8_t OSThreadState
A value from enum OS_THREAD_STATE.
BOOL OSSetThreadCancelState(BOOL state)
int(* OSThreadEntryPointFn)(int argc, const char **argv)
BOOL OSSetThreadPriority(OSThread *thread, int32_t priority)
int32_t OSResumeThread(OSThread *thread)
int32_t needSuspend
Pending suspend request count.
OSMutex * mutex
Mutex this thread is waiting to lock.
uint32_t OSGetStackPointer()
BOOL cancelState
If TRUE then a thread can be cancelled or suspended, set with OSSetThreadCancelState.
void OSGetActiveThreadLink(OSThread *thread, OSThreadLink *link)
Allow the thread to run on CPU2.
int32_t OSCheckActiveThreads()
void * stackEnd
Stack end (bottom, lowest address)
Allow the thread to run on CPU0.
BOOL OSSetThreadAffinity(OSThread *thread, uint32_t affinity)
BOOL OSJoinThread(OSThread *thread, int *threadResult)
uint32_t tag
Should always be set to the value OS_THREAD_TAG.
void OSWakeupThread(OSThreadQueue *queue)
void OSContinueThread(OSThread *thread)
OSThreadRequest requestFlag
Current thread request, used for cancelleing and suspending the thread.
void OSSetThreadName(OSThread *thread, const char *name)
uint32_t specific[0x10]
Thread specific values, accessed with OSSetThreadSpecific and OSGetThreadSpecific.
OSThreadEntryPointFn entryPoint
Thread entry point.
OSThreadQueue suspendQueue
Queue of threads waiting for a thread to be suspended.
BOOL OSSetThreadStackUsage(OSThread *thread)
Thread is about to terminate.
void * userStackPointer
The stack pointer passed in OSCreateThread.
Thread is waiting, i.e. on a mutex.
int32_t suspendResult
Result of thread suspend.
uint32_t OSGetThreadAffinity(OSThread *thread)
OSThreadQueue joinQueue
Queue of threads waiting to join this thread.
void OSSleepThread(OSThreadQueue *queue)
BOOL OSRunThread(OSThread *thread, OSThreadEntryPointFn entry, int argc, const char **argv)
void OSTestThreadCancel()
void OSExitThread(int32_t result)
OSThreadDeallocatorFn OSSetThreadDeallocator(OSThread *thread, OSThreadDeallocatorFn deallocator)
OSThreadCleanupCallbackFn OSSetThreadCleanupCallback(OSThread *thread, OSThreadCleanupCallbackFn callback)
OSMutexQueue mutexQueue
Queue of mutexes this thread owns.
Enables tracking of stack usage.
void(* OSThreadCleanupCallbackFn)(OSThread *thread, void *stack)
BOOL OSIsThreadTerminated(OSThread *thread)
uint32_t OSGetThreadSpecific(uint32_t id)
void OSClearThreadStackUsage(OSThread *thread)
Allow the thread to run on CPU1.