mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-17 21:53:17 -04:00
@@ -1,10 +1,15 @@
|
||||
#include "libultra_internal.h"
|
||||
|
||||
OSThreadTail __osThreadTail = {NULL, -1};
|
||||
#ifndef AVOID_UB
|
||||
OSThread *__osThreadTail = NULL;
|
||||
u32 __osTest = -1;
|
||||
OSThread *__osRunQueue = (OSThread *) &__osThreadTail;
|
||||
OSThread *__osActiveQueue = (OSThread *) &__osThreadTail;
|
||||
OSThread *__osRunningThread = NULL;
|
||||
OSThread *__osFaultedThread = NULL;
|
||||
#else
|
||||
OSThread_ListHead __osThreadTail_fix = {NULL, -1, (OSThread *) &__osThreadTail_fix, (OSThread *) &__osThreadTail_fix, NULL, 0};
|
||||
#endif
|
||||
|
||||
void __osDequeueThread(OSThread **queue, OSThread *thread) {
|
||||
register OSThread **a2;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "ultra64.h"
|
||||
#include "osint.h"
|
||||
#include "piint.h"
|
||||
#include "libultra_internal.h"
|
||||
|
||||
extern OSThread *__osRunQueue;
|
||||
static void __osLeoResume(void);
|
||||
static void __osLeoAbnormalResume(void);
|
||||
extern u8 leoDiskStack[OS_PIM_STACKSIZE]; //technically should have a OS_LEO_STACKSIZE or something..
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _LIBULTRA_INTERNAL_H_
|
||||
#define _LIBULTRA_INTERNAL_H_
|
||||
#include <ultra64.h>
|
||||
#include <PR/os_thread.h>
|
||||
#include "macros.h"
|
||||
|
||||
typedef struct __OSEventState
|
||||
@@ -15,15 +16,41 @@ typedef struct __osThreadTail
|
||||
OSPri priority;
|
||||
} OSThreadTail;
|
||||
|
||||
/*
|
||||
* This define is needed because the original definitions in __osDequeueThread.c are declared
|
||||
* seperately instead of part of a single struct, however some code alises over this memory
|
||||
* assuming a unified structure. To fix this, we declare the full type here and then alias the
|
||||
* symbol names to the correct members in AVOID_UB.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*0x00*/ struct OSThread_s *next;
|
||||
/*0x04*/ OSPri priority;
|
||||
/*0x08*/ struct OSThread_s *queue;
|
||||
/*0x0C*/ struct OSThread_s *tlnext;
|
||||
/*0x10*/ struct OSThread_s *unk10;
|
||||
/*0x14*/ u32 unk14;
|
||||
} OSThread_ListHead;
|
||||
#ifdef AVOID_UB
|
||||
|
||||
// Now fix the symbols to the new one.
|
||||
extern OSThread_ListHead __osThreadTail_fix;
|
||||
|
||||
#define __osThreadTail __osThreadTail_fix.next
|
||||
#define D_80334894 __osThreadTail_fix.priority
|
||||
#define __osRunQueue __osThreadTail_fix.queue
|
||||
#define __osActiveQueue __osThreadTail_fix.tlnext
|
||||
#define __osRunningThread __osThreadTail_fix.unk10
|
||||
#else
|
||||
// Original OSThread_ListHead definitions
|
||||
extern OSThreadTail __osThreadTail;
|
||||
extern OSThread *__osThreadTail;
|
||||
extern OSThread *__osActiveQueue;
|
||||
extern OSThread *__osRunQueue;
|
||||
extern OSThread *__osRunningThread;
|
||||
|
||||
#endif
|
||||
|
||||
// Original EEPROM definitions
|
||||
extern ALIGNED8 u32 D_80365E00[15];
|
||||
extern u32 D_80365E00[15];
|
||||
extern u32 D_80365E3C;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -7,7 +7,7 @@ unsigned long long __ull_rem(unsigned long long a0, unsigned long long a1)
|
||||
return a0 % a1;
|
||||
}
|
||||
unsigned long long __ull_div(unsigned long long a0, unsigned long long a1)
|
||||
{
|
||||
{
|
||||
return a0 / a1;
|
||||
}
|
||||
|
||||
@@ -34,19 +34,19 @@ unsigned long long __ll_mul(unsigned long long a0, unsigned long long a1)
|
||||
void __ull_divremi(unsigned long long *div, unsigned long long *rem, unsigned long long a2, unsigned short a3)
|
||||
{
|
||||
*div = a2 / a3;
|
||||
*rem = a2 % a3;
|
||||
}
|
||||
*rem = a2 % a3;
|
||||
}
|
||||
long long __ll_mod(long long a0, long long a1)
|
||||
{
|
||||
long long tmp = a0 % a1;
|
||||
if ((tmp < 0 && a1 > 0) || (tmp > 0 && a1 < 0))
|
||||
{
|
||||
|
||||
tmp += a1;
|
||||
tmp += a1;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
long long __ll_rshift(long long a0, long long a1)
|
||||
{
|
||||
return a0 >> a1;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "libultra_internal.h"
|
||||
|
||||
void __osCleanupThread(void);
|
||||
extern OSThread *__osActiveQueue;
|
||||
|
||||
|
||||
// Don't warn about pointer->u64 cast
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "libultra_internal.h"
|
||||
#include "controller.h"
|
||||
|
||||
extern u64 osClockRate;
|
||||
extern u8 D_80365D20;
|
||||
extern u8 _osContNumControllers;
|
||||
extern OSTimer D_80196548;
|
||||
extern OSMesgQueue _osContMesgQueue;
|
||||
extern OSMesg _osContMesgBuff[4];
|
||||
|
||||
+2
-21
@@ -1,30 +1,11 @@
|
||||
#include "libultra_internal.h"
|
||||
#include "controller.h"
|
||||
#include "macros.h"
|
||||
#include "controller.h"
|
||||
|
||||
extern u8 __osContLastCmd;
|
||||
extern u8 _osLastSentSiCmd;
|
||||
|
||||
extern OSPifRam __osEepPifRam;
|
||||
|
||||
typedef struct {
|
||||
u8 unk00;
|
||||
u8 unk01;
|
||||
u8 unk02;
|
||||
u8 unk03;
|
||||
u8 unk04;
|
||||
u8 unk05;
|
||||
u8 unk06;
|
||||
u8 unk07;
|
||||
} unkStruct3;
|
||||
|
||||
typedef struct {
|
||||
u8 unk00;
|
||||
u8 unk01;
|
||||
u8 unk02;
|
||||
u8 unk03;
|
||||
unkStruct3 unk04;
|
||||
} unkStruct2;
|
||||
|
||||
s32 __osEepStatus(OSMesgQueue *, OSContStatus *);
|
||||
void __osPackEepReadData(u8);
|
||||
|
||||
|
||||
@@ -7,25 +7,6 @@ OSPifRam __osEepPifRam;
|
||||
|
||||
extern u8 __osContLastCmd;
|
||||
|
||||
typedef struct {
|
||||
u8 unk00;
|
||||
u8 unk01;
|
||||
u8 unk02;
|
||||
u8 unk03;
|
||||
u8 unk04;
|
||||
u8 unk05;
|
||||
u8 unk06;
|
||||
u8 unk07;
|
||||
} unkStruct3;
|
||||
|
||||
typedef struct {
|
||||
u8 unk00;
|
||||
u8 unk01;
|
||||
u8 unk02;
|
||||
u8 unk03;
|
||||
unkStruct3 unk04;
|
||||
} unkStruct2;
|
||||
|
||||
s32 __osEepStatus(OSMesgQueue *, OSContStatus *);
|
||||
void __osPackEepWriteData(u8, u8 *);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _OSINT_H
|
||||
#define _OSINT_H
|
||||
#include "libultra_internal.h"
|
||||
#include <macros.h>
|
||||
|
||||
//maybe should be in exceptasm.h?
|
||||
extern void __osEnqueueAndYield(OSThread **);
|
||||
@@ -15,10 +16,14 @@ extern void __osTimerInterrupt(void);
|
||||
extern u32 __osProbeTLB(void *);
|
||||
extern int __osSpDeviceBusy(void);
|
||||
|
||||
#ifdef AVOID_UB
|
||||
extern OSThread_ListHead __osThreadTail_fix;
|
||||
#else
|
||||
extern OSThread *__osRunningThread;
|
||||
extern OSThread *__osActiveQueue;
|
||||
extern OSThread *__osFaultedThread;
|
||||
extern OSThread *__osRunQueue;
|
||||
#endif
|
||||
|
||||
extern OSTimer *__osTimerList;
|
||||
extern OSTimer __osBaseTimer;
|
||||
|
||||
Reference in New Issue
Block a user