summaryrefslogtreecommitdiff
path: root/src/boot_O2
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot_O2')
-rw-r--r--src/boot_O2/__osMalloc.c15
-rw-r--r--src/boot_O2/assert.c (renamed from src/boot_O2/boot_0x80086280.c)5
-rw-r--r--src/boot_O2/boot_0x800862E0.c20
-rw-r--r--src/boot_O2/boot_80084940.c15
-rw-r--r--src/boot_O2/boot_800862E0.c17
-rw-r--r--src/boot_O2/gfxprint.c9
-rw-r--r--src/boot_O2/loadfragment2.c15
-rw-r--r--src/boot_O2/mtxuty-cvt.c3
-rw-r--r--src/boot_O2/padsetup.c3
-rw-r--r--src/boot_O2/padutils.c3
-rw-r--r--src/boot_O2/rand.c (renamed from src/boot_O2/boot_0x80086FA0.c)3
-rw-r--r--src/boot_O2/stackcheck.c3
12 files changed, 60 insertions, 51 deletions
diff --git a/src/boot_O2/__osMalloc.c b/src/boot_O2/__osMalloc.c
index 8286a545e..40572a59f 100644
--- a/src/boot_O2/__osMalloc.c
+++ b/src/boot_O2/__osMalloc.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#define FILL_ALLOCBLOCK (1 << 0)
#define FILL_FREEBLOCK (1 << 1)
@@ -16,6 +15,8 @@
extern OSMesg sArenaLockMsg[1];
+#pragma GLOBAL_ASM("asm/non_matchings/boot/__osMalloc/D_80099110.s")
+
void ArenaImpl_LockInit(Arena* arena) {
osCreateMesgQueue(&arena->lock, sArenaLockMsg, ARRAY_COUNT(sArenaLockMsg));
}
@@ -28,7 +29,7 @@ void ArenaImpl_Unlock(Arena* arena) {
osRecvMesg(&arena->lock, NULL, OS_MESG_BLOCK);
}
-ArenaNode* heap_get_tail(Arena* arena) {
+ArenaNode* ArenaImpl_GetLastBlock(Arena* arena) {
ArenaNode* last;
ArenaNode* iter;
@@ -69,7 +70,7 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) {
firstNode->isFree = 1;
firstNode->magic = NODE_MAGIC;
ArenaImpl_Lock(arena);
- lastNode = heap_get_tail(arena);
+ lastNode = ArenaImpl_GetLastBlock(arena);
if (lastNode == NULL) {
arena->head = firstNode;
arena->start = start;
@@ -141,7 +142,7 @@ void* __osMallocR(Arena* arena, u32 size) {
size = ALIGN16(size);
ArenaImpl_Lock(arena);
- iter = heap_get_tail(arena);
+ iter = ArenaImpl_GetLastBlock(arena);
while (iter != NULL) {
if (iter->isFree && iter->size >= size) {
@@ -216,7 +217,7 @@ end:
ArenaImpl_Unlock(arena);
}
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/__osMalloc/__osRealloc.asm")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/__osMalloc/__osRealloc.s")
void __osAnalyzeArena(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) {
ArenaNode* iter;
@@ -244,4 +245,4 @@ void __osAnalyzeArena(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc
ArenaImpl_Unlock(arena);
}
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/__osMalloc/__osCheckArena.asm")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/__osMalloc/__osCheckArena.s")
diff --git a/src/boot_O2/boot_0x80086280.c b/src/boot_O2/assert.c
index e2aeff70f..9bf98c2db 100644
--- a/src/boot_O2/boot_0x80086280.c
+++ b/src/boot_O2/assert.c
@@ -1,7 +1,6 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
-void assert_fail(const char* file, u32 lineNum) {
+void __assert(const char* file, u32 lineNum) {
osGetThreadId(NULL);
Fault_AddHungupAndCrash(file, lineNum);
}
diff --git a/src/boot_O2/boot_0x800862E0.c b/src/boot_O2/boot_0x800862E0.c
deleted file mode 100644
index f9f462056..000000000
--- a/src/boot_O2/boot_0x800862E0.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <ultra64.h>
-#include <global.h>
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/StartHeap_AllocMin1.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/StartHeap_FreeNull.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_8008633C.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_800863AC.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_8008641C.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_800864EC.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_80086588.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/StartHeap_Init.asm")
-
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_80086620.asm")
diff --git a/src/boot_O2/boot_80084940.c b/src/boot_O2/boot_80084940.c
new file mode 100644
index 000000000..acee90fb9
--- /dev/null
+++ b/src/boot_O2/boot_80084940.c
@@ -0,0 +1,15 @@
+#include "global.h"
+
+void func_80084940(void) {
+ u32 spStatus = __osSpGetStatus();
+ u32 dpStatus = osDpGetStatus();
+
+ if (spStatus && dpStatus) {} // stubbed debug prints
+}
+
+void func_80084968(void) {
+ func_80084940();
+ osDpSetStatus(0x28);
+ __osSpSetStatus(0x4082);
+ func_80084940();
+}
diff --git a/src/boot_O2/boot_800862E0.c b/src/boot_O2/boot_800862E0.c
new file mode 100644
index 000000000..d02fd15be
--- /dev/null
+++ b/src/boot_O2/boot_800862E0.c
@@ -0,0 +1,17 @@
+#include "global.h"
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/StartHeap_AllocMin1.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/StartHeap_FreeNull.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_8008633C.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_800863AC.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_8008641C.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_800864EC.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_80086588.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/StartHeap_Init.s")
diff --git a/src/boot_O2/gfxprint.c b/src/boot_O2/gfxprint.c
index bcb9ee31a..485799678 100644
--- a/src/boot_O2/gfxprint.c
+++ b/src/boot_O2/gfxprint.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
extern u16 sGfxPrintFontTLUT[64];
extern u16 sGfxPrintUnkTLUT[16];
@@ -109,10 +108,10 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
this->posX += 32;
}
#else
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/gfxprint/GfxPrint_PrintCharImpl.asm")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/gfxprint/GfxPrint_PrintCharImpl.s")
#endif
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/gfxprint/GfxPrint_PrintChar.asm")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/gfxprint/GfxPrint_PrintChar.s")
void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, size_t charSize, size_t charCount) {
const char* str = (const char*)buffer;
@@ -173,7 +172,7 @@ Gfx* GfxPrint_Close(GfxPrint* this) {
}
void GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
- func_80087900(&this->callback, fmt, args);
+ PrintUtils_VPrintf(&this->callback, fmt, args);
}
void GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {
diff --git a/src/boot_O2/loadfragment2.c b/src/boot_O2/loadfragment2.c
index 5f44c34c4..8a3ae4ec5 100644
--- a/src/boot_O2/loadfragment2.c
+++ b/src/boot_O2/loadfragment2.c
@@ -1,12 +1,11 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
UNK_TYPE4 D_80096C30 = 2;
#ifdef NON_MATCHING
// This needs lots of work. Mostly regalloc and getting the address of D_80096C30 placed in s5 at the beginning of the
// function
-void Load2_Relocate(u32 allocatedVRamAddr, OverlayBlockSizes* overlayInfo, u32 vRamStart) {
+void Load2_Relocate(u32 allocatedVRamAddr, OverlayRelocationSection* overlayInfo, u32 vRamStart) {
s32 sectionLocations[4];
u32* regReferences[32];
u32 regValues[32];
@@ -22,7 +21,7 @@ void Load2_Relocate(u32 allocatedVRamAddr, OverlayBlockSizes* overlayInfo, u32 v
sectionLocations[1] = allocatedVRamAddr;
sectionLocations[2] = overlayInfo->textSize + allocatedVRamAddr;
sectionLocations[3] = sectionLocations[2] + overlayInfo->dataSize;
- for (i = 0, relocationIndex = 0; i < overlayInfo->amountOfRelocations; relocationIndex++) {
+ for (i = 0, relocationIndex = 0; i < overlayInfo->nRelocations; relocationIndex++) {
relocation = overlayInfo->relocations[relocationIndex];
i++;
inst = (u32*)(sectionLocations[relocation >> 0x1e] + (relocation & 0xffffff));
@@ -59,7 +58,7 @@ void Load2_Relocate(u32 allocatedVRamAddr, OverlayBlockSizes* overlayInfo, u32 v
}
}
#else
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/loadfragment2/Load2_Relocate.asm")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/loadfragment2/Load2_Relocate.s")
#endif
#ifdef NON_MATCHING
@@ -69,7 +68,7 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3
u32 pad;
u32 size;
void* end;
- OverlayBlockSizes* overlayInfo;
+ OverlayRelocationSection* overlayInfo;
size = vRomEnd - vRomStart;
@@ -80,7 +79,7 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3
DmaMgr_SendRequest0(allocatedVRamAddr, vRomStart, size);
end = (void*)(allocatedVRamAddr + size);
- overlayInfo = (OverlayBlockSizes*)((int)end - *(int*)((int)end + -4));
+ overlayInfo = (OverlayRelocationSection*)((int)end - *(int*)((int)end + -4));
if (1) {
;
@@ -99,7 +98,7 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3
return nbytes;
}
#else
-#pragma GLOBAL_ASM("./asm/non_matchings/boot/loadfragment2/Load2_LoadOverlay.asm")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/loadfragment2/Load2_LoadOverlay.s")
#endif
void* Load2_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd) {
diff --git a/src/boot_O2/mtxuty-cvt.c b/src/boot_O2/mtxuty-cvt.c
index f34c1e518..221dbf554 100644
--- a/src/boot_O2/mtxuty-cvt.c
+++ b/src/boot_O2/mtxuty-cvt.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) {
s32 i;
diff --git a/src/boot_O2/padsetup.c b/src/boot_O2/padsetup.c
new file mode 100644
index 000000000..5f83bd524
--- /dev/null
+++ b/src/boot_O2/padsetup.c
@@ -0,0 +1,3 @@
+#include "global.h"
+
+#pragma GLOBAL_ASM("asm/non_matchings/boot/padsetup/func_80086620.s")
diff --git a/src/boot_O2/padutils.c b/src/boot_O2/padutils.c
index cdd789f1b..95f1dfa3b 100644
--- a/src/boot_O2/padutils.c
+++ b/src/boot_O2/padutils.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
void PadUtils_Init(Input* input) {
bzero(input, sizeof(Input));
diff --git a/src/boot_O2/boot_0x80086FA0.c b/src/boot_O2/rand.c
index 9454d4654..6edf7490e 100644
--- a/src/boot_O2/boot_0x80086FA0.c
+++ b/src/boot_O2/rand.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
#define RAND_MULTIPLIER 1664525
#define RAND_INCREMENT 1013904223
diff --git a/src/boot_O2/stackcheck.c b/src/boot_O2/stackcheck.c
index 7079eff8e..20e56f480 100644
--- a/src/boot_O2/stackcheck.c
+++ b/src/boot_O2/stackcheck.c
@@ -1,5 +1,4 @@
-#include <ultra64.h>
-#include <global.h>
+#include "global.h"
StackEntry* sStackInfoListStart = NULL;
StackEntry* sStackInfoListEnd = NULL;