12#define HEAP_END ((MemBlock *)0x801FF000)
18#define MEM_FILE_CACHE 3
void freeMemByTag(s32 tag)
Frees every heap block with tag tag
void * allocMemZeroed(s32 size, s32 tag)
allocMem, cleared
MemBlock HEAP_BASE[]
The heap's first block, after the overlays: a linker symbol (tools/link_heap.py)
void freeMem(void *ptr)
Frees a heap block, merging it with the free blocks around it.
void lockMem(void *ptr, s32 lock)
Keeps a block alive across mode changes, or hands it back to the mode.
void * tryAllocMem(u32 size, s32 tag)
First fit from the start of the heap.
void initHeap(void)
Makes the heap one free block from HEAP_START, followed by the end marker.
MemBlock * HEAP_START
The first of the executable's small data (.sdata), where $gp points.
void allocMemHigh(s32 size, s32 tag)
The block is returned in v0, left there by tryAllocMemHigh.
void fillMem(s8 *dst, s8 value, s32 count)
Sets count bytes to value
void * allocMem(s32 size, s32 tag)
Evicts cached files until the allocation fits.
void * tryAllocMemHigh(u32 size, s32 tag)
First fit from the end of the heap.
void heapNop(void)
HEAP.nop: empty, and nothing calls it.
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
void zeroMem(void *dst, s32 size)
Clears size bytes, a word at a time when size is a multiple of 4.
void(* fill)(void *ptr, s32 value, s32 size)
void(* zero)(void *ptr, s32 size)
Header of a heap block; the data follows it.