@@ -6,22 +6,20 @@ typedef void (*arg3_800FC8D8)(void*, u32);
66typedef void (* arg3_800FC948 )(void * , u32 , u32 , u32 , u32 , u32 , u32 , u32 , u32 );
77typedef void (* arg3_800FCA18 )(void * , u32 );
88
9- typedef struct InitFunc {
9+ typedef struct CtorEntry {
1010 s32 nextOffset ;
1111 void (* func )(void );
12- } InitFunc ;
12+ } CtorEntry ;
1313
14- // .data
15- void * sInitFuncs = NULL ;
14+ void * sGlobalCtorEntries = NULL ;
1615
1716#if DEBUG_FEATURES
1817char sNew [] = "new" ;
1918#else
2019char sNew [] = "" ;
2120#endif
2221
23- // possibly some kind of new() function
24- void * func_800FC800 (u32 size ) {
22+ void * Runtime_New (u32 size ) {
2523 DECLARE_INTERRUPT_MASK
2624 void * ptr ;
2725
@@ -41,8 +39,7 @@ void* func_800FC800(u32 size) {
4139 return ptr ;
4240}
4341
44- // possibly some kind of delete() function
45- void func_800FC83C (void * ptr ) {
42+ void Runtime_Delete (void * ptr ) {
4643 DECLARE_INTERRUPT_MASK
4744
4845 DISABLE_INTERRUPTS ();
@@ -81,7 +78,7 @@ void* func_800FC948(void* blk, u32 nBlk, u32 blkSize, arg3_800FC948 arg3) {
8178 DISABLE_INTERRUPTS ();
8279
8380 if (blk == NULL ) {
84- blk = func_800FC800 (nBlk * blkSize );
81+ blk = Runtime_New (nBlk * blkSize );
8582 }
8683
8784 if (blk != NULL && arg3 != NULL ) {
@@ -115,39 +112,39 @@ void func_800FCA18(void* blk, u32 nBlk, u32 blkSize, arg3_800FCA18 arg3, s32 arg
115112 }
116113
117114 if (arg4 != 0 ) {
118- func_800FC83C (blk );
115+ Runtime_Delete (blk );
119116 }
120117 }
121118
122119 RESTORE_INTERRUPTS ();
123120}
124121
125- void func_800FCB34 (void ) {
126- InitFunc * initFunc = (InitFunc * )& sInitFuncs ;
127- u32 nextOffset = initFunc -> nextOffset ;
128- InitFunc * prev = NULL ;
122+ void Runtime_ExecuteGlobalCtors (void ) {
123+ CtorEntry * ctorEntry = (CtorEntry * )& sGlobalCtorEntries ;
124+ u32 nextOffset = ctorEntry -> nextOffset ;
125+ CtorEntry * prevEntry = NULL ;
129126
130127 while (nextOffset != 0 ) {
131- initFunc = (InitFunc * )((s32 )initFunc + nextOffset );
128+ ctorEntry = (CtorEntry * )((s32 )ctorEntry + nextOffset );
132129
133- if (initFunc -> func != NULL ) {
134- initFunc -> func ();
130+ if (ctorEntry -> func != NULL ) {
131+ ctorEntry -> func ();
135132 }
136133
137- nextOffset = initFunc -> nextOffset ;
138- initFunc -> nextOffset = (s32 )prev ;
139- prev = initFunc ;
134+ nextOffset = ctorEntry -> nextOffset ;
135+ ctorEntry -> nextOffset = (s32 )prevEntry ;
136+ prevEntry = ctorEntry ;
140137 }
141138
142- sInitFuncs = prev ;
139+ sGlobalCtorEntries = prevEntry ;
143140}
144141
145- void SystemHeap_Init (void * start , u32 size ) {
142+ void Runtime_Init (void * start , u32 size ) {
146143#if PLATFORM_N64
147144 __osMallocInit (& gSystemArena , start , size );
148145#else
149146 SystemArena_Init (start , size );
150147#endif
151148
152- func_800FCB34 ();
149+ Runtime_ExecuteGlobalCtors ();
153150}
0 commit comments