Organize `libc64` files (#1492)

* Move qrand to libc64

* use an union to avoid type punning

* __osMalloc

* math64.c

* fixed_point.h

* sleep

* aprintf.h

* sprintf

* malloc

* use original names on aprintf.c and malloc.c

* qrand cleanup pass

* use original names of sleep.c

* og names for sprintf

* more cleanup

* format

* fixes

* whoops

* use ARRAY_COUNT again

* comment

* Use `fu`

* forgot this one

* review

* fix

* sneak a tiny cleanup
This commit is contained in:
Anghelo Carvajal 2023-11-26 22:01:42 -03:00 committed by GitHub
parent 34492a4386
commit 6dd1600936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 406 additions and 311 deletions

View File

@ -207,6 +207,8 @@ $(shell mkdir -p build/baserom $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(ASSET_BIN
# directory flags # directory flags
build/src/boot/O2/%.o: OPTFLAGS := -O2 build/src/boot/O2/%.o: OPTFLAGS := -O2
build/src/boot/libc64/%.o: OPTFLAGS := -O2
build/src/libultra/os/%.o: OPTFLAGS := -O1 build/src/libultra/os/%.o: OPTFLAGS := -O1
build/src/libultra/voice/%.o: OPTFLAGS := -O2 build/src/libultra/voice/%.o: OPTFLAGS := -O2
build/src/libultra/io/%.o: OPTFLAGS := -O2 build/src/libultra/io/%.o: OPTFLAGS := -O2

View File

@ -8,8 +8,6 @@ void bcopy(void* __src, void* __dest, int __n);
int bcmp(void* __s1, void* __s2, int __n); int bcmp(void* __s1, void* __s2, int __n);
void bzero(void* begin, int length); void bzero(void* begin, int length);
int vsprintf(char* dst, char* fmt, va_list args);
int sprintf(char* dst, const char* fmt, ...);
void osSyncPrintf(const char* fmt, ...); void osSyncPrintf(const char* fmt, ...);
#endif #endif

View File

@ -65,14 +65,6 @@ void MtxConv_L2F(MtxF* mtx, Mtx* mf);
s32 func_80086620(OSMesgQueue* param_1, PadMgr* param_2, OSContStatus* param_3); s32 func_80086620(OSMesgQueue* param_1, PadMgr* param_2, OSContStatus* param_3);
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
void Sleep_Cycles(OSTime time);
void Sleep_Nsec(u32 nsec);
void Sleep_Usec(u32 usec);
void Sleep_Msec(u32 ms);
void Sleep_Sec(u32 sec);
f32 fmodf(f32 dividend, f32 divisor); f32 fmodf(f32 dividend, f32 divisor);
void* __osMemset(void* ptr, s32 val, size_t size); void* __osMemset(void* ptr, s32 val, size_t size);
s32 __osStrcmp(const char* str1, const char* str2); s32 __osStrcmp(const char* str1, const char* str2);

View File

@ -1,8 +1,6 @@
#ifndef LIBC_MATH_H #ifndef LIBC_MATH_H
#define LIBC_MATH_H #define LIBC_MATH_H
#include "PR/ultratypes.h"
#define M_PI 3.14159265358979323846f #define M_PI 3.14159265358979323846f
#define M_SQRT2 1.41421356237309504880f #define M_SQRT2 1.41421356237309504880f
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */ #define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */

9
include/libc64/aprintf.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef LIBC64_APRINTF_H
#define LIBC64_APRINTF_H
#include "ultra64.h"
int vaprintf(PrintCallback* pfn, const char* fmt, va_list args);
int aprintf(PrintCallback* pfn, const char* fmt, ...);
#endif

View File

@ -1,5 +1,6 @@
#ifndef FIXED_POINT_H #ifndef FIXED_POINT_H
#define FIXED_POINT_H #define FIXED_POINT_H
#include "ultra64.h" #include "ultra64.h"
extern f32 qNaN0x3FFFFF; extern f32 qNaN0x3FFFFF;

20
include/libc64/malloc.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef LIBC64_MALLOC_H
#define LIBC64_MALLOC_H
#include "ultra64.h"
#include "libc64/os_malloc.h"
void* malloc(size_t size);
void* malloc_r(size_t size);
void* realloc(void* oldPtr, size_t newSize);
void free(void* ptr);
void* calloc(size_t num, size_t size);
void GetFreeArena(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated);
s32 CheckArena(void);
void MallocInit(void* start, size_t size);
void MallocCleanup(void);
s32 MallocIsInitialized(void);
extern Arena malloc_arena;
#endif

20
include/libc64/math64.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef LIBC64_MATH64_H
#define LIBC64_MATH64_H
#include "ultra64.h"
f32 Math_FTanF(f32 x);
f32 Math_FFloorF(f32 x);
f32 Math_FCeilF(f32 x);
f32 Math_FRoundF(f32 x);
f32 Math_FTruncF(f32 x);
f32 Math_FNearbyIntF(f32 x);
f32 Math_FAtanTaylorQF(f32 x);
f32 Math_FAtanTaylorF(f32 x);
f32 Math_FAtanContFracF(f32 x);
f32 Math_FAtanF(f32 x);
f32 Math_FAtan2F(f32 y, f32 x);
f32 Math_FAsinF(f32 x);
f32 Math_FAcosF(f32 x);
#endif

View File

@ -1,8 +1,7 @@
#ifndef OS_MALLOC_H #ifndef LIBC64_OS_MALLOC_H
#define OS_MALLOC_H #define LIBC64_OS_MALLOC_H
#include "PR/ultratypes.h" #include "ultra64.h"
#include "PR/os_message.h"
#include "libc/stddef.h" #include "libc/stddef.h"
typedef struct ArenaNode { typedef struct ArenaNode {
@ -13,7 +12,7 @@ typedef struct ArenaNode {
/* 0xC */ struct ArenaNode* prev; /* 0xC */ struct ArenaNode* prev;
} ArenaNode; // size = 0x10 } ArenaNode; // size = 0x10
typedef struct { typedef struct Arena {
/* 0x00 */ ArenaNode* head; /* 0x00 */ ArenaNode* head;
/* 0x04 */ void* start; /* 0x04 */ void* start;
/* 0x08 */ OSMesgQueue lock; /* 0x08 */ OSMesgQueue lock;

View File

@ -1,7 +1,7 @@
#ifndef RAND_H #ifndef LIBC64_QRAND_H
#define RAND_H #define LIBC64_QRAND_H
#include "PR/ultratypes.h" #include "ultra64.h"
//! These values are recommended by the algorithms book *Numerical Recipes in C. The Art of Scientific Computing*, 2nd //! These values are recommended by the algorithms book *Numerical Recipes in C. The Art of Scientific Computing*, 2nd
//! Edition, 1992, ISBN 0-521-43108-5. (p. 284): //! Edition, 1992, ISBN 0-521-43108-5. (p. 284):
@ -18,6 +18,6 @@ u32 Rand_Next_Variable(u32* rndNum);
f32 Rand_ZeroOne_Variable(u32* rndNum); f32 Rand_ZeroOne_Variable(u32* rndNum);
f32 Rand_Centered_Variable(u32* rndNum); f32 Rand_Centered_Variable(u32* rndNum);
extern u32 gRandFloat; extern fu gRandFloat;
#endif #endif

12
include/libc64/sleep.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef LIBC64_SLEEP_H
#define LIBC64_SLEEP_H
#include "ultra64.h"
void csleep(OSTime time);
void nsleep(u32 nsec);
void usleep(u32 usec);
void msleep(u32 msec);
void sleep(u32 sec);
#endif

9
include/libc64/sprintf.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef LIBC64_SPRINTF_H
#define LIBC64_SPRINTF_H
#include "ultra64.h"
int vsprintf(char* dst, const char* fmt, va_list args);
int sprintf(char* dst, const char* fmt, ...);
#endif

View File

@ -1,20 +0,0 @@
#ifndef SYSTEM_MALLOC_H
#define SYSTEM_MALLOC_H
#include "PR/ultratypes.h"
#include "os_malloc.h"
void* SystemArena_Malloc(size_t size);
void* SystemArena_MallocR(size_t size);
void* SystemArena_Realloc(void* oldPtr, size_t newSize);
void SystemArena_Free(void* ptr);
void* SystemArena_Calloc(size_t num, size_t size);
void SystemArena_GetSizes(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated);
u32 SystemArena_CheckArena(void);
void SystemArena_Init(void* start, size_t size);
void SystemArena_Cleanup(void);
u8 SystemArena_IsInitialized(void);
extern Arena gSystemArena;
#endif

View File

@ -17,7 +17,6 @@ extern s32 sIrqMgrRetraceCount;
// extern UNK_TYPE1 sGfxPrintRainbowData; // extern UNK_TYPE1 sGfxPrintRainbowData;
// extern UNK_TYPE1 sGfxPrintFontData; // extern UNK_TYPE1 sGfxPrintFontData;
// extern UNK_TYPE4 D_80097524; // extern UNK_TYPE4 D_80097524;
// extern u32 sRandInt;
extern u8 sYaz0DataBuffer[0x400]; extern u8 sYaz0DataBuffer[0x400];
extern u8* sYaz0CurDataEnd; extern u8* sYaz0CurDataEnd;

View File

@ -26,7 +26,7 @@
#include "gfx.h" #include "gfx.h"
#include "gfxprint.h" #include "gfxprint.h"
#include "padutils.h" #include "padutils.h"
#include "rand.h" #include "libc64/qrand.h"
#include "sys_matrix.h" #include "sys_matrix.h"
#include "tha.h" #include "tha.h"
#include "thga.h" #include "thga.h"

View File

@ -4,6 +4,8 @@
#include "ultra64.h" #include "ultra64.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc64/math64.h"
#define VEC_SET(V,X,Y,Z) V.x=X;V.y=Y;V.z=Z #define VEC_SET(V,X,Y,Z) V.x=X;V.y=Y;V.z=Z
typedef struct { typedef struct {
@ -240,20 +242,6 @@ f32 Math_CosF(f32 rad);
f32 Rand_ZeroFloat(f32 scale); f32 Rand_ZeroFloat(f32 scale);
f32 Rand_CenteredFloat(f32 scale); f32 Rand_CenteredFloat(f32 scale);
f32 Math_FTanF(f32 x);
f32 Math_FFloorF(f32 x);
f32 Math_FCeilF(f32 x);
f32 Math_FRoundF(f32 x);
f32 Math_FTruncF(f32 x);
f32 Math_FNearbyIntF(f32 x);
f32 Math_FAtanTaylorQF(f32 x);
f32 Math_FAtanTaylorF(f32 x);
f32 Math_FAtanContFracF(f32 x);
f32 Math_FAtanF(f32 x);
f32 Math_FAtan2F(f32 y, f32 x);
f32 Math_FAsinF(f32 x);
f32 Math_FAcosF(f32 x);
s16 Math_Atan2S(f32 y, f32 x); s16 Math_Atan2S(f32 y, f32 x);
f32 Math_Atan2F(f32 y, f32 x); f32 Math_Atan2F(f32 y, f32 x);
s16 Math_Atan2S_XY(f32 x, f32 y); s16 Math_Atan2S_XY(f32 x, f32 y);

16
spec
View File

@ -41,15 +41,15 @@ beginseg
include "build/src/boot/O2/debug.o" include "build/src/boot/O2/debug.o"
include "build/src/boot/O2/system_heap.o" include "build/src/boot/O2/system_heap.o"
include "build/src/boot/O2/padsetup.o" include "build/src/boot/O2/padsetup.o"
include "build/src/boot/O2/math64.o" include "build/src/boot/libc64/math64.o"
include "build/asm/boot/fp.text.o" include "build/asm/boot/fp.text.o" // Part of libc64
include "build/data/boot/fp.data.o" include "build/data/boot/fp.data.o"
include "build/src/boot/O2/system_malloc.o" include "build/src/boot/libc64/malloc.o"
include "build/src/boot/O2/rand.o" include "build/src/boot/libc64/qrand.o"
include "build/src/boot/O2/__osMalloc.o" include "build/src/boot/libc64/__osMalloc.o"
include "build/src/boot/O2/sprintf.o" include "build/src/boot/libc64/sprintf.o"
include "build/src/boot/O2/printutils.o" include "build/src/boot/libc64/aprintf.o"
include "build/src/boot/O2/sleep.o" include "build/src/boot/libc64/sleep.o"
include "build/asm/boot/setcause.text.o" include "build/asm/boot/setcause.text.o"
include "build/src/libultra/os/sendmesg.o" include "build/src/libultra/os/sendmesg.o"
include "build/src/libultra/io/pfsfreeblocks.o" include "build/src/libultra/io/pfsfreeblocks.o"

View File

@ -1,4 +1,5 @@
#include "global.h" #include "global.h"
#include "libc64/aprintf.h"
#define GFXP_FLAG_HIRAGANA (1 << 0) #define GFXP_FLAG_HIRAGANA (1 << 0)
#define GFXP_FLAG_RAINBOW (1 << 1) #define GFXP_FLAG_RAINBOW (1 << 1)
@ -220,7 +221,7 @@ Gfx* GfxPrint_Close(GfxPrint* this) {
} }
s32 GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) { s32 GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
return PrintUtils_VPrintf(&this->callback, fmt, args); return vaprintf(&this->callback, fmt, args);
} }
s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) { s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {

View File

@ -11,7 +11,7 @@
*/ */
#include "global.h" #include "global.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "loadfragment.h" #include "loadfragment.h"
s32 gLoadLogSeverity = 2; s32 gLoadLogSeverity = 2;
@ -186,7 +186,7 @@ void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vra
if (gLoadLogSeverity >= 3) {} if (gLoadLogSeverity >= 3) {}
allocatedRamAddr = SystemArena_MallocR(size); allocatedRamAddr = malloc_r(size);
end = (uintptr_t)allocatedRamAddr + size; end = (uintptr_t)allocatedRamAddr + size;
if (gLoadLogSeverity >= 3) {} if (gLoadLogSeverity >= 3) {}
@ -202,7 +202,7 @@ void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vra
allocatedBytes = ovlRelocs->bssSize + size; allocatedBytes = ovlRelocs->bssSize + size;
allocatedRamAddr = SystemArena_Realloc(allocatedRamAddr, allocatedBytes); allocatedRamAddr = realloc(allocatedRamAddr, allocatedBytes);
if (gLoadLogSeverity >= 3) {} if (gLoadLogSeverity >= 3) {}

View File

@ -7,7 +7,7 @@
* These are for specific fragment overlays with the .ovl file extension * These are for specific fragment overlays with the .ovl file extension
*/ */
#include "global.h" #include "global.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "loadfragment.h" #include "loadfragment.h"
s32 gOverlayLogSeverity = 2; s32 gOverlayLogSeverity = 2;
@ -167,7 +167,7 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void
} }
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) { void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) {
void* allocatedRamAddr = SystemArena_MallocR((uintptr_t)vramEnd - (uintptr_t)vramStart); void* allocatedRamAddr = malloc_r((uintptr_t)vramEnd - (uintptr_t)vramStart);
if (allocatedRamAddr != NULL) { if (allocatedRamAddr != NULL) {
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr); Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);

View File

@ -1,17 +0,0 @@
#include "global.h"
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args) {
return _Printf(*pfn, pfn, fmt, args);
}
s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...) {
s32 ret;
va_list args;
va_start(args, fmt);
ret = PrintUtils_VPrintf(pfn, fmt, args);
va_end(args);
return ret;
}

View File

@ -1,27 +0,0 @@
#include "global.h"
void Sleep_Cycles(u64 time) {
OSMesgQueue mq;
OSMesg msg[1];
OSTimer timer;
osCreateMesgQueue(&mq, msg, ARRAY_COUNT(msg));
osSetTimer(&timer, time, 0, &mq, NULL);
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
}
void Sleep_Nsec(u32 nsec) {
Sleep_Cycles(OS_NSEC_TO_CYCLES(nsec));
}
void Sleep_Usec(u32 usec) {
Sleep_Cycles(OS_USEC_TO_CYCLES(usec));
}
void Sleep_Msec(u32 ms) {
Sleep_Cycles((ms * OS_CPU_COUNTER) / 1000ULL);
}
void Sleep_Sec(u32 sec) {
Sleep_Cycles(sec * OS_CPU_COUNTER);
}

View File

@ -2,11 +2,11 @@
* @file system_heap.c * @file system_heap.c
* *
* @note: * @note:
* Only SystemHeap_Init() is used, and is essentially just a wrapper for SystemArena_Init(). * Only SystemHeap_Init() is used, and is essentially just a wrapper for MallocInit().
* *
*/ */
#include "global.h" #include "global.h"
#include "system_malloc.h" #include "libc64/malloc.h"
typedef void (*BlockFunc)(uintptr_t); typedef void (*BlockFunc)(uintptr_t);
typedef void (*BlockFunc1)(uintptr_t, u32); typedef void (*BlockFunc1)(uintptr_t, u32);
@ -31,12 +31,12 @@ void* SystemHeap_Malloc(size_t size) {
size = 1; size = 1;
} }
return __osMalloc(&gSystemArena, size); return __osMalloc(&malloc_arena, size);
} }
void SystemHeap_Free(void* ptr) { void SystemHeap_Free(void* ptr) {
if (ptr != NULL) { if (ptr != NULL) {
__osFree(&gSystemArena, ptr); __osFree(&malloc_arena, ptr);
} }
} }
@ -118,6 +118,6 @@ void SystemHeap_RunInits(void) {
} }
void SystemHeap_Init(void* start, size_t size) { void SystemHeap_Init(void* start, size_t size) {
SystemArena_Init(start, size); MallocInit(start, size);
SystemHeap_RunInits(); SystemHeap_RunInits();
} }

View File

@ -1,51 +0,0 @@
#include "global.h"
#include "os_malloc.h"
Arena gSystemArena;
void* SystemArena_Malloc(size_t size) {
return __osMalloc(&gSystemArena, size);
}
void* SystemArena_MallocR(size_t size) {
return __osMallocR(&gSystemArena, size);
}
void* SystemArena_Realloc(void* oldPtr, size_t newSize) {
return __osRealloc(&gSystemArena, oldPtr, newSize);
}
void SystemArena_Free(void* ptr) {
__osFree(&gSystemArena, ptr);
}
void* SystemArena_Calloc(size_t num, size_t size) {
void* ptr;
size_t totalSize = num * size;
ptr = __osMalloc(&gSystemArena, totalSize);
if (ptr != NULL) {
bzero(ptr, totalSize);
}
return ptr;
}
void SystemArena_GetSizes(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated) {
__osGetSizes(&gSystemArena, maxFreeBlock, bytesFree, bytesAllocated);
}
u32 SystemArena_CheckArena(void) {
return __osCheckArena(&gSystemArena);
}
void SystemArena_Init(void* start, size_t size) {
__osMallocInit(&gSystemArena, start, size);
}
void SystemArena_Cleanup(void) {
__osMallocCleanup(&gSystemArena);
}
u8 SystemArena_IsInitialized(void) {
return __osMallocIsInitalized(&gSystemArena);
}

View File

@ -42,8 +42,11 @@
#include "fault_internal.h" #include "fault_internal.h"
#include "fault.h" #include "fault.h"
#include "prevent_bss_reordering.h" #include "prevent_bss_reordering.h"
#include "prevent_bss_reordering2.h" #include "prevent_bss_reordering2.h"
#include "libc64/sprintf.h"
#include "libc64/sleep.h"
#include "vt.h" #include "vt.h"
#include "PR/osint.h" #include "PR/osint.h"
#include "stackcheck.h" #include "stackcheck.h"
@ -81,10 +84,10 @@ const char* sFpuExceptions[] = {
"Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation", "Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation",
}; };
void Fault_SleepImpl(u32 duration) { void Fault_SleepImpl(u32 msec) {
OSTime value = (duration * OS_CPU_COUNTER) / 1000ULL; OSTime value = (msec * OS_CPU_COUNTER) / 1000ULL;
Sleep_Cycles(value); csleep(value);
} }
/** /**

View File

@ -1,8 +1,10 @@
#include "os_malloc.h" #include "libc64/os_malloc.h"
#include "alignment.h"
#include "functions.h" // for __osMemcpy
#include "libc/stdbool.h" #include "libc/stdbool.h"
#include "libc/stdint.h" #include "libc/stdint.h"
#include "macros.h" #include "macros.h" // for ARRAY_COUNT
#include "functions.h"
#define FILL_ALLOCBLOCK (1 << 0) #define FILL_ALLOCBLOCK (1 << 0)
#define FILL_FREEBLOCK (1 << 1) #define FILL_FREEBLOCK (1 << 1)

17
src/boot/libc64/aprintf.c Normal file
View File

@ -0,0 +1,17 @@
#include "libc64/aprintf.h"
int vaprintf(PrintCallback* pfn, const char* fmt, va_list args) {
return _Printf(*pfn, pfn, fmt, args);
}
int aprintf(PrintCallback* pfn, const char* fmt, ...) {
int ret;
va_list args;
va_start(args, fmt);
ret = vaprintf(pfn, fmt, args);
va_end(args);
return ret;
}

50
src/boot/libc64/malloc.c Normal file
View File

@ -0,0 +1,50 @@
#include "libc64/malloc.h"
Arena malloc_arena;
void* malloc(size_t size) {
return __osMalloc(&malloc_arena, size);
}
void* malloc_r(size_t size) {
return __osMallocR(&malloc_arena, size);
}
void* realloc(void* oldPtr, size_t newSize) {
return __osRealloc(&malloc_arena, oldPtr, newSize);
}
void free(void* ptr) {
__osFree(&malloc_arena, ptr);
}
void* calloc(size_t num, size_t size) {
void* ptr;
size_t totalSize = num * size;
ptr = __osMalloc(&malloc_arena, totalSize);
if (ptr != NULL) {
bzero(ptr, totalSize);
}
return ptr;
}
void GetFreeArena(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated) {
__osGetSizes(&malloc_arena, maxFreeBlock, bytesFree, bytesAllocated);
}
s32 CheckArena(void) {
return __osCheckArena(&malloc_arena);
}
void MallocInit(void* start, size_t size) {
__osMallocInit(&malloc_arena, start, size);
}
void MallocCleanup(void) {
__osMallocCleanup(&malloc_arena);
}
s32 MallocIsInitialized(void) {
return __osMallocIsInitalized(&malloc_arena);
}

View File

@ -2,8 +2,12 @@
* MathF library * MathF library
* Contains tangent function, wrappers for a number of the handwritten functions in fp, and a suite of arctangents * Contains tangent function, wrappers for a number of the handwritten functions in fp, and a suite of arctangents
*/ */
#include "global.h"
#include "fixed_point.h" #include "libc64/math64.h"
#include "libc64/fixed_point.h"
#include "libc/stdbool.h"
#include "libc/math.h"
s32 gUseAtanContFrac; s32 gUseAtanContFrac;
@ -49,7 +53,7 @@ f32 Math_FAtanTaylorQF(f32 x) {
}; };
f32 poly = x; f32 poly = x;
f32 sq = SQ(x); f32 sq = x * x;
f32 exp = x * sq; f32 exp = x * sq;
const f32* c = coeffs; const f32* c = coeffs;
f32 term; f32 term;
@ -129,11 +133,11 @@ f32 Math_FAtanContFracF(f32 x) {
} }
// Builds the continued fraction from the innermost fraction out // Builds the continued fraction from the innermost fraction out
sq = SQ(x); sq = x * x;
conv = 0.0f; conv = 0.0f;
z = 8.0f; z = 8.0f;
for (i = 8; i != 0; i--) { for (i = 8; i > 0; i--) {
conv = SQ(z) * sq / (2.0f * z + 1.0f + conv); conv = (z * z) * sq / (2.0f * z + 1.0f + conv);
z -= 1.0f; z -= 1.0f;
} }
conv = x / (1.0f + conv); conv = x / (1.0f + conv);
@ -183,7 +187,7 @@ f32 Math_FAtan2F(f32 y, f32 x) {
} }
f32 Math_FAsinF(f32 x) { f32 Math_FAsinF(f32 x) {
return Math_FAtan2F(x, sqrtf(1.0f - SQ(x))); return Math_FAtan2F(x, sqrtf(1.0f - (x * x)));
} }
f32 Math_FAcosF(f32 x) { f32 Math_FAcosF(f32 x) {

View File

@ -1,21 +1,34 @@
#include "rand.h" #include "libc64/qrand.h"
//! The latest generated random number, used to generate the next number in the sequence. /**
static u32 sRandInt = 1; * The latest generated random number, used to generate the next number in the sequence.
*
* Original name: __qrand_idum
*/
u32 sRandInt = 1;
//! Space to store a value to be re-interpreted as a float. /**
//! This can't be static because it is used in z_kankyo. * Space to store a value to be re-interpreted as a float.
u32 gRandFloat; *
* Orignal name: __qrand_itemp
*/
fu gRandFloat;
/** /**
* Generates the next pseudo-random integer. * Generates the next pseudo-random integer.
*
* Original name: qrand
*/ */
u32 Rand_Next(void) { u32 Rand_Next(void) {
return sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT; sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT;
return sRandInt;
} }
/** /**
* Seeds the internal pseudo-random number generator with a provided starting value. * Seeds the internal pseudo-random number generator with a provided starting value.
*
* Original name: sqrand
*/ */
void Rand_Seed(u32 seed) { void Rand_Seed(u32 seed) {
sRandInt = seed; sRandInt = seed;
@ -28,20 +41,24 @@ void Rand_Seed(u32 seed) {
* subtracting 1.0f. * subtracting 1.0f.
* *
* @remark This is also recommended by Numerical Recipes, pp. 284-5. * @remark This is also recommended by Numerical Recipes, pp. 284-5.
*
* Original name: fqrand
*/ */
f32 Rand_ZeroOne(void) { f32 Rand_ZeroOne(void) {
sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT; sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT;
gRandFloat = ((sRandInt >> 9) | 0x3F800000); gRandFloat.i = ((sRandInt >> 9) | 0x3F800000);
return *((f32*)&gRandFloat) - 1.0f; return gRandFloat.f - 1.0f;
} }
/** /**
* Returns a pseudo-random float between -0.5f and 0.5f in the same way as Rand_ZeroOne(). * Returns a pseudo-random float between -0.5f and 0.5f in the same way as Rand_ZeroOne().
*
* Original name: fqrand2
*/ */
f32 Rand_Centered(void) { f32 Rand_Centered(void) {
sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT; sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT;
gRandFloat = ((sRandInt >> 9) | 0x3F800000); gRandFloat.i = ((sRandInt >> 9) | 0x3F800000);
return *((f32*)&gRandFloat) - 1.5f; return gRandFloat.f - 1.5f;
} }
//! All functions below are unused variants of the above four, that use a provided random number variable instead of the //! All functions below are unused variants of the above four, that use a provided random number variable instead of the
@ -51,6 +68,8 @@ f32 Rand_Centered(void) {
* Seeds a provided pseudo-random number with a provided starting value. * Seeds a provided pseudo-random number with a provided starting value.
* *
* @see Rand_Seed * @see Rand_Seed
*
* Original name: sqrand_r
*/ */
void Rand_Seed_Variable(u32* rndNum, u32 seed) { void Rand_Seed_Variable(u32* rndNum, u32 seed) {
*rndNum = seed; *rndNum = seed;
@ -60,31 +79,40 @@ void Rand_Seed_Variable(u32* rndNum, u32 seed) {
* Generates the next pseudo-random number from the provided rndNum. * Generates the next pseudo-random number from the provided rndNum.
* *
* @see Rand_Next * @see Rand_Next
*
* Original name: qrand_r
*/ */
u32 Rand_Next_Variable(u32* rndNum) { u32 Rand_Next_Variable(u32* rndNum) {
return *rndNum = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT; u32 t = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
*rndNum = t;
return t;
} }
/** /**
* Generates the next pseudo-random float between 0.0f and 1.0f from the provided rndNum. * Generates the next pseudo-random float between 0.0f and 1.0f from the provided rndNum.
* *
* @see Rand_ZeroOne * @see Rand_ZeroOne
*
* Original name: fqrand_r
*/ */
f32 Rand_ZeroOne_Variable(u32* rndNum) { f32 Rand_ZeroOne_Variable(u32* rndNum) {
u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT; u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
gRandFloat = ((*rndNum = next) >> 9) | 0x3F800000; gRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000;
return *((f32*)&gRandFloat) - 1.0f; return gRandFloat.f - 1.0f;
} }
/** /**
* Generates the next pseudo-random float between -0.5f and 0.5f from the provided rndNum. * Generates the next pseudo-random float between -0.5f and 0.5f from the provided rndNum.
* *
* @see Rand_ZeroOne, Rand_Centered * @see Rand_ZeroOne, Rand_Centered
*
* Original name: fqrand2_r
*/ */
f32 Rand_Centered_Variable(u32* rndNum) { f32 Rand_Centered_Variable(u32* rndNum) {
u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT; u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
gRandFloat = ((*rndNum = next) >> 9) | 0x3F800000; gRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000;
return *((f32*)&gRandFloat) - 1.5f; return gRandFloat.f - 1.5f;
} }

28
src/boot/libc64/sleep.c Normal file
View File

@ -0,0 +1,28 @@
#include "libc64/sleep.h"
#include "macros.h" // for ARRAY_COUNT
void csleep(OSTime time) {
OSMesgQueue mq;
OSMesg msg[1];
OSTimer timer;
osCreateMesgQueue(&mq, msg, ARRAY_COUNT(msg));
osSetTimer(&timer, time, 0, &mq, NULL);
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
}
void nsleep(u32 nsec) {
csleep(OS_NSEC_TO_CYCLES(nsec));
}
void usleep(u32 usec) {
csleep(OS_USEC_TO_CYCLES(usec));
}
void msleep(u32 msec) {
csleep((msec * OS_CPU_COUNTER) / 1000ULL);
}
void sleep(u32 sec) {
csleep(sec * OS_CPU_COUNTER);
}

View File

@ -1,13 +1,14 @@
#include "ultra64.h" #include "libc64/sprintf.h"
#include "libc/stdlib.h"
#include "libc/string.h" #include "libc/string.h"
void* proutSprintf(void* dst, const char* fmt, size_t size) { void* proutPrintf(void* dst, const char* fmt, size_t size) {
return (void*)((uintptr_t)memcpy(dst, fmt, size) + size); return (void*)((uintptr_t)memcpy(dst, fmt, size) + size);
} }
int vsprintf(char* dst, char* fmt, va_list args) { int vsprintf(char* dst, const char* fmt, va_list args) {
int ans = _Printf(proutSprintf, dst, fmt, args); int ans = _Printf(proutPrintf, dst, fmt, args);
if (ans > -1) { if (ans > -1) {
dst[ans] = 0; dst[ans] = 0;
} }
@ -19,7 +20,7 @@ int sprintf(char* dst, const char* fmt, ...) {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
ans = _Printf(&proutSprintf, dst, fmt, args); ans = _Printf(&proutPrintf, dst, fmt, args);
if (ans > -1) { if (ans > -1) {
dst[ans] = 0; dst[ans] = 0;
} }

View File

@ -1,5 +1,7 @@
#include "global.h" #include "global.h"
#include "fault.h" #include "fault.h"
#include "libc64/sprintf.h"
#include "libc64/sleep.h"
u8 sYaz0DataBuffer[0x400] ALIGNED(16); u8 sYaz0DataBuffer[0x400] ALIGNED(16);
u8* sYaz0CurDataEnd; u8* sYaz0CurDataEnd;
@ -131,7 +133,7 @@ void Yaz0_Decompress(uintptr_t romStart, void* dst, size_t size) {
if (sYaz0CurDataEnd != NULL) { if (sYaz0CurDataEnd != NULL) {
while (sYaz0CurDataEnd != NULL) { while (sYaz0CurDataEnd != NULL) {
Sleep_Usec(10); usleep(10);
} }
} }

View File

@ -1,7 +1,8 @@
#include "global.h" #include "global.h"
#include "libc64/sleep.h"
void func_80183070(void) { void func_80183070(void) {
for (;;) { for (;;) {
Sleep_Msec(1000); msleep(1000);
} }
} }

View File

@ -2,7 +2,7 @@
#include "audiomgr.h" #include "audiomgr.h"
#include "idle.h" #include "idle.h"
#include "sys_cfb.h" #include "sys_cfb.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "z64debug_text.h" #include "z64debug_text.h"
#include "z64rumble.h" #include "z64rumble.h"
#include "z64speed_meter.h" #include "z64speed_meter.h"
@ -182,7 +182,7 @@ void GameState_Realloc(GameState* gameState, size_t size) {
THA_Destroy(&gameState->tha); THA_Destroy(&gameState->tha);
GameAlloc_Free(alloc, heapStart); GameAlloc_Free(alloc, heapStart);
SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated); GetFreeArena(&systemMaxFree, &bytesFree, &bytesAllocated);
size = ((systemMaxFree - sizeof(ArenaNode)) < size) ? 0 : size; size = ((systemMaxFree - sizeof(ArenaNode)) < size) ? 0 : size;
if (size == 0) { if (size == 0) {
size = systemMaxFree - sizeof(ArenaNode); size = systemMaxFree - sizeof(ArenaNode);

View File

@ -1,6 +1,6 @@
#include "gamealloc.h" #include "gamealloc.h"
#include "system_malloc.h" #include "libc64/malloc.h"
void GameAlloc_Log(GameAlloc* this) { void GameAlloc_Log(GameAlloc* this) {
GameAllocEntry* iter = this->base.next; GameAllocEntry* iter = this->base.next;
@ -11,7 +11,7 @@ void GameAlloc_Log(GameAlloc* this) {
} }
void* GameAlloc_Malloc(GameAlloc* this, size_t size) { void* GameAlloc_Malloc(GameAlloc* this, size_t size) {
GameAllocEntry* ptr = SystemArena_Malloc(size + sizeof(GameAllocEntry)); GameAllocEntry* ptr = malloc(size + sizeof(GameAllocEntry));
if (ptr != NULL) { if (ptr != NULL) {
ptr->size = size; ptr->size = size;
@ -34,7 +34,7 @@ void GameAlloc_Free(GameAlloc* this, void* data) {
ptr->prev->next = ptr->next; ptr->prev->next = ptr->next;
ptr->next->prev = ptr->prev; ptr->next->prev = ptr->prev;
this->head = this->base.prev; this->head = this->base.prev;
SystemArena_Free(ptr); free(ptr);
} }
} }
@ -45,7 +45,7 @@ void GameAlloc_Cleanup(GameAlloc* this) {
while (&this->base != next) { while (&this->base != next) {
cur = next; cur = next;
next = next->next; next = next->next;
SystemArena_Free(cur); free(cur);
} }
this->head = &this->base; this->head = &this->base;

View File

@ -16,7 +16,7 @@ OSTime sGraphPrevUpdateEndTime;
#include "buffers.h" #include "buffers.h"
#include "idle.h" #include "idle.h"
#include "sys_cfb.h" #include "sys_cfb.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "z64speed_meter.h" #include "z64speed_meter.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h" #include "overlays/gamestates/ovl_file_choose/z_file_select.h"
@ -341,13 +341,12 @@ void Graph_ThreadEntry(void* arg) {
u32 size; u32 size;
s32 pad[2]; s32 pad[2];
gZBufferLoRes = SystemArena_Malloc(sizeof(*gZBufferLoRes) + sizeof(*gWorkBufferLoRes) + 64 - 1); gZBufferLoRes = malloc(sizeof(*gZBufferLoRes) + sizeof(*gWorkBufferLoRes) + 64 - 1);
gZBufferLoRes = (void*)ALIGN64((u32)gZBufferLoRes); gZBufferLoRes = (void*)ALIGN64((u32)gZBufferLoRes);
gWorkBufferLoRes = (void*)((u8*)gZBufferLoRes + sizeof(*gZBufferLoRes)); gWorkBufferLoRes = (void*)((u8*)gZBufferLoRes + sizeof(*gZBufferLoRes));
gGfxSPTaskOutputBufferHiRes = gGfxSPTaskOutputBufferLoRes = gGfxSPTaskOutputBufferHiRes = gGfxSPTaskOutputBufferLoRes = malloc(sizeof(*gGfxSPTaskOutputBufferLoRes));
SystemArena_Malloc(sizeof(*gGfxSPTaskOutputBufferLoRes));
gGfxSPTaskOutputBufferEndLoRes = (u8*)gGfxSPTaskOutputBufferLoRes + sizeof(*gGfxSPTaskOutputBufferLoRes); gGfxSPTaskOutputBufferEndLoRes = (u8*)gGfxSPTaskOutputBufferLoRes + sizeof(*gGfxSPTaskOutputBufferLoRes);
gGfxSPTaskOutputBufferEndHiRes = (u8*)gGfxSPTaskOutputBufferHiRes + sizeof(*gGfxSPTaskOutputBufferHiRes); gGfxSPTaskOutputBufferEndHiRes = (u8*)gGfxSPTaskOutputBufferHiRes + sizeof(*gGfxSPTaskOutputBufferHiRes);
@ -365,7 +364,7 @@ void Graph_ThreadEntry(void* arg) {
func_800809F4(ovl->vromStart); func_800809F4(ovl->vromStart);
gameState = SystemArena_Malloc(size); gameState = malloc(size);
bzero(gameState, size); bzero(gameState, size);
GameState_Init(gameState, ovl->init, &gfxCtx); GameState_Init(gameState, ovl->init, &gfxCtx);
@ -379,7 +378,7 @@ void Graph_ThreadEntry(void* arg) {
if (size) {} if (size) {}
GameState_Destroy(gameState); GameState_Destroy(gameState);
SystemArena_Free(gameState); free(gameState);
Overlay_FreeGameState(ovl); Overlay_FreeGameState(ovl);
} }

View File

@ -1,5 +1,5 @@
#include "listalloc.h" #include "listalloc.h"
#include "system_malloc.h" #include "libc64/malloc.h"
ListAlloc* ListAlloc_Init(ListAlloc* this) { ListAlloc* ListAlloc_Init(ListAlloc* this) {
this->prev = NULL; this->prev = NULL;
@ -8,7 +8,7 @@ ListAlloc* ListAlloc_Init(ListAlloc* this) {
} }
void* ListAlloc_Alloc(ListAlloc* this, size_t size) { void* ListAlloc_Alloc(ListAlloc* this, size_t size) {
ListAlloc* ptr = SystemArena_Malloc(size + sizeof(ListAlloc)); ListAlloc* ptr = malloc(size + sizeof(ListAlloc));
ListAlloc* next; ListAlloc* next;
if (ptr == NULL) { if (ptr == NULL) {
@ -50,7 +50,7 @@ void ListAlloc_Free(ListAlloc* this, void* data) {
this->next = ptr->prev; this->next = ptr->prev;
} }
SystemArena_Free(ptr); free(ptr);
} }
void ListAlloc_FreeAll(ListAlloc* this) { void ListAlloc_FreeAll(ListAlloc* this) {

View File

@ -34,6 +34,7 @@
#include "global.h" #include "global.h"
#include "PR/controller.h" #include "PR/controller.h"
#include "PR/os_motor.h" #include "PR/os_motor.h"
#include "libc64/sprintf.h"
#include "fault.h" #include "fault.h"
#include "z64voice.h" #include "z64voice.h"

View File

@ -1,5 +1,6 @@
#include "fault.h" #include "fault.h"
#include "idle.h" #include "idle.h"
#include "libc64/sleep.h"
#include "z64.h" #include "z64.h"
// Variables are put before most headers as a hacky way to bypass bss reordering // Variables are put before most headers as a hacky way to bypass bss reordering
@ -87,7 +88,7 @@ void Sched_HandleAudioCancel(SchedContext* sched) {
osSyncPrintf("AUDIO SP止まりませんでした(10msタイムアウト)\n"); osSyncPrintf("AUDIO SP止まりませんでした(10msタイムアウト)\n");
goto send_mesg; goto send_mesg;
} }
Sleep_Usec(100); usleep(100);
} }
// AUDIO SP stopped (% d * 100us) // AUDIO SP stopped (% d * 100us)
osSyncPrintf("AUDIO SP止まりました(%d * 100us)\n", i); osSyncPrintf("AUDIO SP止まりました(%d * 100us)\n", i);
@ -150,7 +151,7 @@ void Sched_HandleGfxCancel(SchedContext* sched) {
osSyncPrintf("GRAPH SP止まりませんでした(10msタイムアウト)\n"); osSyncPrintf("GRAPH SP止まりませんでした(10msタイムアウト)\n");
goto send_mesg; goto send_mesg;
} }
Sleep_Usec(100); usleep(100);
} }
// GRAPH SP stopped (%d * 100us) // GRAPH SP stopped (%d * 100us)
osSyncPrintf("GRAPH SP止まりました(%d * 100us)\n", i); osSyncPrintf("GRAPH SP止まりました(%d * 100us)\n", i);

View File

@ -4,7 +4,7 @@
#include "gfx.h" #include "gfx.h"
#include "regs.h" #include "regs.h"
#include "sys_cfb.h" #include "sys_cfb.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "z64game.h" #include "z64game.h"
#include "z64malloc.h" #include "z64malloc.h"
#include "z64view.h" #include "z64view.h"
@ -240,7 +240,7 @@ void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, Gam
} }
if (R_ENABLE_ARENA_DBG > 1) { if (R_ENABLE_ARENA_DBG > 1) {
SystemArena_GetSizes((size_t*)&sysFreeMax, (size_t*)&sysFree, (size_t*)&sysAlloc); GetFreeArena((size_t*)&sysFreeMax, (size_t*)&sysFree, (size_t*)&sysAlloc);
SpeedMeter_InitAllocEntry(&entry, sysFree + sysAlloc - state->tha.size, sysAlloc - state->tha.size, SpeedMeter_InitAllocEntry(&entry, sysFree + sysAlloc - state->tha.size, sysAlloc - state->tha.size,
GPACK_RGBA5551(0, 0, 255, 1), GPACK_RGBA5551(255, 128, 128, 1), ulx, lrx, y, y); GPACK_RGBA5551(0, 0, 255, 1), GPACK_RGBA5551(255, 128, 128, 1), ulx, lrx, y, y);
SpeedMeter_DrawAllocEntry(&entry, gfxCtx); SpeedMeter_DrawAllocEntry(&entry, gfxCtx);

View File

@ -38,7 +38,7 @@ u8 gSysCfbHiResEnabled;
#include "sys_cfb.h" #include "sys_cfb.h"
#include "libc/stdbool.h" #include "libc/stdbool.h"
#include "buffers.h" #include "buffers.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "z64vimode.h" #include "z64vimode.h"
void SysCfb_SetLoResMode(void) { void SysCfb_SetLoResMode(void) {

View File

@ -1,5 +1,5 @@
#include "global.h" #include "global.h"
#include "system_malloc.h" #include "libc64/malloc.h"
typedef struct { typedef struct {
/* 0x0 */ union { /* 0x0 */ union {
@ -83,11 +83,11 @@ void CmpDma_LoadFileImpl(uintptr_t segmentRom, s32 id, void* dst, size_t size) {
CmpDma_GetFileInfo(segmentRom, id, &romStart, &compressedSize, &flag); CmpDma_GetFileInfo(segmentRom, id, &romStart, &compressedSize, &flag);
if (flag & 1) { if (flag & 1) {
void* tempBuf = SystemArena_Malloc(0x1000); void* tempBuf = malloc(0x1000);
CmpDma_Decompress(romStart, compressedSize, tempBuf); CmpDma_Decompress(romStart, compressedSize, tempBuf);
func_80178AC0(tempBuf, dst, size); func_80178AC0(tempBuf, dst, size);
SystemArena_Free(tempBuf); free(tempBuf);
} else { } else {
CmpDma_Decompress(romStart, compressedSize, dst); CmpDma_Decompress(romStart, compressedSize, dst);
} }

View File

@ -3,7 +3,7 @@
#include "fault.h" #include "fault.h"
#include "stack.h" #include "stack.h"
#include "stackcheck.h" #include "stackcheck.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "z64thread.h" #include "z64thread.h"
#include "sys_flashrom.h" #include "sys_flashrom.h"
#include "PR/os_internal_flash.h" #include "PR/os_internal_flash.h"
@ -172,7 +172,7 @@ s32 SysFlashrom_WriteData(void* addr, u32 pageNum, u32 pageCount) {
return -1; return -1;
} }
size = pageCount * FLASH_BLOCK_SIZE; size = pageCount * FLASH_BLOCK_SIZE;
data = SystemArena_Malloc(size); data = malloc(size);
if (data == NULL) { if (data == NULL) {
ret = SysFlashrom_AttemptWrite(addr, pageNum, pageCount); ret = SysFlashrom_AttemptWrite(addr, pageNum, pageCount);
} else { } else {
@ -195,7 +195,7 @@ s32 SysFlashrom_WriteData(void* addr, u32 pageNum, u32 pageCount) {
} }
} }
} }
SystemArena_Free(data); free(data);
} }
return ret; return ret;
} }

View File

@ -1,5 +1,5 @@
#include "global.h" #include "global.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "loadfragment.h" #include "loadfragment.h"
void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { void Overlay_LoadGameState(GameStateOverlay* overlayEntry) {
@ -89,7 +89,7 @@ void Overlay_FreeGameState(GameStateOverlay* overlayEntry) {
(uintptr_t)overlayEntry->loadedRamAddr)) (uintptr_t)overlayEntry->loadedRamAddr))
: NULL); : NULL);
SystemArena_Free(overlayEntry->loadedRamAddr); free(overlayEntry->loadedRamAddr);
overlayEntry->loadedRamAddr = NULL; overlayEntry->loadedRamAddr = NULL;
} }
} }

View File

@ -1,7 +1,8 @@
#include "prevent_bss_reordering.h" #include "prevent_bss_reordering.h"
#include "global.h" #include "global.h"
#include "fault.h" #include "fault.h"
#include "fixed_point.h" #include "libc64/fixed_point.h"
#include "libc64/sprintf.h"
#include "vt.h" #include "vt.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"

View File

@ -1,5 +1,5 @@
#include "regs.h" #include "regs.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "macros.h" #include "macros.h"
RegEditor* gRegEditor; RegEditor* gRegEditor;
@ -7,7 +7,7 @@ RegEditor* gRegEditor;
void Regs_Init(void) { void Regs_Init(void) {
s32 i; s32 i;
gRegEditor = SystemArena_Malloc(sizeof(RegEditor)); gRegEditor = malloc(sizeof(RegEditor));
if (1) {} if (1) {}
gRegEditor->regPage = 0; gRegEditor->regPage = 0;
gRegEditor->regGroup = 0; gRegEditor->regGroup = 0;

View File

@ -12,8 +12,9 @@
#include "z64transition.h" #include "z64transition.h"
#include "global.h" #include "libc64/sleep.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#include "macros.h"
Gfx sTransTileSetupDL[] = { Gfx sTransTileSetupDL[] = {
gsDPPipeSync(), gsDPPipeSync(),
@ -103,22 +104,22 @@ void TransitionTile_InitVtxData(TransitionTile* this) {
} }
void TransitionTile_Destroy(TransitionTile* this) { void TransitionTile_Destroy(TransitionTile* this) {
Sleep_Msec(100); msleep(100);
if (this->vtxData != NULL) { if (this->vtxData != NULL) {
SystemArena_Free(this->vtxData); free(this->vtxData);
this->vtxData = NULL; this->vtxData = NULL;
} }
if (this->vtxFrame1 != NULL) { if (this->vtxFrame1 != NULL) {
SystemArena_Free(this->vtxFrame1); free(this->vtxFrame1);
this->vtxFrame1 = NULL; this->vtxFrame1 = NULL;
} }
if (this->vtxFrame2 != NULL) { if (this->vtxFrame2 != NULL) {
SystemArena_Free(this->vtxFrame2); free(this->vtxFrame2);
this->vtxFrame2 = NULL; this->vtxFrame2 = NULL;
} }
if (this->gfx != NULL) { if (this->gfx != NULL) {
SystemArena_Free(this->gfx); free(this->gfx);
this->gfx = NULL; this->gfx = NULL;
} }
} }
@ -131,26 +132,26 @@ TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows) {
this->cols = cols; this->cols = cols;
this->rows = rows; this->rows = rows;
gridSize = (cols + 1) * (rows + 1); gridSize = (cols + 1) * (rows + 1);
this->vtxData = SystemArena_Malloc(gridSize * sizeof(TransitionTileVtxData)); this->vtxData = malloc(gridSize * sizeof(TransitionTileVtxData));
this->vtxFrame1 = SystemArena_Malloc(gridSize * sizeof(Vtx)); this->vtxFrame1 = malloc(gridSize * sizeof(Vtx));
this->vtxFrame2 = SystemArena_Malloc(gridSize * sizeof(Vtx)); this->vtxFrame2 = malloc(gridSize * sizeof(Vtx));
this->gfx = SystemArena_Malloc(((cols * 9 + 1) * rows + 2) * sizeof(Gfx)); this->gfx = malloc(((cols * 9 + 1) * rows + 2) * sizeof(Gfx));
if ((this->vtxData == NULL) || (this->vtxFrame1 == NULL) || (this->vtxFrame2 == NULL) || (this->gfx == NULL)) { if ((this->vtxData == NULL) || (this->vtxFrame1 == NULL) || (this->vtxFrame2 == NULL) || (this->gfx == NULL)) {
if (this->vtxData != NULL) { if (this->vtxData != NULL) {
SystemArena_Free(this->vtxData); free(this->vtxData);
this->vtxData = NULL; this->vtxData = NULL;
} }
if (this->vtxFrame1 != NULL) { if (this->vtxFrame1 != NULL) {
SystemArena_Free(this->vtxFrame1); free(this->vtxFrame1);
this->vtxFrame1 = NULL; this->vtxFrame1 = NULL;
} }
if (this->vtxFrame2 != NULL) { if (this->vtxFrame2 != NULL) {
SystemArena_Free(this->vtxFrame2); free(this->vtxFrame2);
this->vtxFrame2 = NULL; this->vtxFrame2 = NULL;
} }
if (this->gfx != NULL) { if (this->gfx != NULL) {
SystemArena_Free(this->gfx); free(this->gfx);
this->gfx = NULL; this->gfx = NULL;
} }
return NULL; return NULL;

View File

@ -3226,16 +3226,16 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
// temp_f4 = Rand_ZeroOne_Variable(&randInt); // temp_f4 = Rand_ZeroOne_Variable(&randInt);
randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT; randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT;
gRandFloat = (randInt >> 9) | 0x3F800000; gRandFloat.i = (randInt >> 9) | 0x3F800000;
temp = *((f32*)&gRandFloat); temp = gRandFloat.f;
temp_f4 = temp - 1.0f; temp_f4 = temp - 1.0f;
// temp_f20 = Rand_ZeroOne_Variable(&randInt); // temp_f20 = Rand_ZeroOne_Variable(&randInt);
randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT; randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT;
gRandFloat = (randInt >> 9) | 0x3F800000; gRandFloat.i = (randInt >> 9) | 0x3F800000;
temp_f20 = ((*((f32*)&gRandFloat) - 1.0f) + temp_f4) * 0.5f; temp_f20 = ((gRandFloat.f - 1.0f) + temp_f4) * 0.5f;
// randInt = Rand_Next_Variable(&randInt); // Rand_Next_Variable(&randInt);
randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT; randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT;
// Set random position // Set random position
@ -3245,8 +3245,8 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
// temp_f2 = Rand_ZeroOne_Variable(&randInt); // temp_f2 = Rand_ZeroOne_Variable(&randInt);
randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT; randInt = (randInt * RAND_MULTIPLIER) + RAND_INCREMENT;
gRandFloat = ((randInt >> 9) | 0x3F800000); gRandFloat.i = ((randInt >> 9) | 0x3F800000);
temp_f2 = *((f32*)&gRandFloat) - 1.0f; temp_f2 = gRandFloat.f - 1.0f;
// Set random width // Set random width
imgWidth = (u32)((SQ(temp_f2) * 8.0f) + 2.0f); imgWidth = (u32)((SQ(temp_f2) * 8.0f) + 2.0f);

View File

@ -1,6 +1,6 @@
#include "z64malloc.h" #include "z64malloc.h"
#include "os_malloc.h" #include "libc64/os_malloc.h"
Arena sZeldaArena; Arena sZeldaArena;

View File

@ -5,7 +5,7 @@
#include "global.h" #include "global.h"
#include "z64vismono.h" #include "z64vismono.h"
#include "system_malloc.h" #include "libc64/malloc.h"
// Height of the fragments the color frame buffer (CFB) is split into. // Height of the fragments the color frame buffer (CFB) is split into.
// It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into
@ -39,7 +39,7 @@ void VisMono_Init(VisMono* this) {
} }
void VisMono_Destroy(VisMono* this) { void VisMono_Destroy(VisMono* this) {
SystemArena_Free(this->dList); free(this->dList);
} }
void VisMono_DesaturateTLUT(u16* tlut) { void VisMono_DesaturateTLUT(u16* tlut) {
@ -169,12 +169,12 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) {
void VisMono_DrawOld(VisMono* this) { void VisMono_DrawOld(VisMono* this) {
if (this->tlut == NULL) { if (this->tlut == NULL) {
this->tlut = SystemArena_Malloc(256 * G_IM_SIZ_16b_BYTES); this->tlut = malloc(256 * G_IM_SIZ_16b_BYTES);
VisMono_DesaturateTLUT(this->tlut); VisMono_DesaturateTLUT(this->tlut);
} }
if (this->dList == NULL) { if (this->dList == NULL) {
this->dList = SystemArena_Malloc(VISMONO_DLSIZE * sizeof(Gfx)); this->dList = malloc(VISMONO_DLSIZE * sizeof(Gfx));
VisMono_DesaturateDList(this->dList); VisMono_DesaturateDList(this->dList);
} }
} }

View File

@ -1,3 +1,4 @@
#include "ultra64.h"
#include "libc/math.h" #include "libc/math.h"
static s16 sintable[0x400] = { static s16 sintable[0x400] = {

View File

@ -6,7 +6,7 @@
#include "z_eff_dust.h" #include "z_eff_dust.h"
#include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_keep/gameplay_keep.h"
#include "system_malloc.h" #include "libc64/malloc.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -99,7 +99,7 @@ void EffDust_Init(Actor* thisx, PlayState* play) {
break; break;
default: default:
SystemArena_Free(this); free(this);
break; break;
} }
this->life = 10; this->life = 10;

View File

@ -61,8 +61,8 @@
0x80086620 : "padsetup", 0x80086620 : "padsetup",
0x80086760 : "math64", 0x80086760 : "math64",
0x80086C70 : "fp", 0x80086C70 : "fp",
0x80086DD0 : "system_malloc", 0x80086DD0 : "malloc",
0x80086FA0 : "rand", 0x80086FA0 : "qrand",
0x80087160 : "__osMalloc", 0x80087160 : "__osMalloc",
0x80087830 : "sprintf", 0x80087830 : "sprintf",
0x80087900 : "printutils", 0x80087900 : "printutils",
@ -258,7 +258,7 @@
0x80096C50 : "gfxprint", 0x80096C50 : "gfxprint",
0x80097500 : "system_heap", 0x80097500 : "system_heap",
0x80097520 : "fp", 0x80097520 : "fp",
0x80097530 : "rand", 0x80097530 : "qrand",
0x80097540 : "vimodentschpf1", 0x80097540 : "vimodentschpf1",
0x80097590 : "vimodepallan1", 0x80097590 : "vimodepallan1",
0x800975E0 : "sins", 0x800975E0 : "sins",
@ -322,8 +322,8 @@
0x8009BE50 : "fault", 0x8009BE50 : "fault",
0x8009CCD0 : "fault_drawer", 0x8009CCD0 : "fault_drawer",
0x8009CD10 : "math64", 0x8009CD10 : "math64",
0x8009CD20 : "system_malloc", 0x8009CD20 : "malloc",
0x8009CD50 : "rand", 0x8009CD50 : "qrand",
0x8009CD60 : "__osMalloc", 0x8009CD60 : "__osMalloc",
0x8009CD70 : "sptask", 0x8009CD70 : "sptask",
0x8009CDB0 : "motor", 0x8009CDB0 : "motor",

View File

@ -199,16 +199,16 @@
0x80086D6C:("round",), 0x80086D6C:("round",),
0x80086D8C:("lroundf",), 0x80086D8C:("lroundf",),
0x80086DAC:("lround",), 0x80086DAC:("lround",),
0x80086DD0:("SystemArena_Malloc",), 0x80086DD0:("malloc",),
0x80086DF8:("SystemArena_MallocR",), 0x80086DF8:("malloc_r",),
0x80086E20:("SystemArena_Realloc",), 0x80086E20:("realloc",),
0x80086E50:("SystemArena_Free",), 0x80086E50:("free",),
0x80086E78:("SystemArena_Calloc",), 0x80086E78:("calloc",),
0x80086ECC:("SystemArena_GetSizes",), 0x80086ECC:("GetFreeArena",),
0x80086F04:("SystemArena_CheckArena",), 0x80086F04:("CheckArena",),
0x80086F28:("SystemArena_Init",), 0x80086F28:("MallocInit",),
0x80086F58:("SystemArena_Cleanup",), 0x80086F58:("MallocCleanup",),
0x80086F7C:("SystemArena_IsInitialized",), 0x80086F7C:("MallocIsInitialized",),
0x80086FA0:("Rand_Next",), 0x80086FA0:("Rand_Next",),
0x80086FD0:("Rand_Seed",), 0x80086FD0:("Rand_Seed",),
0x80086FDC:("Rand_ZeroOne",), 0x80086FDC:("Rand_ZeroOne",),
@ -231,16 +231,16 @@
0x800875E4:("__osRealloc",), 0x800875E4:("__osRealloc",),
0x80087714:("__osGetSizes",), 0x80087714:("__osGetSizes",),
0x800877C4:("__osCheckArena",), 0x800877C4:("__osCheckArena",),
0x80087830:("proutSprintf",), 0x80087830:("proutPrintf",),
0x80087854:("vsprintf",), 0x80087854:("vsprintf",),
0x800878A4:("sprintf",), 0x800878A4:("sprintf",),
0x80087900:("PrintUtils_VPrintf",), 0x80087900:("vaprintf",),
0x80087934:("PrintUtils_Printf",), 0x80087934:("aprintf",),
0x80087960:("Sleep_Cycles",), 0x80087960:("csleep",),
0x800879CC:("Sleep_Nsec",), 0x800879CC:("nsleep",),
0x80087A1C:("Sleep_Usec",), 0x80087A1C:("usleep",),
0x80087A6C:("Sleep_Msec",), 0x80087A6C:("msleep",),
0x80087AC0:("Sleep_Sec",), 0x80087AC0:("sleep",),
0x80087B00:("__osSetCause",), 0x80087B00:("__osSetCause",),
0x80087B10:("osSendMesg",), 0x80087B10:("osSendMesg",),
0x80087C60:("osPfsFreeBlocks",), 0x80087C60:("osPfsFreeBlocks",),

View File

@ -321,7 +321,7 @@
0x8009C480:("gFaultMgr","FaultMgr","",0x848), 0x8009C480:("gFaultMgr","FaultMgr","",0x848),
0x8009CCD0:("sFaultDrawer","FaultDrawer","",0x3c), 0x8009CCD0:("sFaultDrawer","FaultDrawer","",0x3c),
0x8009CD10:("D_8009CD10","UNK_TYPE4","",0x4), 0x8009CD10:("D_8009CD10","UNK_TYPE4","",0x4),
0x8009CD20:("gSystemArena","Arena","",0x24), 0x8009CD20:("malloc_arena","Arena","",0x24),
0x8009CD50:("gRandFloat","f32","",0x4), 0x8009CD50:("gRandFloat","f32","",0x4),
0x8009CD60:("sArenaLockMsg","OSMesg","[1]",0x4), 0x8009CD60:("sArenaLockMsg","OSMesg","[1]",0x4),
0x8009CD70:("tmp_task","OSTask","",0x40), 0x8009CD70:("tmp_task","OSTask","",0x40),

View File

@ -18,6 +18,28 @@ simpleReplace = {
# explanation in replace_single below) # explanation in replace_single below)
wordReplace = { wordReplace = {
# Functions # Functions
"SystemArena_Malloc": "malloc",
"SystemArena_MallocR": "malloc_r",
"SystemArena_Realloc": "realloc",
"SystemArena_Free": "free",
"SystemArena_Calloc": "calloc",
"SystemArena_GetSizes": "GetFreeArena",
"SystemArena_CheckArena": "CheckArena",
"SystemArena_Init": "MallocInit",
"SystemArena_Cleanup": "MallocCleanup",
"SystemArena_IsInitialized": "MallocIsInitialized",
"proutSprintf": "proutPrintf",
"PrintUtils_VPrintf": "vaprintf",
"PrintUtils_Printf": "aprintf",
"Sleep_Cycles": "csleep",
"Sleep_Nsec": "nsleep",
"Sleep_Usec": "usleep",
"Sleep_Msec": "msleep",
"Sleep_Sec": "sleep",
"Actor_GetSwitchFlag": "Flags_GetSwitch", "Actor_GetSwitchFlag": "Flags_GetSwitch",
"Math_Acot2F": "Math_Atan2F_XY", "Math_Acot2F": "Math_Atan2F_XY",
"atan_flip": "Math_Atan2F_XY", "atan_flip": "Math_Atan2F_XY",

View File

@ -155,7 +155,7 @@ asm/non_matchings/boot/mtxuty-cvt/MtxConv_L2F.s,MtxConv_L2F,0x80086258,0xA
asm/non_matchings/boot/assert/_dbg_hungup.s,_dbg_hungup,0x80086280,0xD asm/non_matchings/boot/assert/_dbg_hungup.s,_dbg_hungup,0x80086280,0xD
asm/non_matchings/boot/assert/Reset.s,Reset,0x800862B4,0xB asm/non_matchings/boot/assert/Reset.s,Reset,0x800862B4,0xB
asm/non_matchings/boot/boot_800862E0/SystemHeap_Malloc.s,SystemHeap_Malloc,0x800862E0,0xC asm/non_matchings/boot/boot_800862E0/SystemHeap_Malloc.s,SystemHeap_Malloc,0x800862E0,0xC
asm/non_matchings/boot/boot_800862E0/SystemArena_Free.s,SystemArena_Free,0x80086310,0xB asm/non_matchings/boot/boot_800862E0/free.s,free,0x80086310,0xB
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc.s,SystemHeap_RunBlockFunc,0x8008633C,0x1C asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc.s,SystemHeap_RunBlockFunc,0x8008633C,0x1C
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc1.s,SystemHeap_RunBlockFunc1,0x800863AC,0x1C asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc1.s,SystemHeap_RunBlockFunc1,0x800863AC,0x1C
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc8.s,SystemHeap_RunBlockFunc8,0x8008641C,0x34 asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc8.s,SystemHeap_RunBlockFunc8,0x8008641C,0x34
@ -196,16 +196,16 @@ asm/non_matchings/boot/fp/roundf.s,roundf,0x80086D50,0x7
asm/non_matchings/boot/fp/round.s,round,0x80086D6C,0x8 asm/non_matchings/boot/fp/round.s,round,0x80086D6C,0x8
asm/non_matchings/boot/fp/lroundf.s,lroundf,0x80086D8C,0x8 asm/non_matchings/boot/fp/lroundf.s,lroundf,0x80086D8C,0x8
asm/non_matchings/boot/fp/lround.s,lround,0x80086DAC,0x9 asm/non_matchings/boot/fp/lround.s,lround,0x80086DAC,0x9
asm/non_matchings/boot/system_malloc/SystemArena_Malloc.s,SystemArena_Malloc,0x80086DD0,0xA asm/non_matchings/boot/system_malloc/malloc.s,malloc,0x80086DD0,0xA
asm/non_matchings/boot/system_malloc/SystemArena_MallocR.s,SystemArena_MallocR,0x80086DF8,0xA asm/non_matchings/boot/system_malloc/malloc_r.s,malloc_r,0x80086DF8,0xA
asm/non_matchings/boot/system_malloc/SystemArena_Realloc.s,SystemArena_Realloc,0x80086E20,0xC asm/non_matchings/boot/system_malloc/realloc.s,realloc,0x80086E20,0xC
asm/non_matchings/boot/system_malloc/SystemArena_Free.s,SystemArena_Free,0x80086E50,0xA asm/non_matchings/boot/system_malloc/free.s,free,0x80086E50,0xA
asm/non_matchings/boot/system_malloc/SystemArena_Calloc.s,SystemArena_Calloc,0x80086E78,0x15 asm/non_matchings/boot/system_malloc/calloc.s,calloc,0x80086E78,0x15
asm/non_matchings/boot/system_malloc/SystemArena_GetSizes.s,SystemArena_GetSizes,0x80086ECC,0xE asm/non_matchings/boot/system_malloc/GetFreeArena.s,GetFreeArena,0x80086ECC,0xE
asm/non_matchings/boot/system_malloc/SystemArena_CheckArena.s,SystemArena_CheckArena,0x80086F04,0x9 asm/non_matchings/boot/system_malloc/CheckArena.s,CheckArena,0x80086F04,0x9
asm/non_matchings/boot/system_malloc/SystemArena_Init.s,SystemArena_Init,0x80086F28,0xC asm/non_matchings/boot/system_malloc/MallocInit.s,MallocInit,0x80086F28,0xC
asm/non_matchings/boot/system_malloc/SystemArena_Cleanup.s,SystemArena_Cleanup,0x80086F58,0x9 asm/non_matchings/boot/system_malloc/MallocCleanup.s,MallocCleanup,0x80086F58,0x9
asm/non_matchings/boot/system_malloc/SystemArena_IsInitialized.s,SystemArena_IsInitialized,0x80086F7C,0x9 asm/non_matchings/boot/system_malloc/MallocIsInitialized.s,MallocIsInitialized,0x80086F7C,0x9
asm/non_matchings/boot/rand/Rand_Next.s,Rand_Next,0x80086FA0,0xC asm/non_matchings/boot/rand/Rand_Next.s,Rand_Next,0x80086FA0,0xC
asm/non_matchings/boot/rand/Rand_Seed.s,Rand_Seed,0x80086FD0,0x3 asm/non_matchings/boot/rand/Rand_Seed.s,Rand_Seed,0x80086FD0,0x3
asm/non_matchings/boot/rand/Rand_ZeroOne.s,Rand_ZeroOne,0x80086FDC,0x15 asm/non_matchings/boot/rand/Rand_ZeroOne.s,Rand_ZeroOne,0x80086FDC,0x15
@ -228,16 +228,16 @@ asm/non_matchings/boot/__osMalloc/__osFree.s,__osFree,0x800874EC,0x3E
asm/non_matchings/boot/__osMalloc/__osRealloc.s,__osRealloc,0x800875E4,0x4C asm/non_matchings/boot/__osMalloc/__osRealloc.s,__osRealloc,0x800875E4,0x4C
asm/non_matchings/boot/__osMalloc/__osGetSizes.s,__osGetSizes,0x80087714,0x2C asm/non_matchings/boot/__osMalloc/__osGetSizes.s,__osGetSizes,0x80087714,0x2C
asm/non_matchings/boot/__osMalloc/__osCheckArena.s,__osCheckArena,0x800877C4,0x1B asm/non_matchings/boot/__osMalloc/__osCheckArena.s,__osCheckArena,0x800877C4,0x1B
asm/non_matchings/boot/sprintf/proutSprintf.s,proutSprintf,0x80087830,0x9 asm/non_matchings/boot/sprintf/proutPrintf.s,proutPrintf,0x80087830,0x9
asm/non_matchings/boot/sprintf/vsprintf.s,vsprintf,0x80087854,0x14 asm/non_matchings/boot/sprintf/vsprintf.s,vsprintf,0x80087854,0x14
asm/non_matchings/boot/sprintf/sprintf.s,sprintf,0x800878A4,0x17 asm/non_matchings/boot/sprintf/sprintf.s,sprintf,0x800878A4,0x17
asm/non_matchings/boot/printutils/PrintUtils_VPrintf.s,PrintUtils_VPrintf,0x80087900,0xD asm/non_matchings/boot/printutils/vaprintf.s,vaprintf,0x80087900,0xD
asm/non_matchings/boot/printutils/PrintUtils_Printf.s,PrintUtils_Printf,0x80087934,0xB asm/non_matchings/boot/printutils/aprintf.s,aprintf,0x80087934,0xB
asm/non_matchings/boot/printutils/Sleep_Cycles.s,Sleep_Cycles,0x80087960,0x1B asm/non_matchings/boot/printutils/csleep.s,csleep,0x80087960,0x1B
asm/non_matchings/boot/printutils/Sleep_Nsec.s,Sleep_Nsec,0x800879CC,0x14 asm/non_matchings/boot/printutils/nsleep.s,nsleep,0x800879CC,0x14
asm/non_matchings/boot/printutils/Sleep_Usec.s,Sleep_Usec,0x80087A1C,0x14 asm/non_matchings/boot/printutils/usleep.s,usleep,0x80087A1C,0x14
asm/non_matchings/boot/printutils/Sleep_Msec.s,Sleep_Msec,0x80087A6C,0x15 asm/non_matchings/boot/printutils/msleep.s,msleep,0x80087A6C,0x15
asm/non_matchings/boot/printutils/Sleep_Sec.s,Sleep_Sec,0x80087AC0,0x10 asm/non_matchings/boot/printutils/sleep.s,sleep,0x80087AC0,0x10
asm/non_matchings/boot/setcause/__osSetCause.s,__osSetCause,0x80087B00,0x4 asm/non_matchings/boot/setcause/__osSetCause.s,__osSetCause,0x80087B00,0x4
asm/non_matchings/boot/sendmesg/osSendMesg.s,osSendMesg,0x80087B10,0x54 asm/non_matchings/boot/sendmesg/osSendMesg.s,osSendMesg,0x80087B10,0x54
asm/non_matchings/boot/pfsfreeblocks/osPfsFreeBlocks.s,osPfsFreeBlocks,0x80087C60,0x68 asm/non_matchings/boot/pfsfreeblocks/osPfsFreeBlocks.s,osPfsFreeBlocks,0x80087C60,0x68

1 asm/non_matchings/boot/boot_main/bootproc.s bootproc 0x80080060 0x3C
155 asm/non_matchings/boot/assert/_dbg_hungup.s _dbg_hungup 0x80086280 0xD
156 asm/non_matchings/boot/assert/Reset.s Reset 0x800862B4 0xB
157 asm/non_matchings/boot/boot_800862E0/SystemHeap_Malloc.s SystemHeap_Malloc 0x800862E0 0xC
158 asm/non_matchings/boot/boot_800862E0/SystemArena_Free.s asm/non_matchings/boot/boot_800862E0/free.s SystemArena_Free free 0x80086310 0xB
159 asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc.s SystemHeap_RunBlockFunc 0x8008633C 0x1C
160 asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc1.s SystemHeap_RunBlockFunc1 0x800863AC 0x1C
161 asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc8.s SystemHeap_RunBlockFunc8 0x8008641C 0x34
196 asm/non_matchings/boot/fp/round.s round 0x80086D6C 0x8
197 asm/non_matchings/boot/fp/lroundf.s lroundf 0x80086D8C 0x8
198 asm/non_matchings/boot/fp/lround.s lround 0x80086DAC 0x9
199 asm/non_matchings/boot/system_malloc/SystemArena_Malloc.s asm/non_matchings/boot/system_malloc/malloc.s SystemArena_Malloc malloc 0x80086DD0 0xA
200 asm/non_matchings/boot/system_malloc/SystemArena_MallocR.s asm/non_matchings/boot/system_malloc/malloc_r.s SystemArena_MallocR malloc_r 0x80086DF8 0xA
201 asm/non_matchings/boot/system_malloc/SystemArena_Realloc.s asm/non_matchings/boot/system_malloc/realloc.s SystemArena_Realloc realloc 0x80086E20 0xC
202 asm/non_matchings/boot/system_malloc/SystemArena_Free.s asm/non_matchings/boot/system_malloc/free.s SystemArena_Free free 0x80086E50 0xA
203 asm/non_matchings/boot/system_malloc/SystemArena_Calloc.s asm/non_matchings/boot/system_malloc/calloc.s SystemArena_Calloc calloc 0x80086E78 0x15
204 asm/non_matchings/boot/system_malloc/SystemArena_GetSizes.s asm/non_matchings/boot/system_malloc/GetFreeArena.s SystemArena_GetSizes GetFreeArena 0x80086ECC 0xE
205 asm/non_matchings/boot/system_malloc/SystemArena_CheckArena.s asm/non_matchings/boot/system_malloc/CheckArena.s SystemArena_CheckArena CheckArena 0x80086F04 0x9
206 asm/non_matchings/boot/system_malloc/SystemArena_Init.s asm/non_matchings/boot/system_malloc/MallocInit.s SystemArena_Init MallocInit 0x80086F28 0xC
207 asm/non_matchings/boot/system_malloc/SystemArena_Cleanup.s asm/non_matchings/boot/system_malloc/MallocCleanup.s SystemArena_Cleanup MallocCleanup 0x80086F58 0x9
208 asm/non_matchings/boot/system_malloc/SystemArena_IsInitialized.s asm/non_matchings/boot/system_malloc/MallocIsInitialized.s SystemArena_IsInitialized MallocIsInitialized 0x80086F7C 0x9
209 asm/non_matchings/boot/rand/Rand_Next.s Rand_Next 0x80086FA0 0xC
210 asm/non_matchings/boot/rand/Rand_Seed.s Rand_Seed 0x80086FD0 0x3
211 asm/non_matchings/boot/rand/Rand_ZeroOne.s Rand_ZeroOne 0x80086FDC 0x15
228 asm/non_matchings/boot/__osMalloc/__osRealloc.s __osRealloc 0x800875E4 0x4C
229 asm/non_matchings/boot/__osMalloc/__osGetSizes.s __osGetSizes 0x80087714 0x2C
230 asm/non_matchings/boot/__osMalloc/__osCheckArena.s __osCheckArena 0x800877C4 0x1B
231 asm/non_matchings/boot/sprintf/proutSprintf.s asm/non_matchings/boot/sprintf/proutPrintf.s proutSprintf proutPrintf 0x80087830 0x9
232 asm/non_matchings/boot/sprintf/vsprintf.s vsprintf 0x80087854 0x14
233 asm/non_matchings/boot/sprintf/sprintf.s sprintf 0x800878A4 0x17
234 asm/non_matchings/boot/printutils/PrintUtils_VPrintf.s asm/non_matchings/boot/printutils/vaprintf.s PrintUtils_VPrintf vaprintf 0x80087900 0xD
235 asm/non_matchings/boot/printutils/PrintUtils_Printf.s asm/non_matchings/boot/printutils/aprintf.s PrintUtils_Printf aprintf 0x80087934 0xB
236 asm/non_matchings/boot/printutils/Sleep_Cycles.s asm/non_matchings/boot/printutils/csleep.s Sleep_Cycles csleep 0x80087960 0x1B
237 asm/non_matchings/boot/printutils/Sleep_Nsec.s asm/non_matchings/boot/printutils/nsleep.s Sleep_Nsec nsleep 0x800879CC 0x14
238 asm/non_matchings/boot/printutils/Sleep_Usec.s asm/non_matchings/boot/printutils/usleep.s Sleep_Usec usleep 0x80087A1C 0x14
239 asm/non_matchings/boot/printutils/Sleep_Msec.s asm/non_matchings/boot/printutils/msleep.s Sleep_Msec msleep 0x80087A6C 0x15
240 asm/non_matchings/boot/printutils/Sleep_Sec.s asm/non_matchings/boot/printutils/sleep.s Sleep_Sec sleep 0x80087AC0 0x10
241 asm/non_matchings/boot/setcause/__osSetCause.s __osSetCause 0x80087B00 0x4
242 asm/non_matchings/boot/sendmesg/osSendMesg.s osSendMesg 0x80087B10 0x54
243 asm/non_matchings/boot/pfsfreeblocks/osPfsFreeBlocks.s osPfsFreeBlocks 0x80087C60 0x68