mirror of https://github.com/zeldaret/mm.git
Boot_800862E0 OK (#769)
* boot_800862E0 OK * Ran format.sh * attempt at fixing bss reordering * boot_800862E0 OK (for real this time) * Run formatter * Changes u32 pointers to uintptr_t and sizes to size_t * Run formatter * Fix bss reordering * Delete baserom.mm.us.rev1.z64:Zone.Identifier * Cleanup and some notes * Try my best to document * remove comments * Remove D_80097508 from variables.h Co-authored-by: kyleburnette <kyle@kyleburnette.com> Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
This commit is contained in:
parent
afec1c56a6
commit
ec9909c65c
|
|
@ -153,14 +153,10 @@ void MtxConv_L2F(MtxF* m1, MatrixInternal* m2);
|
||||||
void __assert(const char* file, u32 lineNum);
|
void __assert(const char* file, u32 lineNum);
|
||||||
// void func_800862B4(void);
|
// void func_800862B4(void);
|
||||||
void* SystemArena_MallocMin1(u32 size);
|
void* SystemArena_MallocMin1(u32 size);
|
||||||
void SystemArena_FreeNull(void* pvParm1);
|
void SystemArena_FreeNullCheck(void* ptr);
|
||||||
void func_8008633C(u32 param_1, s32 param_2, s32 param_3, UNK_PTR param_4);
|
void SystemArena_RunInits(void);
|
||||||
void func_800863AC(u32 param_1, s32 param_2, s32 param_3, UNK_PTR param_4);
|
void SystemArena_Init(void* start, size_t size);
|
||||||
// void func_8008641C(void);
|
s32 func_80086620(OSMesgQueue* param_1, PadMgr* param_2, OSContStatus* param_3);
|
||||||
// void func_800864EC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
|
||||||
// void func_80086588(void);
|
|
||||||
void SystemArena_Init(u32 base, u32 size);
|
|
||||||
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status);
|
|
||||||
// void func_80086760(void);
|
// void func_80086760(void);
|
||||||
// void func_80086794(void);
|
// void func_80086794(void);
|
||||||
// void func_800867B4(void);
|
// void func_800867B4(void);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ extern StackEntry* sStackInfoListEnd;
|
||||||
// extern UNK_TYPE1 sGfxPrintUnkTLUT;
|
// extern UNK_TYPE1 sGfxPrintUnkTLUT;
|
||||||
// extern UNK_TYPE1 sGfxPrintUnkData;
|
// extern UNK_TYPE1 sGfxPrintUnkData;
|
||||||
// extern UNK_TYPE1 sGfxPrintFontData;
|
// extern UNK_TYPE1 sGfxPrintFontData;
|
||||||
// extern UNK_TYPE4 D_80097500;
|
|
||||||
// extern UNK_TYPE4 D_80097524;
|
// extern UNK_TYPE4 D_80097524;
|
||||||
// extern u32 sRandInt;
|
// extern u32 sRandInt;
|
||||||
extern OSViMode osViModeNtscHpf1;
|
extern OSViMode osViModeNtscHpf1;
|
||||||
|
|
|
||||||
1
spec
1
spec
|
|
@ -38,7 +38,6 @@ beginseg
|
||||||
include "build/src/boot_O2/mtxuty-cvt.o"
|
include "build/src/boot_O2/mtxuty-cvt.o"
|
||||||
include "build/src/boot_O2/assert.o"
|
include "build/src/boot_O2/assert.o"
|
||||||
include "build/src/boot_O2/boot_800862E0.o"
|
include "build/src/boot_O2/boot_800862E0.o"
|
||||||
include "build/data/boot/boot_800862E0.data.o"
|
|
||||||
include "build/src/boot_O2/padsetup.o"
|
include "build/src/boot_O2/padsetup.o"
|
||||||
include "build/src/boot_O2/boot_80086760.o"
|
include "build/src/boot_O2/boot_80086760.o"
|
||||||
include "build/asm/boot/fp.text.o"
|
include "build/asm/boot/fp.text.o"
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,116 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "os_malloc.h"
|
#include "system_malloc.h"
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/SystemArena_MallocMin1.s")
|
typedef void (*BlockFunc)(void*);
|
||||||
|
typedef void (*BlockFunc1)(void*, u32);
|
||||||
|
typedef void (*BlockFunc8)(void*, u32, u32, u32, u32, u32, u32, u32, u32);
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/SystemArena_FreeNull.s")
|
typedef struct InitFunc {
|
||||||
|
uintptr_t nextOffset;
|
||||||
|
void (*func)(void);
|
||||||
|
} InitFunc;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_8008633C.s")
|
void* sInitFuncs = NULL;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_800863AC.s")
|
char sNew[] = { 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_8008641C.s")
|
char D_80097508[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00,
|
||||||
|
0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_800864EC.s")
|
void* SystemArena_MallocMin1(size_t size) {
|
||||||
|
if (size == 0) {
|
||||||
|
size = 1;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/func_80086588.s")
|
return __osMalloc(&gSystemArena, size);
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/boot_800862E0/SystemArena_Init.s")
|
void SystemArena_FreeNullCheck(void* ptr) {
|
||||||
|
if (ptr != NULL) {
|
||||||
|
__osFree(&gSystemArena, ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemArena_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc blockFunc) {
|
||||||
|
uintptr_t pos = blk;
|
||||||
|
|
||||||
|
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||||
|
blockFunc(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemArena_RunBlockFunc1(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc) {
|
||||||
|
uintptr_t pos = blk;
|
||||||
|
|
||||||
|
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||||
|
blockFunc(pos, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void* SystemArena_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFunc8 blockFunc) {
|
||||||
|
if (blk == NULL) {
|
||||||
|
blk = SystemArena_MallocMin1(nBlk * blkSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blk != NULL && blockFunc != NULL) {
|
||||||
|
uintptr_t pos = blk;
|
||||||
|
|
||||||
|
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||||
|
blockFunc(pos, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return blk;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemArena_RunBlockFunc1Reverse(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc, s32 shouldFree) {
|
||||||
|
uintptr_t pos;
|
||||||
|
uintptr_t start;
|
||||||
|
size_t maskedBlkSize;
|
||||||
|
|
||||||
|
if (blk == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blockFunc != NULL) {
|
||||||
|
start = blk;
|
||||||
|
maskedBlkSize = (blkSize & ~0);
|
||||||
|
pos = (uintptr_t)start + (nBlk * blkSize);
|
||||||
|
|
||||||
|
while (pos > start) {
|
||||||
|
pos -= maskedBlkSize;
|
||||||
|
blockFunc(pos, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldFree) {
|
||||||
|
SystemArena_FreeNullCheck(blk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemArena_RunInits(void) {
|
||||||
|
InitFunc* initFunc = (InitFunc*)&sInitFuncs;
|
||||||
|
u32 nextOffset = initFunc->nextOffset;
|
||||||
|
InitFunc* prev = NULL;
|
||||||
|
|
||||||
|
while (nextOffset != 0) {
|
||||||
|
initFunc = (InitFunc*)((uintptr_t)initFunc + nextOffset);
|
||||||
|
|
||||||
|
if (initFunc->func != NULL) {
|
||||||
|
(*initFunc->func)();
|
||||||
|
}
|
||||||
|
|
||||||
|
nextOffset = initFunc->nextOffset;
|
||||||
|
initFunc->nextOffset = (uintptr_t)prev;
|
||||||
|
prev = initFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
sInitFuncs = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemArena_Init(void* start, size_t size) {
|
||||||
|
SystemArena_InitArena(start, size);
|
||||||
|
SystemArena_RunInits();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,12 +158,12 @@
|
||||||
0x80086280:("__assert",),
|
0x80086280:("__assert",),
|
||||||
0x800862B4:("func_800862B4",),
|
0x800862B4:("func_800862B4",),
|
||||||
0x800862E0:("SystemArena_MallocMin1",),
|
0x800862E0:("SystemArena_MallocMin1",),
|
||||||
0x80086310:("SystemArena_FreeNull",),
|
0x80086310:("SystemArena_FreeNullCheck",),
|
||||||
0x8008633C:("func_8008633C",),
|
0x8008633C:("SystemArena_RunBlockFunc",),
|
||||||
0x800863AC:("func_800863AC",),
|
0x800863AC:("SystemArena_RunBlockFunc1",),
|
||||||
0x8008641C:("func_8008641C",),
|
0x8008641C:("SystemArena_RunBlockFunc8",),
|
||||||
0x800864EC:("func_800864EC",),
|
0x800864EC:("SystemArena_RunBlockFunc1Reverse",),
|
||||||
0x80086588:("func_80086588",),
|
0x80086588:("SystemArena_RunInits",),
|
||||||
0x800865F8:("SystemArena_Init",),
|
0x800865F8:("SystemArena_Init",),
|
||||||
0x80086620:("PadSetup_Init",),
|
0x80086620:("PadSetup_Init",),
|
||||||
0x80086760:("func_80086760",),
|
0x80086760:("func_80086760",),
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@
|
||||||
0x80096CD0:("sGfxPrintUnkTLUT","u16","[16]",0x20),
|
0x80096CD0:("sGfxPrintUnkTLUT","u16","[16]",0x20),
|
||||||
0x80096CF0:("sGfxPrintUnkData","u8","[8]",0x8),
|
0x80096CF0:("sGfxPrintUnkData","u8","[8]",0x8),
|
||||||
0x80096CF8:("sGfxPrintFontData","u8","[0x800]",0x800),
|
0x80096CF8:("sGfxPrintFontData","u8","[0x800]",0x800),
|
||||||
0x80097500:("D_80097500","UNK_TYPE4","",0x4),
|
0x80097500:("sInitFuncs","void*","",0x4),
|
||||||
|
0x80097504:("sNew","char","[4]",0x4),
|
||||||
|
0x80097508:("D_80097508","[24]","",0x18),
|
||||||
0x80097520:("qNaN0x3FFFFF","f32","",0x4),
|
0x80097520:("qNaN0x3FFFFF","f32","",0x4),
|
||||||
0x80097524:("qNaN0x10000","f32","",0x4),
|
0x80097524:("qNaN0x10000","f32","",0x4),
|
||||||
0x80097528:("sNaN0x3FFFFF","f32","",0x4),
|
0x80097528:("sNaN0x3FFFFF","f32","",0x4),
|
||||||
|
|
|
||||||
|
|
@ -155,12 +155,12 @@ asm/non_matchings/boot/mtxuty-cvt/MtxConv_L2F.s,MtxConv_L2F,0x80086258,0xA
|
||||||
asm/non_matchings/boot/assert/__assert.s,__assert,0x80086280,0xD
|
asm/non_matchings/boot/assert/__assert.s,__assert,0x80086280,0xD
|
||||||
asm/non_matchings/boot/assert/func_800862B4.s,func_800862B4,0x800862B4,0xB
|
asm/non_matchings/boot/assert/func_800862B4.s,func_800862B4,0x800862B4,0xB
|
||||||
asm/non_matchings/boot/boot_800862E0/SystemArena_MallocMin1.s,SystemArena_MallocMin1,0x800862E0,0xC
|
asm/non_matchings/boot/boot_800862E0/SystemArena_MallocMin1.s,SystemArena_MallocMin1,0x800862E0,0xC
|
||||||
asm/non_matchings/boot/boot_800862E0/SystemArena_FreeNull.s,SystemArena_FreeNull,0x80086310,0xB
|
asm/non_matchings/boot/boot_800862E0/SystemArena_FreeNullCheck.s,SystemArena_FreeNullCheck,0x80086310,0xB
|
||||||
asm/non_matchings/boot/boot_800862E0/func_8008633C.s,func_8008633C,0x8008633C,0x1C
|
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc.s,SystemArena_RunBlockFunc,0x8008633C,0x1C
|
||||||
asm/non_matchings/boot/boot_800862E0/func_800863AC.s,func_800863AC,0x800863AC,0x1C
|
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc1.s,SystemArena_RunBlockFunc1,0x800863AC,0x1C
|
||||||
asm/non_matchings/boot/boot_800862E0/func_8008641C.s,func_8008641C,0x8008641C,0x34
|
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc8.s,SystemArena_RunBlockFunc8,0x8008641C,0x34
|
||||||
asm/non_matchings/boot/boot_800862E0/func_800864EC.s,func_800864EC,0x800864EC,0x27
|
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc1Reverse.s,SystemArena_RunBlockFunc1Reverse,0x800864EC,0x27
|
||||||
asm/non_matchings/boot/boot_800862E0/func_80086588.s,func_80086588,0x80086588,0x1C
|
asm/non_matchings/boot/boot_800862E0/SystemArena_RunInits.s,SystemArena_RunInits,0x80086588,0x1C
|
||||||
asm/non_matchings/boot/boot_800862E0/SystemArena_Init.s,SystemArena_Init,0x800865F8,0xA
|
asm/non_matchings/boot/boot_800862E0/SystemArena_Init.s,SystemArena_Init,0x800865F8,0xA
|
||||||
asm/non_matchings/boot/padsetup/PadSetup_Init.s,PadSetup_Init,0x80086620,0x50
|
asm/non_matchings/boot/padsetup/PadSetup_Init.s,PadSetup_Init,0x80086620,0x50
|
||||||
asm/non_matchings/boot/boot_80086760/func_80086760.s,func_80086760,0x80086760,0xD
|
asm/non_matchings/boot/boot_80086760/func_80086760.s,func_80086760,0x80086760,0xD
|
||||||
|
|
|
||||||
|
Loading…
Reference in New Issue