mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-27 06:40:36 +00:00
c44e26a143
* __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>
36 lines
1.0 KiB
C
36 lines
1.0 KiB
C
#ifndef OS_MALLOC
|
|
#define OS_MALLOC
|
|
|
|
#include "PR/ultratypes.h"
|
|
#include "ultra64/message.h"
|
|
#include "libc/stddef.h"
|
|
|
|
typedef struct ArenaNode {
|
|
/* 0x0 */ s16 magic; // Should always be 0x7373
|
|
/* 0x2 */ s16 isFree;
|
|
/* 0x4 */ size_t size;
|
|
/* 0x8 */ struct ArenaNode* next;
|
|
/* 0xC */ struct ArenaNode* prev;
|
|
} ArenaNode; // size = 0x10
|
|
|
|
typedef struct {
|
|
/* 0x00 */ ArenaNode* head;
|
|
/* 0x04 */ void* start;
|
|
/* 0x08 */ OSMesgQueue lock;
|
|
/* 0x20 */ u8 unk20;
|
|
/* 0x21 */ u8 isInit;
|
|
/* 0x22 */ u8 flag;
|
|
} Arena; // size = 0x24
|
|
|
|
void __osMallocInit(Arena* arena, void* heap, size_t size);
|
|
void __osMallocCleanup(Arena* arena);
|
|
u8 __osMallocIsInitalized(Arena* arena);
|
|
void* __osMalloc(Arena* arena, size_t size);
|
|
void* __osMallocR(Arena* arena, size_t size);
|
|
void __osFree(Arena* arena, void* ptr);
|
|
void* __osRealloc(Arena* arena, void* ptr, size_t newSize);
|
|
void __osGetSizes(Arena* arena, size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated);
|
|
s32 __osCheckArena(Arena* arena);
|
|
|
|
#endif
|