Decompile {g,s}etthreadpri.c

This commit is contained in:
rozlette 2018-10-25 23:54:24 -05:00
parent 21b019c010
commit 991bd83ea5
3 changed files with 37 additions and 2 deletions

View File

@ -99,8 +99,8 @@ SECTIONS
build/asm/si.o(.text)
build/asm/boot_0x8008FA60.o(.text)
build/src/libultra/os/jammesg.o(.text)
build/asm/setthreadpri.o(.text)
build/asm/getthreadpri.o(.text)
build/src/libultra/os/setthreadpri.o(.text)
build/src/libultra/os/getthreadpri.o(.text)
build/asm/boot_0x8008FD00.o(.text)
build/asm/boot_0x8008FE60.o(.text)
build/asm/boot_0x8008FEB0.o(.text)

View File

@ -0,0 +1,8 @@
#include <osint.h>
OSPri osGetThreadPri(OSThread* t) {
if (t == NULL) {
t = __osRunningThread;
}
return t->priority;
}

View File

@ -0,0 +1,27 @@
#include <osint.h>
void osSetThreadPri(OSThread* t, OSPri p) {
register u32 saveMask;
saveMask = __osDisableInt();
if (t == NULL) {
t = __osRunningThread;
}
if (t->priority != p) {
t->priority = p;
if (t != __osRunningThread && t->state != 1) {
__osDequeueThread(t->queue, t);
__osEnqueueThread(t->queue, t);
}
if (__osRunningThread->priority < __osRunQueue->priority) {
__osRunningThread->state = 2;
__osEnqueueAndYield(&__osRunQueue);
}
}
__osRestoreInt(saveMask);
}