137 WUT_UNKNOWN_BYTES(0x68);
139 void *eh_mem_manage[9];
140 void *eh_store_globals[6];
141 void *eh_store_globals_tdeh[76];
154 WUT_UNKNOWN_BYTES(4);
173 WUT_UNKNOWN_BYTES(4);
178 #define OS_THREAD_TAG 0x74487244u
179 #pragma pack(push, 1)
245 void *specific[0x10];
278 WUT_UNKNOWN_BYTES(0x4);
309 WUT_UNKNOWN_BYTES(0x2);
327 uint32_t reserved[5];
330 WUT_CHECK_OFFSET(
OSThread, 0x320, tag);
331 WUT_CHECK_OFFSET(
OSThread, 0x324, state);
332 WUT_CHECK_OFFSET(
OSThread, 0x325, attr);
333 WUT_CHECK_OFFSET(
OSThread, 0x326,
id);
334 WUT_CHECK_OFFSET(
OSThread, 0x328, suspendCounter);
335 WUT_CHECK_OFFSET(
OSThread, 0x32c, priority);
336 WUT_CHECK_OFFSET(
OSThread, 0x330, basePriority);
337 WUT_CHECK_OFFSET(
OSThread, 0x334, exitValue);
338 WUT_CHECK_OFFSET(
OSThread, 0x338, coreRunQueue);
339 WUT_CHECK_OFFSET(
OSThread, 0x344, coreRunQueueLink);
340 WUT_CHECK_OFFSET(
OSThread, 0x35c, queue);
341 WUT_CHECK_OFFSET(
OSThread, 0x360, link);
342 WUT_CHECK_OFFSET(
OSThread, 0x368, joinQueue);
343 WUT_CHECK_OFFSET(
OSThread, 0x378, mutex);
344 WUT_CHECK_OFFSET(
OSThread, 0x37c, mutexQueue);
345 WUT_CHECK_OFFSET(
OSThread, 0x38c, activeLink);
346 WUT_CHECK_OFFSET(
OSThread, 0x394, stackStart);
347 WUT_CHECK_OFFSET(
OSThread, 0x398, stackEnd);
348 WUT_CHECK_OFFSET(
OSThread, 0x39c, entryPoint);
349 WUT_CHECK_OFFSET(
OSThread, 0x3a0, ghsExceptionHandling);
350 WUT_CHECK_OFFSET(
OSThread, 0x57c, specific);
351 WUT_CHECK_OFFSET(
OSThread, 0x5bc, type);
352 WUT_CHECK_OFFSET(
OSThread, 0x5c0, name);
353 WUT_CHECK_OFFSET(
OSThread, 0x5c4, waitEventTimeoutAlarm);
354 WUT_CHECK_OFFSET(
OSThread, 0x5c8, userStackPointer);
355 WUT_CHECK_OFFSET(
OSThread, 0x5cc, cleanupCallback);
356 WUT_CHECK_OFFSET(
OSThread, 0x5d0, deallocator);
357 WUT_CHECK_OFFSET(
OSThread, 0x5d4, cancelState);
358 WUT_CHECK_OFFSET(
OSThread, 0x5d8, requestFlag);
359 WUT_CHECK_OFFSET(
OSThread, 0x5dc, needSuspend);
360 WUT_CHECK_OFFSET(
OSThread, 0x5e0, suspendResult);
361 WUT_CHECK_OFFSET(
OSThread, 0x5e4, suspendQueue);
362 WUT_CHECK_OFFSET(
OSThread, 0x5f8, runQuantumTicks);
363 WUT_CHECK_OFFSET(
OSThread, 0x600, coreTimeConsumedNs);
364 WUT_CHECK_OFFSET(
OSThread, 0x608, wakeCount);
365 WUT_CHECK_OFFSET(
OSThread, 0x610, unk0x610);
366 WUT_CHECK_OFFSET(
OSThread, 0x618, unk0x618);
367 WUT_CHECK_OFFSET(
OSThread, 0x620, unk0x620);
368 WUT_CHECK_OFFSET(
OSThread, 0x628, unk0x628);
369 WUT_CHECK_OFFSET(
OSThread, 0x630, dsiCallback);
370 WUT_CHECK_OFFSET(
OSThread, 0x63c, isiCallback);
371 WUT_CHECK_OFFSET(
OSThread, 0x648, programCallback);
372 WUT_CHECK_OFFSET(
OSThread, 0x654, perfMonCallback);
373 WUT_CHECK_OFFSET(
OSThread, 0x664, tlsSectionCount);
374 WUT_CHECK_OFFSET(
OSThread, 0x668, tlsSections);
375 WUT_CHECK_OFFSET(
OSThread, 0x66c, fastMutex);
376 WUT_CHECK_OFFSET(
OSThread, 0x670, contendedFastMutexes);
377 WUT_CHECK_OFFSET(
OSThread, 0x678, fastMutexQueue);
378 WUT_CHECK_OFFSET(
OSThread, 0x680, alignCallback);
379 WUT_CHECK_OFFSET(
OSThread, 0x68c, reserved);
BOOL(* OSExceptionCallbackFn)(OSContext *context)
OSThreadLink activeLink
Link for global active thread queue.
OSFastMutexQueue contendedFastMutexes
The fast mutexes we are currently contended on.
uint64_t coreTimeConsumedNs
The total amount of core time consumed by this thread (Does not include time while Running)
OSThreadAttributes attr
Bitfield of OS_THREAD_ATTRIB.
OSThreadState state
Bitfield of OS_THREAD_STATE.
OSMutexQueue mutexQueue
Queue of mutexes this thread owns.
uint32_t tag
Should always be set to the value OS_THREAD_TAG.
OSFastMutex * fastMutex
The fast mutex we are currently waiting for.
void * userStackPointer
The stack pointer passed in OSCreateThread.
OSTLSSection * tlsSections
TLS Sections.
OSThreadDeallocatorFn deallocator
Called just after a thread is terminated, set with OSSetThreadDeallocator.
OSThreadGHSExceptionHandling ghsExceptionHandling
GHS Exception handling thread-specifics.
int32_t needSuspend
Pending suspend request count.
int32_t priority
Actual priority of thread.
uint16_t id
Unique thread ID.
OSThreadEntryPointFn entryPoint
Thread entry point.
OSAlarm * waitEventTimeoutAlarm
uint64_t wakeCount
The number of times this thread has been awoken.
int32_t basePriority
Base priority of thread, 0 is highest priority, 31 is lowest priority.
OSMutex * mutex
Mutex this thread is waiting to lock.
const char * name
Thread name, accessed with OSSetThreadName and OSGetThreadName.
uint16_t tlsSectionCount
Number of TLS sections.
OSThreadRequest requestFlag
Current thread request, used for cancelleing and suspending the thread.
BOOL cancelState
If TRUE then a thread can be cancelled or suspended, set with OSSetThreadCancelState.
int32_t exitValue
Exit value.
OSThreadQueue * queue
Queue the thread is currently waiting on.
int32_t suspendCounter
Suspend count (increased by OSSuspendThread).
OSThreadQueue suspendQueue
Queue of threads waiting for a thread to be suspended.
int32_t suspendResult
Result of thread suspend.
int64_t runQuantumTicks
How many ticks the thread should run for before suspension.
void * stackStart
Stack start (top, highest address)
OSThreadCleanupCallbackFn cleanupCallback
Called just before thread is terminated, set with OSSetThreadCleanupCallback.
BOOL stackSyncObjAllowed
Checks for synchronization objects placed on stack in debug mode when set to true.
OSThreadQueue joinQueue
Queue of threads waiting to join this thread.
OSFastMutexQueue fastMutexQueue
The fast mutexes we currently own locks on.
OSThreadLink link
Link used for thread queue.
void * stackEnd
Stack end (bottom, lowest address)
BOOL OSIsThreadSuspended(OSThread *thread)
Returns TRUE if a thread is suspended.
void __OSSuspendThreadNolock(OSThread *thread)
int32_t OSCheckActiveThreads()
Returns the count of active threads.
BOOL OSIsThreadTerminated(OSThread *thread)
Returns TRUE if a thread is terminated.
uint8_t OSThreadState
A value from enum OS_THREAD_STATE.
void OSWakeupThread(OSThreadQueue *queue)
Wake up all threads in queue.
uint32_t OSThreadRequest
A value from enum OS_THREAD_REQUEST.
int32_t OSCheckThreadStackUsage(OSThread *thread)
Get the maximum amount of stack the thread has used.
const char * OSGetThreadName(OSThread *thread)
Get a thread's name.
OSThread * OSGetCurrentThread()
Return pointer to OSThread object for the current thread.
BOOL OSSetThreadStackUsage(OSThread *thread)
Set thread stack usage tracking.
void OSTestThreadCancel()
Check to see if the current thread should be cancelled or suspended.
void OSSleepThread(OSThreadQueue *queue)
Sleep the current thread and add it to a thread queue.
uint32_t OSGetStackPointer()
Return current stack pointer, value of r1 register.
uint8_t OSThreadAttributes
A bitfield of enum OS_THREAD_ATTRIB.
void OSExitThread(int32_t result)
Exit the current thread with a exit code.
void OSCancelThread(OSThread *thread)
Cancels a thread.
void OSGetActiveThreadLink(OSThread *thread, OSThreadLink *link)
Get the next and previous thread in the thread's active queue.
BOOL OSCreateThread(OSThread *thread, OSThreadEntryPointFn entry, int32_t argc, char *argv, void *stack, uint32_t stackSize, int32_t priority, OSThreadAttributes attributes)
Create a new thread.
BOOL OSSetThreadCancelState(BOOL state)
Set a thread's cancellation state.
void OSDetachThread(OSThread *thread)
Detach thread.
uint32_t OSGetThreadAffinity(OSThread *thread)
Get a thread's affinity.
BOOL OSSetThreadAffinity(OSThread *thread, uint32_t affinity)
Set a thread's affinity.
void OSContinueThread(OSThread *thread)
Clears a thread's suspend counter and resumes it.
void(* OSThreadCleanupCallbackFn)(OSThread *thread, void *stack)
int32_t OSResumeThread(OSThread *thread)
Resumes a thread.
void * OSGetThreadSpecific(OSThreadSpecificID id)
Get a thread's specific value set by OSSetThreadSpecific.
uint32_t OSSuspendThread(OSThread *thread)
Suspend a thread.
int32_t OSGetThreadPriority(OSThread *thread)
Get a thread's base priority.
BOOL OSRunThread(OSThread *thread, OSThreadEntryPointFn entry, int argc, const char **argv)
Run a function on an already created thread.
void OSYieldThread()
Yield execution to waiting threads with same priority.
int(* OSThreadEntryPointFn)(int argc, const char **argv)
OSThreadDeallocatorFn OSSetThreadDeallocator(OSThread *thread, OSThreadDeallocatorFn deallocator)
Set the callback to be called just after a thread is terminated.
BOOL OSJoinThread(OSThread *thread, int *threadResult)
Wait until thread is terminated.
BOOL OSSetThreadRunQuantum(OSThread *thread, uint32_t quantum)
Set a thread's run quantum.
void(* OSThreadDeallocatorFn)(OSThread *thread, void *stack)
OSThread * OSGetDefaultThread(uint32_t coreID)
Returns the default thread for a specific core.
uint32_t OSThreadType
A bitfield of enum OS_THREAD_TYPE.
void OSSetThreadSpecific(OSThreadSpecificID id, void *value)
Set a thread specific value.
OSThreadCleanupCallbackFn OSSetThreadCleanupCallback(OSThread *thread, OSThreadCleanupCallbackFn callback)
Set the callback to be called just before a thread is terminated.
void OSSleepTicks(OSTime ticks)
Sleep the current thread for a period of time.
void OSClearThreadStackUsage(OSThread *thread)
Disable tracking of thread stack usage.
void OSSetThreadName(OSThread *thread, const char *name)
Set a thread's name.
BOOL OSSetThreadPriority(OSThread *thread, int32_t priority)
Set a thread's priority.
@ OS_THREAD_STATE_MORIBUND
Thread is about to terminate.
@ OS_THREAD_STATE_WAITING
Thread is waiting, i.e. on a mutex.
@ OS_THREAD_STATE_READY
Thread is ready to run.
@ OS_THREAD_STATE_RUNNING
Thread is running.
@ OS_THREAD_SPECIFIC_0
These can be used by applications.
@ OS_THREAD_SPECIFIC_WUT_RESERVED_1
@ OS_THREAD_SPECIFIC_WUT_RESERVED_0
These are reserved to wut for internal use.
@ OS_THREAD_ATTRIB_AFFINITY_CPU2
Allow the thread to run on CPU2.
@ OS_THREAD_ATTRIB_AFFINITY_CPU0
Allow the thread to run on CPU0.
@ OS_THREAD_ATTRIB_DETACHED
Start the thread detached.
@ OS_THREAD_ATTRIB_STACK_USAGE
Enables tracking of stack usage.
@ OS_THREAD_ATTRIB_AFFINITY_ANY
Allow the thread to run any CPU.
@ OS_THREAD_ATTRIB_UNKNOWN
@ OS_THREAD_ATTRIB_AFFINITY_CPU1
Allow the thread to run on CPU1.
@ OS_THREAD_REQUEST_SUSPEND
@ OS_THREAD_REQUEST_CANCEL