Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
os_thread.h
Go to the documentation of this file.
1 #ifndef _ULTRA64_THREAD_H_
2 #define _ULTRA64_THREAD_H_
3 
4 /* Recommended priorities for system threads */
5 #define OS_PRIORITY_MAX 255
6 #define OS_PRIORITY_VIMGR 254
7 #define OS_PRIORITY_RMON 250
8 #define OS_PRIORITY_RMONSPIN 200
9 #define OS_PRIORITY_PIMGR 150
10 #define OS_PRIORITY_SIMGR 140
11 #define OS_PRIORITY_APPMAX 127
12 #define OS_PRIORITY_IDLE 0
13 
14 #define OS_STATE_STOPPED 1
15 #define OS_STATE_RUNNABLE 2
16 #define OS_STATE_RUNNING 4
17 #define OS_STATE_WAITING 8
18 
19 /* Types */
20 
21 typedef s32 OSPri;
22 typedef s32 OSId;
23 
24 typedef union
25 {
26  struct {f32 f_odd; f32 f_even;} f;
27 } __OSfp;
28 
29 typedef struct
30 {
31  /* registers */
32  /*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
33  /*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
34  /*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
35  /*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
36  /*0x108*/ u64 lo, hi;
37  /*0x118*/ u32 sr, pc, cause, badvaddr, rcp;
38  /*0x12C*/ u32 fpcsr;
39  __OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
40  __OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
42 
43 typedef struct
44 {
49 
50 typedef struct OSThread_s
51 {
52  /*0x00*/ struct OSThread_s *next;
53  /*0x04*/ OSPri priority;
54  /*0x08*/ struct OSThread_s **queue;
55  /*0x0C*/ struct OSThread_s *tlnext;
56  /*0x10*/ u16 state;
57  /*0x12*/ u16 flags;
58  /*0x14*/ OSId id;
59  /*0x18*/ int fp;
62 } OSThread;
63 
64 
65 /* Functions */
66 
67 void osCreateThread(OSThread *thread, OSId id, void (*entry)(void *),
68  void *arg, void *sp, OSPri pri);
69 OSId osGetThreadId(OSThread *thread);
71 void osSetThreadPri(OSThread *thread, OSPri pri);
72 void osStartThread(OSThread *thread);
73 void osStopThread(OSThread *thread);
74 
75 #endif
u32 sr
Definition: os_thread.h:37
signed char s8
Definition: ultratypes.h:11
s32 OSPri
Definition: os_thread.h:21
unsigned short int u16
Definition: ultratypes.h:14
s32 OSId
Definition: os_thread.h:22
void osStopThread(OSThread *thread)
Definition: os_thread.h:43
int fp
Definition: os_thread.h:59
u16 flags
Definition: os_thread.h:57
u64 time
Definition: os_thread.h:47
u32 flag
Definition: os_thread.h:45
void osStartThread(OSThread *thread)
Definition: osStartThread.c:4
unsigned long long int u64
Definition: ultratypes.h:18
OSPri osGetThreadPri(OSThread *thread)
Definition: osGetThreadPri.c:5
__OSThreadContext context
Definition: os_thread.h:61
__OSfp fp30
Definition: os_thread.h:40
float f32
Definition: ultratypes.h:29
struct OSThread_s * next
Definition: os_thread.h:52
OSId osGetThreadId(OSThread *thread)
u64 t7
Definition: os_thread.h:33
u64 lo
Definition: os_thread.h:36
u64 t9
Definition: os_thread.h:35
void osSetThreadPri(OSThread *thread, OSPri pri)
Definition: osSetThreadPri.c:6
u64 v1
Definition: os_thread.h:32
struct OSThread_s OSThread
u16 state
Definition: os_thread.h:56
f32 f_odd
Definition: os_thread.h:26
void osCreateThread(OSThread *thread, OSId id, void(*entry)(void *), void *arg, void *sp, OSPri pri)
Definition: osCreateThread.c:10
u32 fpcsr
Definition: os_thread.h:38
Definition: os_thread.h:50
Definition: os_thread.h:24
u64 s7
Definition: os_thread.h:34
OSPri priority
Definition: os_thread.h:53
signed int s32
Definition: ultratypes.h:15
Definition: os_thread.h:29
__OSfp fp8
Definition: os_thread.h:39
struct OSThread_s ** queue
Definition: os_thread.h:54
OSId id
Definition: os_thread.h:58
u32 count
Definition: os_thread.h:46
unsigned int u32
Definition: ultratypes.h:16
struct OSThread_s * tlnext
Definition: os_thread.h:55
__OSThreadprofile_s * thprof
Definition: os_thread.h:60