Decompile osYieldThread

This commit is contained in:
Ryan Dwyer 2021-01-26 22:57:31 +10:00
parent e5be999d06
commit b9d20f4175
4 changed files with 11 additions and 25 deletions

View File

@ -76,6 +76,7 @@ $(B_DIR)/lib/ultra/io/visetevent.o: OPT_LVL := -O1
$(B_DIR)/lib/ultra/os/destroythread.o: OPT_LVL := -O1
$(B_DIR)/lib/ultra/os/resetglobalintmask.o: OPT_LVL := -O1
$(B_DIR)/lib/ultra/os/thread.o: OPT_LVL := -O1
$(B_DIR)/lib/ultra/os/yieldthread.o: OPT_LVL := -O1
CFLAGS = -DVERSION=$(VERSION) \
-DNTSC=$(NTSC) \

View File

@ -2289,7 +2289,7 @@ u32 var80060928 = 0x00000000;
u32 var8006092c = 0x00000000;
u32 __osThreadTail = 0x00000000;
u32 var80060934 = 0xffffffff;
u32 __osRunQueue = (u32) &__osThreadTail;
OSThread *__osRunQueue = (OSThread *)&__osThreadTail;
OSThread *__osActiveQueue = (OSThread *)&__osThreadTail;
OSThread *__osRunningThread = NULL;
u32 var80060944 = 0x00000000;

View File

@ -184,7 +184,7 @@ extern __OSViContext *__osViCurr;
extern __OSViContext *__osViNext;
extern u32 __osPiAccessQueueEnabled;
extern u32 __osThreadTail;
extern u32 __osRunQueue;
extern OSThread *__osRunQueue;
extern OSThread *__osActiveQueue;
extern OSThread *__osRunningThread;
extern u32 var80060970;

View File

@ -1,25 +1,10 @@
#include <libultra_internal.h>
#include "game/data/data_000000.h"
GLOBAL_ASM(
glabel osYieldThread
/* 51c10: 27bdffd8 */ addiu $sp,$sp,-40
/* 51c14: afbf001c */ sw $ra,0x1c($sp)
/* 51c18: 0c01256c */ jal __osDisableInt
/* 51c1c: afb00018 */ sw $s0,0x18($sp)
/* 51c20: 3c0f8006 */ lui $t7,%hi(__osRunningThread)
/* 51c24: 8def0940 */ lw $t7,%lo(__osRunningThread)($t7)
/* 51c28: 240e0002 */ addiu $t6,$zero,0x2
/* 51c2c: 3c048006 */ lui $a0,%hi(__osRunQueue)
/* 51c30: 00408025 */ or $s0,$v0,$zero
/* 51c34: 24840938 */ addiu $a0,$a0,%lo(__osRunQueue)
/* 51c38: 0c000ee8 */ jal __osEnqueueAndYield
/* 51c3c: a5ee0010 */ sh $t6,0x10($t7)
/* 51c40: 0c012588 */ jal __osRestoreInt
/* 51c44: 02002025 */ or $a0,$s0,$zero
/* 51c48: 8fbf001c */ lw $ra,0x1c($sp)
/* 51c4c: 8fb00018 */ lw $s0,0x18($sp)
/* 51c50: 27bd0028 */ addiu $sp,$sp,0x28
/* 51c54: 03e00008 */ jr $ra
/* 51c58: 00000000 */ nop
/* 51c5c: 00000000 */ nop
);
void osYieldThread(void)
{
register u32 saveMask = __osDisableInt();
__osRunningThread->state = OS_STATE_RUNNABLE;
__osEnqueueAndYield(&__osRunQueue);
__osRestoreInt(saveMask);
}