mirror of
https://github.com/zeldaret/oot
synced 2026-06-05 03:08:05 -04:00
174af7384d
* cleanup libultra * fixes - use quotes instead of <> for includes - add macros for zelda specific thread priorities - fix Makefile - properly format the remaining pfs structs * fix button macros + add CHECK_BTN_ANY/CHECK_BTN_ALL * remove ULTRA_ABS * fix includes * update z_player.c/z_lib.c + run format.sh * merge upstream/master * fix include in En_Goroiwa * fix includes
34 lines
1012 B
C
34 lines
1012 B
C
#include "global.h"
|
|
|
|
OSThread* __osThreadTail[2] = { NULL, (OSThread*)-1 };
|
|
OSThread* __osRunQueue = __osThreadTail;
|
|
OSThread* __osActiveQueue = __osThreadTail;
|
|
OSThread* __osRunningThread = NULL;
|
|
OSThread* __osFaultedThread = NULL;
|
|
|
|
void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri) {
|
|
register u32 s0;
|
|
u32 t8;
|
|
|
|
thread->id = id;
|
|
thread->priority = pri;
|
|
thread->next = (struct OSThread_s*)NULL;
|
|
thread->queue = (struct OSThread_s**)NULL;
|
|
thread->context.pc = (u32)entry;
|
|
thread->context.a0 = (u64)arg;
|
|
thread->context.sp = (u64)sp - 16;
|
|
thread->context.ra = (u64)__osCleanupThread;
|
|
t8 = 0x3FFF01;
|
|
thread->context.sr = (t8 & 0xFF01) | 2;
|
|
thread->context.rcp = (t8 & 0x3F0000) >> 16;
|
|
thread->context.fpcsr = 0x01000800;
|
|
thread->fp = 0;
|
|
thread->state = 1;
|
|
thread->flags = 0;
|
|
|
|
s0 = __osDisableInt();
|
|
thread->tlnext = __osActiveQueue;
|
|
__osActiveQueue = thread;
|
|
__osRestoreInt(s0);
|
|
}
|