mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-07 21:10:53 -04:00
cleanup a lot of os files
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "ultratypes.h"
|
||||
#include "os_cont.h"
|
||||
#include "os_pfs.h"
|
||||
#include "rcp.h"
|
||||
|
||||
#define CHNL_ERR(format) (((format).rxsize & CHNL_ERR_MASK) >> 4)
|
||||
|
||||
@@ -152,7 +153,7 @@ typedef struct {
|
||||
/* 0x05 */ u8 typel;
|
||||
/* 0x06 */ u8 status;
|
||||
/* 0x07 */ u8 align1;
|
||||
} __OSContRequestHeader; // size = 0x8
|
||||
} __OSContRequesFormat; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 txsize;
|
||||
|
||||
+4
-4
@@ -1,16 +1,16 @@
|
||||
#ifndef ALIGNMENT_H
|
||||
#define ALIGNMENT_H
|
||||
|
||||
#include "attributes.h"
|
||||
|
||||
#define ALIGN8(val) (((val) + 7) & ~7)
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
#define ALIGN32(val) (((val) + 0x1F) & ~0x1F)
|
||||
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)
|
||||
#define ALIGN256(val) (((val) + 0xFF) & ~0xFF)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define ALIGNED8 __attribute__ ((aligned (8)))
|
||||
#else
|
||||
#define ALIGNED8
|
||||
#ifndef ALIGNED
|
||||
#define ALIGNED(x) __attribute__ ((aligned (x)))
|
||||
#endif
|
||||
|
||||
#ifdef __sgi /* IDO compiler */
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef ATTRIBUTES_H
|
||||
#define ATTRIBUTES_H
|
||||
|
||||
#if (!defined(__GNUC__) && !defined(__clang__)) || defined(M2CTX) || defined(__sgi)
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -48,7 +48,7 @@ beginseg
|
||||
include "build/asm/boot/setcause.text.o"
|
||||
include "build/src/libultra/os/sendmesg.o"
|
||||
include "build/src/libultra/io/pfsfreeblocks.o"
|
||||
include "build/src/libultra/os/viextend.o"
|
||||
include "build/src/libultra/io/viextendvstart.o"
|
||||
include "build/src/libultra/os/stopthread.o"
|
||||
include "build/src/libultra/os/recvmesg.o"
|
||||
include "build/asm/boot/setintmask.text.o"
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
u32 __osFlashID[4] ALIGNED8;
|
||||
OSIoMesg __osFlashMsg ALIGNED8;
|
||||
OSMesgQueue __osFlashMessageQ ALIGNED8;
|
||||
OSPiHandle __osFlashHandler ALIGNED8;
|
||||
u32 __osFlashID[4] ALIGNED(8);
|
||||
OSIoMesg __osFlashMsg ALIGNED(8);
|
||||
OSMesgQueue __osFlashMessageQ ALIGNED(8);
|
||||
OSPiHandle __osFlashHandler ALIGNED(8);
|
||||
OSMesg __osFlashMsgBuf[1];
|
||||
s32 __osFlashVersion;
|
||||
UNK_TYPE1 D_801FD0FC[0x14];
|
||||
|
||||
@@ -50,14 +50,14 @@ s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) {
|
||||
|
||||
void __osContGetInitData(u8* pattern, OSContStatus* data) {
|
||||
u8* ptr;
|
||||
__OSContRequestHeader requestHeader;
|
||||
__OSContRequesFormat requestHeader;
|
||||
s32 i;
|
||||
u8 bits;
|
||||
|
||||
bits = 0;
|
||||
ptr = (u8*)__osContPifRam.ramarray;
|
||||
for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(requestHeader), data++) {
|
||||
requestHeader = *(__OSContRequestHeader*)ptr;
|
||||
requestHeader = *(__OSContRequesFormat*)ptr;
|
||||
data->errno = (requestHeader.rxsize & 0xC0) >> 4;
|
||||
if (data->errno == 0) {
|
||||
data->type = requestHeader.typel << 8 | requestHeader.typeh;
|
||||
@@ -71,7 +71,7 @@ void __osContGetInitData(u8* pattern, OSContStatus* data) {
|
||||
|
||||
void __osPackRequestData(u8 poll) {
|
||||
u8* ptr;
|
||||
__OSContRequestHeader requestHeader;
|
||||
__OSContRequesFormat requestHeader;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(__osContPifRam.ramarray); i++) {
|
||||
@@ -90,7 +90,7 @@ void __osPackRequestData(u8 poll) {
|
||||
requestHeader.align1 = 255;
|
||||
|
||||
for (i = 0; i < __osMaxControllers; i++) {
|
||||
*(__OSContRequestHeader*)ptr = requestHeader;
|
||||
*(__OSContRequesFormat*)ptr = requestHeader;
|
||||
ptr += sizeof(requestHeader);
|
||||
}
|
||||
*ptr = 254;
|
||||
|
||||
+18
-15
@@ -1,6 +1,9 @@
|
||||
#include "PR/os_pfs.h"
|
||||
#include "PR/controller.h"
|
||||
#include "global.h"
|
||||
#include "PR/siint.h"
|
||||
#include "alignment.h"
|
||||
|
||||
OSPifRam __osPfsPifRam ALIGNED(16);
|
||||
|
||||
void __osPfsRequestData(u8 poll);
|
||||
void __osPfsGetInitData(u8* pattern, OSContStatus* contData);
|
||||
@@ -50,40 +53,40 @@ s32 osPfsIsPlug(OSMesgQueue* mq, u8* pattern) {
|
||||
|
||||
void __osPfsRequestData(u8 poll) {
|
||||
u8* bufPtr = (u8*)&__osPfsPifRam;
|
||||
__OSContRequestHeader req;
|
||||
__OSContRequesFormat req;
|
||||
s32 i;
|
||||
|
||||
__osContLastPoll = poll;
|
||||
|
||||
__osPfsPifRam.status = 1;
|
||||
__osPfsPifRam.status = CONT_CMD_EXE;
|
||||
|
||||
req.align = 0xFF;
|
||||
req.txsize = 1;
|
||||
req.rxsize = 3;
|
||||
req.align = CONT_CMD_NOP;
|
||||
req.txsize = CONT_CMD_REQUEST_STATUS_TX;
|
||||
req.rxsize = CONT_CMD_REQUEST_STATUS_RX;
|
||||
req.poll = poll;
|
||||
req.typeh = 0xFF;
|
||||
req.typel = 0xFF;
|
||||
req.status = 0xFF;
|
||||
req.align1 = 0xFF;
|
||||
req.typeh = CONT_CMD_NOP;
|
||||
req.typel = CONT_CMD_NOP;
|
||||
req.status = CONT_CMD_NOP;
|
||||
req.align1 = CONT_CMD_NOP;
|
||||
|
||||
for (i = 0; i < __osMaxControllers; i++) {
|
||||
*((__OSContRequestHeader*)bufPtr) = req;
|
||||
bufPtr += sizeof(req);
|
||||
*((__OSContRequesFormat*)bufPtr) = req;
|
||||
bufPtr += sizeof(__OSContRequesFormat);
|
||||
}
|
||||
*((u8*)bufPtr) = CONT_CMD_END;
|
||||
}
|
||||
|
||||
void __osPfsGetInitData(u8* pattern, OSContStatus* contData) {
|
||||
u8* bufptr;
|
||||
__OSContRequestHeader req;
|
||||
__OSContRequesFormat req;
|
||||
s32 i;
|
||||
u8 bits = 0;
|
||||
|
||||
bufptr = (u8*)&__osPfsPifRam;
|
||||
|
||||
for (i = 0; i < __osMaxControllers; i++, bufptr += sizeof(req), contData++) {
|
||||
req = *((__OSContRequestHeader*)bufptr);
|
||||
contData->errno = ((req.rxsize & 0xC0) >> 4);
|
||||
req = *((__OSContRequesFormat*)bufptr);
|
||||
contData->errno = CHNL_ERR(req);
|
||||
|
||||
if (contData->errno) {
|
||||
continue;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#include "global.h"
|
||||
#include "stack.h"
|
||||
|
||||
OSPiHandle __Dom1SpeedParam ALIGNED8;
|
||||
OSPiHandle __Dom2SpeedParam ALIGNED8;
|
||||
OSPiHandle __Dom1SpeedParam ALIGNED(8);
|
||||
OSPiHandle __Dom2SpeedParam ALIGNED(8);
|
||||
OSThread sPiMgrThread;
|
||||
STACK(sPiMgrStack, 0x1000);
|
||||
OSMesgQueue piEventQueue ALIGNED8;
|
||||
OSMesgQueue piEventQueue ALIGNED(8);
|
||||
OSMesg piEventBuf[1];
|
||||
|
||||
OSDevMgr __osPiDevMgr = { 0 };
|
||||
OSPiHandle* __osPiTable = NULL;
|
||||
OSPiHandle* __osCurrentHandle[2] ALIGNED8 = { &__Dom1SpeedParam, &__Dom2SpeedParam };
|
||||
OSPiHandle* __osCurrentHandle[2] ALIGNED(8) = { &__Dom1SpeedParam, &__Dom2SpeedParam };
|
||||
|
||||
void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt) {
|
||||
u32 savedMask;
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
#define STEP 0x100000
|
||||
#define SIZE_4MB 0x400000
|
||||
#define SIZE_8MB 0x800000
|
||||
|
||||
u32 osGetMemSize(void) {
|
||||
u32* spC;
|
||||
u32 sp8;
|
||||
u32 sp4;
|
||||
u32 sp0;
|
||||
vu32* ptr;
|
||||
u32 size = SIZE_4MB;
|
||||
u32 data0;
|
||||
u32 data1;
|
||||
|
||||
sp8 = 0x400000;
|
||||
while (size < SIZE_8MB) {
|
||||
ptr = (vu32*)(K1BASE + size);
|
||||
|
||||
do {
|
||||
spC = (u32*)(sp8 + 0xA0000000);
|
||||
sp4 = *(u32*)(0xA0000000 + sp8);
|
||||
sp0 = *(u32*)(0xA00FFFFC + sp8);
|
||||
*(u32*)(0xA0000000 + sp8) = *(u32*)(0xA0000000 + sp8) ^ 0xFFFFFFFF;
|
||||
spC[0x000FFFFC / 4] = spC[0x000FFFFC / 4] ^ 0xFFFFFFFF;
|
||||
data0 = *ptr;
|
||||
data1 = ptr[STEP / 4 - 1];
|
||||
|
||||
if ((spC[0] != (sp4 ^ 0xFFFFFFFF)) || (spC[0x000FFFFC / 4] != (sp0 ^ 0xFFFFFFFF))) {
|
||||
return sp8;
|
||||
*ptr ^= ~0;
|
||||
ptr[STEP / 4 - 1] ^= ~0;
|
||||
|
||||
if ((*ptr != (data0 ^ ~0)) || (ptr[STEP / 4 - 1] != (data1 ^ ~0))) {
|
||||
return size;
|
||||
}
|
||||
|
||||
*spC = sp4;
|
||||
spC[0x000FFFFC / 4] = sp0;
|
||||
sp8 = sp8 + 0x100000;
|
||||
} while (sp8 < 0x800000);
|
||||
*ptr = data0;
|
||||
ptr[STEP / 4 - 1] = data1;
|
||||
|
||||
return sp8;
|
||||
size += STEP;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
OSId osGetThreadId(OSThread* t) {
|
||||
if (t == NULL) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
OSPri osGetThreadPri(OSThread* t) {
|
||||
if (t == NULL) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
OSTime osGetTime(void) {
|
||||
u32 CurrentCount;
|
||||
u32 elapseCount;
|
||||
OSTime sp28;
|
||||
OSTime currentCount;
|
||||
register u32 savedMask;
|
||||
|
||||
savedMask = __osDisableInt();
|
||||
|
||||
CurrentCount = osGetCount();
|
||||
elapseCount = CurrentCount - __osBaseCounter;
|
||||
sp28 = __osCurrentTime;
|
||||
currentCount = __osCurrentTime;
|
||||
|
||||
__osRestoreInt(savedMask);
|
||||
|
||||
return elapseCount + sp28;
|
||||
return elapseCount + currentCount;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
#include "libc/stdbool.h"
|
||||
|
||||
#define COLD_RESET 0
|
||||
|
||||
@@ -41,9 +42,9 @@ void __osInitialize_common(void) {
|
||||
__osSetFpcCsr(FPCSR_FS | FPCSR_EV);
|
||||
__osSetWatchLo(0x04900000);
|
||||
|
||||
while (__osSiRawReadIo(0x1FC007FC, &pifdata)) {}
|
||||
while (__osSiRawReadIo(PIF_RAM_END - 3, &pifdata)) {}
|
||||
|
||||
while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) {}
|
||||
while (__osSiRawWriteIo(PIF_RAM_END - 3, pifdata | 8)) {}
|
||||
|
||||
*(__osExceptionVector*)UT_VEC = __osExceptionPreamble;
|
||||
*(__osExceptionVector*)XUT_VEC = __osExceptionPreamble;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) {
|
||||
register u32 saveMask;
|
||||
@@ -6,8 +6,8 @@ s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) {
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
while (mq->validCount >= mq->msgCount) {
|
||||
if (flag == 1) {
|
||||
__osRunningThread->state = 8;
|
||||
if (flag == OS_MESG_BLOCK) {
|
||||
__osRunningThread->state = OS_STATE_WAITING;
|
||||
__osEnqueueAndYield(&mq->fullQueue);
|
||||
} else {
|
||||
__osRestoreInt(saveMask);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags) {
|
||||
register u32 saveMask;
|
||||
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
while (mq->validCount == 0) {
|
||||
if (flags == 0) {
|
||||
while (MQ_IS_EMPTY(mq)) {
|
||||
if (flags == OS_MESG_NOBLOCK) {
|
||||
__osRestoreInt(saveMask);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
void __osResetGlobalIntMask(OSHWIntr mask) {
|
||||
register s32 prevInt = __osDisableInt();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags) {
|
||||
register u32 saveMask;
|
||||
@@ -6,9 +6,9 @@ s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags) {
|
||||
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
while (mq->validCount >= mq->msgCount) {
|
||||
if (flags == 1) {
|
||||
__osRunningThread->state = 8;
|
||||
while (MQ_IS_FULL(mq)) {
|
||||
if (flags == OS_MESG_BLOCK) {
|
||||
__osRunningThread->state = OS_STATE_WAITING;
|
||||
__osEnqueueAndYield(&mq->fullQueue);
|
||||
} else {
|
||||
__osRestoreInt(saveMask);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
#include "PR/osint.h"
|
||||
#include "libc/stdbool.h"
|
||||
#include "alignment.h"
|
||||
|
||||
u32 __osPreNMI = 0;
|
||||
u32 __osPreNMI = false;
|
||||
|
||||
__OSEventState __osEventStateTab[OS_NUM_EVENTS];
|
||||
__OSEventState __osEventStateTab[OS_NUM_EVENTS] ALIGNED(8);
|
||||
|
||||
void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) {
|
||||
register u32 saveMask;
|
||||
@@ -16,11 +18,11 @@ void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) {
|
||||
es->messageQueue = mq;
|
||||
es->message = m;
|
||||
|
||||
if (e == 14) {
|
||||
if ((__osShutdown != 0) && (__osPreNMI == 0)) {
|
||||
if (e == OS_EVENT_PRENMI) {
|
||||
if (__osShutdown && !__osPreNMI) {
|
||||
osSendMesg(mq, m, OS_MESG_NOBLOCK);
|
||||
}
|
||||
__osPreNMI = 1;
|
||||
__osPreNMI = true;
|
||||
}
|
||||
|
||||
__osRestoreInt(saveMask);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
void __osSetGlobalIntMask(OSHWIntr mask) {
|
||||
register s32 prevInt = __osDisableInt();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
void osSetThreadPri(OSThread* thread, OSPri p) {
|
||||
register u32 saveMask;
|
||||
@@ -12,13 +12,13 @@ void osSetThreadPri(OSThread* thread, OSPri p) {
|
||||
if (thread->priority != p) {
|
||||
thread->priority = p;
|
||||
|
||||
if (thread != __osRunningThread && thread->state != 1) {
|
||||
if (thread != __osRunningThread && thread->state != OS_STATE_STOPPED) {
|
||||
__osDequeueThread(thread->queue, thread);
|
||||
__osEnqueueThread(thread->queue, thread);
|
||||
}
|
||||
|
||||
if (__osRunningThread->priority < __osRunQueue->priority) {
|
||||
__osRunningThread->state = 2;
|
||||
__osRunningThread->state = OS_STATE_RUNNABLE;
|
||||
__osEnqueueAndYield(&__osRunQueue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
void osSetTime(OSTime ticks) {
|
||||
__osCurrentTime = ticks;
|
||||
|
||||
+17
-19
@@ -1,17 +1,17 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMesg msg) {
|
||||
OSTime tim;
|
||||
OSTimer* spC;
|
||||
u32 sp14;
|
||||
u32 sp10;
|
||||
int osSetTimer(OSTimer* t, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg) {
|
||||
OSTime time;
|
||||
OSTimer* next;
|
||||
u32 count;
|
||||
u32 value;
|
||||
u32 saveMask;
|
||||
|
||||
t->next = NULL;
|
||||
t->prev = NULL;
|
||||
t->interval = interval;
|
||||
if (value != 0) {
|
||||
t->value = value;
|
||||
if (countdown != 0) {
|
||||
t->value = countdown;
|
||||
} else {
|
||||
t->value = interval;
|
||||
}
|
||||
@@ -20,21 +20,19 @@ int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMes
|
||||
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
if (__osTimerList->next != __osTimerList) {
|
||||
//! FAKE:
|
||||
if (1) {}
|
||||
|
||||
spC = __osTimerList->next;
|
||||
sp14 = osGetCount();
|
||||
sp10 = sp14 - __osTimerCounter;
|
||||
if (sp10 < spC->value) {
|
||||
spC->value -= sp10;
|
||||
if (__osTimerList->next == __osTimerList) {
|
||||
} else {
|
||||
next = __osTimerList->next;
|
||||
count = osGetCount();
|
||||
value = count - __osTimerCounter;
|
||||
if (value < next->value) {
|
||||
next->value -= value;
|
||||
} else {
|
||||
spC->value = 1;
|
||||
next->value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
tim = __osInsertTimer(t);
|
||||
time = __osInsertTimer(t);
|
||||
__osSetTimerIntr(__osTimerList->next->value);
|
||||
|
||||
__osRestoreInt(saveMask);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
void osStartThread(OSThread* t) {
|
||||
register u32 saveMask;
|
||||
@@ -6,16 +6,17 @@ void osStartThread(OSThread* t) {
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
switch (t->state) {
|
||||
case 8:
|
||||
t->state = 2;
|
||||
case OS_STATE_WAITING:
|
||||
t->state = OS_STATE_RUNNABLE;
|
||||
__osEnqueueThread(&__osRunQueue, t);
|
||||
break;
|
||||
case 1:
|
||||
|
||||
case OS_STATE_STOPPED:
|
||||
if ((t->queue == NULL) || (t->queue == &__osRunQueue)) {
|
||||
t->state = 2;
|
||||
t->state = OS_STATE_RUNNABLE;
|
||||
__osEnqueueThread(&__osRunQueue, t);
|
||||
} else {
|
||||
t->state = 8;
|
||||
t->state = OS_STATE_WAITING;
|
||||
__osEnqueueThread(t->queue, t);
|
||||
__osEnqueueThread(&__osRunQueue, __osPopThread(t->queue));
|
||||
}
|
||||
@@ -26,7 +27,7 @@ void osStartThread(OSThread* t) {
|
||||
__osDispatchThread();
|
||||
} else {
|
||||
if (__osRunningThread->priority < __osRunQueue->priority) {
|
||||
__osRunningThread->state = 2;
|
||||
__osRunningThread->state = OS_STATE_RUNNABLE;
|
||||
__osEnqueueAndYield(&__osRunQueue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
void osStopThread(OSThread* t) {
|
||||
register u32 saveMask;
|
||||
@@ -7,19 +7,20 @@ void osStopThread(OSThread* t) {
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
if (t == NULL) {
|
||||
state = 4;
|
||||
state = OS_STATE_RUNNING;
|
||||
} else {
|
||||
state = t->state;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case 4:
|
||||
__osRunningThread->state = 1;
|
||||
case OS_STATE_RUNNING:
|
||||
__osRunningThread->state = OS_STATE_STOPPED;
|
||||
__osEnqueueAndYield(NULL);
|
||||
break;
|
||||
case 2:
|
||||
case 8:
|
||||
t->state = 1;
|
||||
|
||||
case OS_STATE_RUNNABLE:
|
||||
case OS_STATE_WAITING:
|
||||
t->state = OS_STATE_STOPPED;
|
||||
__osDequeueThread(t->queue, t);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
s32 osStopTimer(OSTimer* t) {
|
||||
register u32 savedMask;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
__OSThreadTail __osThreadTail = { NULL, -1};
|
||||
__OSThreadTail __osThreadTail = { NULL, OS_PRIORITY_THREADTAIL };
|
||||
OSThread* __osRunQueue = (OSThread*)&__osThreadTail;
|
||||
OSThread* __osActiveQueue = (OSThread*)&__osThreadTail;
|
||||
OSThread* __osRunningThread = NULL;
|
||||
@@ -10,7 +10,7 @@ void __osDequeueThread(OSThread** queue, OSThread* t) {
|
||||
register OSThread* pred;
|
||||
register OSThread* succ;
|
||||
|
||||
pred = (OSThread*)queue; //! This seems questionable, but the function matches...
|
||||
pred = (OSThread*)queue;
|
||||
succ = pred->next;
|
||||
while (succ != NULL) {
|
||||
if (succ == t) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
OSThread __osThreadSave;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
#include "libc/stdbool.h"
|
||||
|
||||
OSTimer __osBaseTimer;
|
||||
OSTime __osCurrentTime;
|
||||
u32 __osBaseCounter;
|
||||
u32 __osViIntrCount;
|
||||
u32 __osTimerCounter;
|
||||
s32 D_8009E5C8[2]; // dummy bss padding required
|
||||
OSPifRam __osPfsPifRam;
|
||||
|
||||
OSTimer* __osTimerList = &__osBaseTimer;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "PR/ultratypes.h"
|
||||
#include "PR/osint.h"
|
||||
#include "libc/stdint.h"
|
||||
#include "global.h"
|
||||
|
||||
uintptr_t osVirtualToPhysical(void* virtualAddress) {
|
||||
if (((uintptr_t)virtualAddress >= 0x80000000) && ((uintptr_t)virtualAddress < 0xA0000000)) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "ultra64.h"
|
||||
|
||||
void osYieldThread(void) {
|
||||
register u32 saveMask = __osDisableInt();
|
||||
|
||||
__osRunningThread->state = 2;
|
||||
__osRunningThread->state = OS_STATE_RUNNABLE;
|
||||
__osEnqueueAndYield(&__osRunQueue);
|
||||
|
||||
__osRestoreInt(saveMask);
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
0x80087B00 : "setcause",
|
||||
0x80087B10 : "sendmesg",
|
||||
0x80087C60 : "pfsfreeblocks",
|
||||
0x80087E00 : "viextend",
|
||||
0x80087E00 : "viextendvstart",
|
||||
0x80087E10 : "stopthread",
|
||||
0x80087ED0 : "recvmesg",
|
||||
0x80088010 : "setintmask",
|
||||
|
||||
@@ -241,7 +241,7 @@ asm/non_matchings/boot/printutils/Sleep_Sec.s,Sleep_Sec,0x80087AC0,0x10
|
||||
asm/non_matchings/boot/setcause/__osSetCause.s,__osSetCause,0x80087B00,0x4
|
||||
asm/non_matchings/boot/sendmesg/osSendMesg.s,osSendMesg,0x80087B10,0x54
|
||||
asm/non_matchings/boot/pfsfreeblocks/osPfsFreeBlocks.s,osPfsFreeBlocks,0x80087C60,0x68
|
||||
asm/non_matchings/boot/viextend/osViExtendVStart.s,osViExtendVStart,0x80087E00,0x4
|
||||
asm/non_matchings/boot/viextendvstart/osViExtendVStart.s,osViExtendVStart,0x80087E00,0x4
|
||||
asm/non_matchings/boot/stopthread/osStopThread.s,osStopThread,0x80087E10,0x30
|
||||
asm/non_matchings/boot/recvmesg/osRecvMesg.s,osRecvMesg,0x80087ED0,0x50
|
||||
asm/non_matchings/boot/setintmask/osSetIntMask.s,osSetIntMask,0x80088010,0x28
|
||||
|
||||
|
Reference in New Issue
Block a user