SSBM Decomp
Loading...
Searching...
No Matches
OSThread.c File Reference
#include <dolphin.h>
#include "__os.h"
#include <dolphin/os.h>

Macros

#define ENQUEUE_THREAD(thread, queue, link)
#define DEQUEUE_THREAD(thread, queue, link)
#define ENQUEUE_THREAD_PRIO(thread, queue, link)
#define DEQUEUE_HEAD(thread, queue, link)
#define ALIGN4(val)
#define ALIGN8(val)
#define ASSERTREPORT(line, cond)

Functions

static void OSInitMutexQueue (struct OSMutexQueue *queue)
void OSInitThreadQueue (struct OSThreadQueue *queue)
struct OSThreadOSGetCurrentThread ()
static void __OSSwitchThread (struct OSThread *nextThread)
int OSIsThreadSuspended (struct OSThread *thread)
int OSIsThreadTerminated (struct OSThread *thread)
static int __OSIsThreadActive (struct OSThread *thread)
long OSDisableScheduler ()
long OSEnableScheduler ()
static void SetRun (struct OSThread *thread)
static void UnsetRun (struct OSThread *thread)
static struct OSThreadSetEffectivePriority (struct OSThread *thread, long priority)
static void UpdatePriority (struct OSThread *thread)
static struct OSThreadSelectThread (int yield)
void OSYieldThread (void)
void OSExitThread (void *val)
void OSCancelThread (struct OSThread *thread)
int OSJoinThread (struct OSThread *thread, void *val)
void OSDetachThread (struct OSThread *thread)
long OSResumeThread (struct OSThread *thread)
void OSSleepThread (struct OSThreadQueue *queue)
void OSWakeupThread (struct OSThreadQueue *queue)
int OSSetThreadPriority (struct OSThread *thread, long priority)
long OSGetThreadPriority (struct OSThread *thread)
struct OSThreadOSSetIdleFunction (void(*idleFunction)(void *), void *param, void *stack, unsigned long stackSize)
struct OSThreadOSGetIdleFunction ()
static int CheckThreadQueue (struct OSThreadQueue *queue)
static int IsMember (struct OSThreadQueue *queue, struct OSThread *thread)
long OSCheckActiveThreads ()
void __OSThreadInit ()
long __OSGetEffectivePriority (struct OSThread *thread)
void __OSPromoteThread (struct OSThread *thread, long priority)
void __OSReschedule (void)
int OSCreateThread (struct OSThread *thread, void *(*func)(void *), void *param, void *stack, unsigned long stackSize, long priority, unsigned short attr)
long OSSuspendThread (struct OSThread *thread)

Variables

unsigned char _stack_end []
unsigned char _stack_addr []
static struct OSThreadQueue RunQueue [32]
static struct OSThread IdleThread
static struct OSThread DefaultThread
static struct OSContext IdleContext
static volatile unsigned long RunQueueBits
static volatile int RunQueueHint
static long Reschedule

Macro Definition Documentation

◆ ENQUEUE_THREAD

#define ENQUEUE_THREAD ( thread,
queue,
link )
Value:
do { \
struct OSThread* __prev = (queue)->tail; \
if (__prev == NULL) { \
(queue)->head = (thread); \
} else { \
__prev->link.next = (thread); \
} \
(thread)->link.prev = __prev; \
(thread)->link.next = 0; \
(queue)->tail = (thread); \
} while (0);
#define NULL
Definition stddef.h:19
Definition OSThread.h:34
struct OSThreadLink link
Definition OSThread.h:43

◆ DEQUEUE_THREAD

#define DEQUEUE_THREAD ( thread,
queue,
link )
Value:
do { \
struct OSThread* __next = (thread)->link.next; \
struct OSThread* __prev = (thread)->link.prev; \
if (__next == NULL) { \
(queue)->tail = __prev; \
} else { \
__next->link.prev = __prev; \
} \
if (__prev == NULL) { \
(queue)->head = __next; \
} else { \
__prev->link.next = __next; \
} \
} while (0);

◆ ENQUEUE_THREAD_PRIO

#define ENQUEUE_THREAD_PRIO ( thread,
queue,
link )
Value:
do { \
struct OSThread* __prev; \
struct OSThread* __next; \
for (__next = (queue)->head; \
__next && (__next->priority <= (thread)->priority); \
__next = __next->link.next); \
\
if (__next == NULL) { \
ENQUEUE_THREAD(thread, queue, link); \
} else { \
(thread)->link.next = __next; \
__prev = __next->link.prev; \
__next->link.prev = (thread); \
(thread)->link.prev = __prev; \
if (__prev == NULL) { \
(queue)->head = (thread); \
} else { \
__prev->link.next = (thread); \
} \
} \
} while (0);
OSPriority priority
Definition OSThread.h:39

◆ DEQUEUE_HEAD

#define DEQUEUE_HEAD ( thread,
queue,
link )
Value:
do { \
struct OSThread* __next = thread->link.next; \
if (__next == NULL) { \
(queue)->tail = 0; \
} else { \
__next->link.prev = 0; \
} \
(queue)->head = __next; \
} while (0);

◆ ALIGN4

#define ALIGN4 ( val)
Value:
(((val) + 0x3) & ~0x3)

◆ ALIGN8

#define ALIGN8 ( val)
Value:
(((val) + 0x7) & ~0x7)

◆ ASSERTREPORT

#define ASSERTREPORT ( line,
cond )
Value:
if (!(cond)) { \
OSReport("OSCheckActiveThreads: Failed " #cond " in %d\n", line); \
OSPanic(__FILE__, line, ""); \
}

Function Documentation

◆ OSInitMutexQueue()

void OSInitMutexQueue ( struct OSMutexQueue * queue)
static

◆ OSInitThreadQueue()

void OSInitThreadQueue ( struct OSThreadQueue * queue)

◆ OSGetCurrentThread()

struct OSThread * OSGetCurrentThread ( void )

◆ __OSSwitchThread()

void __OSSwitchThread ( struct OSThread * nextThread)
static

◆ OSIsThreadSuspended()

int OSIsThreadSuspended ( struct OSThread * thread)

◆ OSIsThreadTerminated()

int OSIsThreadTerminated ( struct OSThread * thread)

◆ __OSIsThreadActive()

int __OSIsThreadActive ( struct OSThread * thread)
static

◆ OSDisableScheduler()

long OSDisableScheduler ( void )

◆ OSEnableScheduler()

long OSEnableScheduler ( void )

◆ SetRun()

void SetRun ( struct OSThread * thread)
static

◆ UnsetRun()

void UnsetRun ( struct OSThread * thread)
static

◆ SetEffectivePriority()

struct OSThread * SetEffectivePriority ( struct OSThread * thread,
long priority )
static

◆ UpdatePriority()

void UpdatePriority ( struct OSThread * thread)
static

◆ SelectThread()

struct OSThread * SelectThread ( int yield)
static

◆ OSYieldThread()

void OSYieldThread ( void )

◆ OSExitThread()

void OSExitThread ( void * val)

◆ OSCancelThread()

void OSCancelThread ( struct OSThread * thread)

◆ OSJoinThread()

int OSJoinThread ( struct OSThread * thread,
void * val )

◆ OSDetachThread()

void OSDetachThread ( struct OSThread * thread)

◆ OSResumeThread()

long OSResumeThread ( struct OSThread * thread)

◆ OSSleepThread()

void OSSleepThread ( struct OSThreadQueue * queue)

◆ OSWakeupThread()

void OSWakeupThread ( struct OSThreadQueue * queue)

◆ OSSetThreadPriority()

int OSSetThreadPriority ( struct OSThread * thread,
long priority )

◆ OSGetThreadPriority()

long OSGetThreadPriority ( struct OSThread * thread)

◆ OSSetIdleFunction()

struct OSThread * OSSetIdleFunction ( void(* idleFunction )(void *),
void * param,
void * stack,
unsigned long stackSize )

◆ OSGetIdleFunction()

struct OSThread * OSGetIdleFunction ( )

◆ CheckThreadQueue()

int CheckThreadQueue ( struct OSThreadQueue * queue)
static

◆ IsMember()

int IsMember ( struct OSThreadQueue * queue,
struct OSThread * thread )
static

◆ OSCheckActiveThreads()

long OSCheckActiveThreads ( void )

◆ __OSThreadInit()

void __OSThreadInit ( void )

◆ __OSGetEffectivePriority()

long __OSGetEffectivePriority ( struct OSThread * thread)

◆ __OSPromoteThread()

void __OSPromoteThread ( struct OSThread * thread,
long priority )

◆ __OSReschedule()

void __OSReschedule ( void )

◆ OSCreateThread()

int OSCreateThread ( struct OSThread * thread,
void *(* func )(void *),
void * param,
void * stack,
unsigned long stackSize,
long priority,
unsigned short attr )

◆ OSSuspendThread()

long OSSuspendThread ( struct OSThread * thread)

Variable Documentation

◆ _stack_end

unsigned char _stack_end[]
extern

◆ _stack_addr

unsigned char _stack_addr[]
extern

◆ RunQueue

struct OSThreadQueue RunQueue[32]
static

◆ IdleThread

struct OSThread IdleThread
static

◆ DefaultThread

struct OSThread DefaultThread
static

◆ IdleContext

struct OSContext IdleContext
static

◆ RunQueueBits

volatile unsigned long RunQueueBits
static

◆ RunQueueHint

volatile int RunQueueHint
static

◆ Reschedule

long Reschedule
static