Line 202:
Line 202:
!Name
!Name
!Prototype
!Prototype
+
+
|-
+
|OSThreadQueue
+
|
+
<syntaxhighlight lang="C">
+
typedef struct {
+
/* 0x00 */ OSThread* headThread;
+
/* 0x04 */ OSThread* tailThread;
+
/* 0x08 */ void* parent;
+
/* 0x0C */ uint32_t _unknown0C;
+
} OSThreadQueue; /* 0x10 total length */
+
</syntaxhighlight>
+
|
+
+
+
|-
+
|OSThreadLink
+
|
+
<syntaxhighlight lang="C">
+
typedef struct {
+
/* 0x00 */ OSThread* next;
+
/* 0x04 */ OSThread* prev;
+
} OSThreadLink; /* 0x8 total length */
+
</syntaxhighlight>
+
|
+
+
|-
+
|OSContext
+
|
+
<syntaxhighlight lang="C">
+
typedef struct {
+
/* 0x000 */ char contextTag[8]; /* "OSContxt" */
+
/* 0x008 */ int32_t gpr[32]; /* ppc general purpose registers */
+
/* 0x088 */ uint32_t cr; /* conditional register */
+
/* 0x08c */ uint32_t lr; /* link register (SPR 8) */
+
/* 0x090 */ uint32_t ctr; /* counter register (SPR 9) */
+
/* 0x094 */ uint32_t xer; /* fixed-point exception register */
+
/* 0x098 */ uint32_t srr0; /* machine status restore register 0, used to store instruction pointer */
+
/* 0x09c */ uint32_t srr1; /* machine status restore register 1, ? */
+
/* 0x0a0 */ uint32_t _unknown0A0;
+
/* 0x0a4 */ uint32_t _unknown0A4;
+
/* 0x0a8 */ uint32_t _unused0A8;
+
/* 0x0ac */ uint32_t _unused0AC;
+
/* 0x0b0 */ uint32_t fpscr_high; /* floating point status & control register */
+
/* 0x0b4 */ uint32_t fpscr_low; /* floating point status & control register */
+
/* 0x0b8 */ uint64_t fpr[32]; /* FPR double registers */
+
/* 0x1b8 */ uint16_t spinLockCount; /* counts number of acquired spinlocks? */
+
/* 0x1ba */ uint16_t contextState; /* purpose unknown, there is another state variable for threading logic */
+
/* 0x1bc */ uint32_t ugqr[8]; /* user-mode graphics quantization registers (controls paired single load/store) */
+
/* 0x1dc */ uint32_t pir;
+
/* 0x1e0 */ uint64_t psf[32]; /* FPR registers (paired-single mode) */
+
/* 0x2e0 */ int64_t coretime[3]; /* number of cycles context was active per core? */
+
/* 0x2f8 */ int64_t starttime; /* set on context creation to value of OSGetSystemTime() */
+
/* 0x300 */ int32_t error; /* used by OSGetLastError() and __OSSetLastError() */
+
/* 0x304 */ uint32_t attributes; /* contains per-context flags and affinity, similar to OSThread.attr */
+
/* 0x308 */ uint32_t pmc1;
+
/* 0x30C */ uint32_t pmc2;
+
/* 0x310 */ uint32_t pmc3;
+
/* 0x314 */ uint32_t pmc4;
+
/* 0x318 */ uint32_t mmcr0;
+
/* 0x31C */ uint32_t mmcr1;
+
} OSContext; /* 0x320 total length */
+
</syntaxhighlight>
+
|
+
|-
|-
|OSThread
|OSThread
Line 207:
Line 272:
<syntaxhighlight lang="C">
<syntaxhighlight lang="C">
typedef struct {
typedef struct {
−
char tag[8]; /* 0x000 "OSContxt" */
+
/* 0x000 */ OSContext context;
−
int32_t gpr[32]; /* 0x008 from OSDumpContext */
+
/* 0x320 */ uint32_t threadTag; /* "tHrD" */
−
uint32_t cr; /* 0x088 from OSDumpContext */
+
/* 0x324 */ uint8_t state; /* Thread state (0 None, 1 Ready, 2 Running, 4 Waiting, 8 Dead) */
−
uint32_t lr; /* 0x08c from OSDumpContext */
+
/* 0x325 */ uint8_t attr; /* Thread affinity (bits 0-2) and flags */
−
uint32_t ctr; /* 0x090 from context switch code */
+
/* 0x326 */ int16_t threadId;
−
uint32_t xer; /* 0x094 from context switch code */
+
/* 0x328 */ int32_t suspend; /* suspend counter, thread is suspended if greater zero */
−
uint32_t srr0; /* 0x098 from OSDumpContext */
+
/* 0x32C */ int32_t priority; /* effective priority */
−
uint32_t srr1; /* 0x09c from OSDumpContext */
+
/* 0x330 */ int32_t base; /* base priority, set on thread creation or via OSSetThreadPriority */
−
char _unknowna0[0xb8 - 0xa0];
+
/* 0x334 */ int32_t val; /* thread exit value */
−
uint64_t fpr[32]; /* 0x0b8 from OSDumpContext */
+
/* 0x338 */ void* runQueue[3];
−
int16_t spinLockCount; /* 0x1b8 from OSDumpContext */
+
/* 0x344 */ OSThreadLink linkRun[3];
−
char _unknown1ba[0x1bc - 0x1ba]; /* 0x1ba could genuinely be padding? */
+
/* 0x35C */ void* queue;
−
uint32_t gqr[8]; /* 0x1bc from OSDumpContext */
+
/* 0x360 */ OSThreadLink link;
−
char _unknown1dc[0x1e0 - 0x1dc];
+
/* 0x368 */ OSThreadQueue queueJoin;
−
uint64_t psf[32]; /* 0x1e0 from OSDumpContext */
+
/* 0x378 */ void* mutex;
−
int64_t coretime[3]; /* 0x2e0 from OSDumpContext */
+
/* 0x37C */ OSMutexQueue queueMutex;
−
int64_t starttime; /* 0x2f8 from OSDumpContext */
+
/* 0x38C */ OSThreadLink linkActive;
−
int32_t error; /* 0x300 from OSDumpContext */
+
/* 0x394 */ void* stackBase; /* high addr of stack area */
−
char _unknown304[0x6a0 - 0x304];
+
/* 0x398 */ void* stackEnd; /* low addr of stack area */
−
} OSThread; /* 0x6a0 total length from RAM dumps */
+
/* 0x39C */ void* entryPoint; /* initial entry point */
+
/* 0x3A0 */ __crt crt; /* used by GHS runtime */
+
/* 0x578 */ int32_t _unused578;
+
/* 0x57C */ void* specific[16]; /* used by OSSetThreadSpecific/OSGetThreadSpecific */
+
/* 0x5BC */ int32_t type; /* thread type (0 driver, 1 I/O, 2 application) */
+
/* 0x5C0 */ char* name;
+
/* 0x5C4 */ void* waitAlarm;
+
/* 0x5C8 */ void* userStackPointer; /* initial stack pointer */
+
/* 0x5CC */ void* cleanupCallback;
+
/* 0x5D0 */ void(*deallocator)(OSThread* t, void* stack) /* called on thread termination */
+
/* 0x5D4 */ uint32_t cancelState;
+
/* 0x5D8 */ uint32_t requestFlag; /* flags for state change request after timeslice finished */
+
/* 0x5DC */ int32_t pendingSuspend;
+
/* 0x5E0 */ int32_t suspendResult;
+
/* 0x5E4 */ OSThreadQueue suspendQueue;
+
/* 0x5F4 */ uint32_t _padding5F4;
+
/* 0x5F8 */ uint64_t quantum; /* set by OSSetThreadRunQuantum, defines how long the thread will run before being rescheduled */
+
/* 0x600 */ uint64_t _unknown600;
+
/* 0x608 */ uint64_t wakeCount;
+
/* 0x610 */ uint64_t _unknown610;
+
/* 0x618 */ uint64_t awakeTimeSum;
+
/* 0x620 */ uint64_t _unknown620;
+
/* 0x628 */ uint64_t _unknown628;
+
/* 0x630 */ char _unknown630[0x6a0 - 0x630];
+
} OSThread; /* 0x6a0 total length */
</syntaxhighlight>
</syntaxhighlight>
|}
|}