__osMalloc.c OK (#395)

* __osRealloc

* match __osCheckArena

* cleanup

* Import bss, unreferenced strings and cleanup

* format

* Reviews

* Move convert.h to ultra64/

* Make the os_malloc.h header

* potato

* renames and fixes

* format

* small doc pass
}

* format

* minor changes

* Introduce system_malloc.h

* Docs pass

* fix

* format

* stuff

* Apply suggestions from code review

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>

* review

* format

* remove repeated sentence

* Apply suggestions from code review

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>

* include headers

* review

* Rename __osMallocAddHeap

* remove @brief

* Update src/boot_O2/__osMalloc.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
Anghelo Carvajal
2022-01-11 20:25:14 -03:00
committed by GitHub
parent 133e02a8a7
commit c44e26a143
28 changed files with 376 additions and 135 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
s32 gFramerateDivisor = 1;
f32 gFramerateDivisorF = 1.0f;
@@ -174,7 +175,7 @@ void GameState_Realloc(GameState* gameState, size_t size) {
alloc = &gameState->alloc;
THA_Dt(&gameState->heap);
GameAlloc_Free(alloc, heapStart);
SystemArena_AnalyzeArena(&systemMaxFree, &bytesFree, &bytesAllocated);
SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated);
size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size);
if (size == 0) {
size = systemMaxFree - (sizeof(ArenaNode));
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
void GameAlloc_Log(GameAlloc* this) {
GameAllocEntry* iter;
+1
View File
@@ -1,5 +1,6 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "system_malloc.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_file_choose/z_file_choose.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
ListAlloc* ListAlloc_Init(ListAlloc* this) {
this->prev = NULL;
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_80177390.s")
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/func_80178750.s")
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_flashrom/func_801857C0.s")
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_LoadGameState.s")
+2 -1
View File
@@ -1,11 +1,12 @@
#include "global.h"
#include "system_malloc.h"
GameInfo* gGameInfo;
void GameInfo_Init(void) {
s32 i;
gGameInfo = (GameInfo*)SystemArena_Malloc(sizeof(GameInfo));
gGameInfo = SystemArena_Malloc(sizeof(GameInfo));
if (1) {}
gGameInfo->unk_00 = 0;
gGameInfo->unk_01 = 0;
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80163DC0.s")
+6 -3
View File
@@ -1,4 +1,7 @@
#include "global.h"
#include "os_malloc.h"
Arena sZeldaArena;
void* ZeldaArena_Malloc(size_t size) {
void* ptr = __osMalloc(&sZeldaArena, size);
@@ -34,11 +37,11 @@ void* ZeldaArena_Calloc(u32 num, size_t size) {
}
void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc) {
__osAnalyzeArena(&sZeldaArena, outMaxFree, outFree, outAlloc);
__osGetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc);
}
void ZeldaArena_Check() {
__osCheckArena(&sZeldaArena);
s32 ZeldaArena_Check() {
return __osCheckArena(&sZeldaArena);
}
void ZeldaArena_Init(void* start, size_t size) {
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "system_malloc.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_801418B0.s")