Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Macros | Functions | Variables
memory.h File Reference

Go to the source code of this file.

Data Structures

struct  AllocOnlyPool
 

Macros

#define MEMORY_POOL_LEFT   0
 
#define MEMORY_POOL_RIGHT   1
 

Functions

u32 set_segment_base_addr (s32 segment, void *addr)
 
void * get_segment_base_addr (s32 segment)
 
void * segmented_to_virtual (void *addr)
 
void * virtual_to_segmented (s32 segment, void *addr)
 
void move_segment_table_to_dmem (void)
 
void main_pool_init (void *start, void *end)
 Initialize the main memory pool. More...
 
void * main_pool_alloc (u32 size, u32 side)
 Allocate a block of memory from the pool of given size, and from the specified side of the pool (MEMORY_POOL_LEFT or MEMORY_POOL_RIGHT). More...
 
u32 main_pool_free (void *addr)
 Free a block of memory that was allocated from the pool. More...
 
void * main_pool_realloc (void *addr, u32 size)
 Resize a block of memory that was allocated from the left side of the pool. More...
 
u32 main_pool_available (void)
 Return the size of the largest block that can currently be allocated from the pool. More...
 
u32 main_pool_push_state (void)
 Push pool state, to be restored later. More...
 
u32 main_pool_pop_state (void)
 Restore pool state from a previous call to main_pool_push_state. More...
 
void * load_segment (s32 segment, u8 *srcStart, u8 *srcEnd, u32 side)
 Load data from ROM into a newly allocated block, and set the segment base address to this block. More...
 
void * load_to_fixed_pool_addr (u8 *destAddr, u8 *srcStart, u8 *srcEnd)
 
void * load_segment_decompress (s32 segment, u8 *srcStart, u8 *srcEnd)
 Decompress the block of ROM data from srcStart to srcEnd and return a pointer to an allocated buffer holding the decompressed data. More...
 
void * func_80278304 (u32 segment, u8 *srcStart, u8 *srcEnd)
 
void load_engine_code_segment (void)
 
struct AllocOnlyPool * alloc_only_pool_init (u32 size, u32 side)
 Allocate an allocation-only pool from the main pool. More...
 
void * alloc_only_pool_alloc (struct AllocOnlyPool *pool, s32 size)
 Allocate from an allocation-only pool. More...
 
struct AllocOnlyPool * alloc_only_pool_resize (struct AllocOnlyPool *pool, u32 size)
 Resize an allocation-only pool. More...
 
struct MemoryPool * mem_pool_init (u32 size, u32 side)
 Allocate a memory pool from the main pool. More...
 
void * mem_pool_alloc (struct MemoryPool *pool, u32 size)
 Allocate from a memory pool. More...
 
void mem_pool_free (struct MemoryPool *pool, void *addr)
 Free a block that was allocated using mem_pool_alloc. More...
 
void * alloc_display_list (u32 size)
 
void func_80278A78 (struct MarioAnimation *a, void *b, void *c)
 
s32 func_80278AD4 (struct MarioAnimation *a, u32 b)
 

Variables

struct MemoryPool * D_8033A124
 

Macro Definition Documentation

◆ MEMORY_POOL_LEFT

#define MEMORY_POOL_LEFT   0

◆ MEMORY_POOL_RIGHT

#define MEMORY_POOL_RIGHT   1

Function Documentation

◆ alloc_display_list()

void* alloc_display_list ( u32  size)

◆ alloc_only_pool_alloc()

void* alloc_only_pool_alloc ( struct AllocOnlyPool *  pool,
s32  size 
)

Allocate from an allocation-only pool.

Return NULL if there is not enough space.

◆ alloc_only_pool_init()

struct AllocOnlyPool* alloc_only_pool_init ( u32  size,
u32  side 
)

Allocate an allocation-only pool from the main pool.

This pool doesn't support freeing allocated memory. Return NULL if there is not enough space in the main pool.

◆ alloc_only_pool_resize()

struct AllocOnlyPool* alloc_only_pool_resize ( struct AllocOnlyPool *  pool,
u32  size 
)

Resize an allocation-only pool.

If the pool is increasing in size, the pool must be the last thing allocated from the left end of the main pool. The pool does not move.

◆ func_80278304()

void* func_80278304 ( u32  segment,
u8 *  srcStart,
u8 *  srcEnd 
)

◆ func_80278A78()

void func_80278A78 ( struct MarioAnimation *  a,
void *  b,
void *  c 
)

◆ func_80278AD4()

s32 func_80278AD4 ( struct MarioAnimation *  a,
u32  b 
)

◆ get_segment_base_addr()

void* get_segment_base_addr ( s32  segment)

◆ load_engine_code_segment()

void load_engine_code_segment ( void  )

◆ load_segment()

void* load_segment ( s32  segment,
u8 *  srcStart,
u8 *  srcEnd,
u32  side 
)

Load data from ROM into a newly allocated block, and set the segment base address to this block.

◆ load_segment_decompress()

void* load_segment_decompress ( s32  segment,
u8 *  srcStart,
u8 *  srcEnd 
)

Decompress the block of ROM data from srcStart to srcEnd and return a pointer to an allocated buffer holding the decompressed data.

Set the base address of segment to this address.

◆ load_to_fixed_pool_addr()

void* load_to_fixed_pool_addr ( u8 *  destAddr,
u8 *  srcStart,
u8 *  srcEnd 
)

◆ main_pool_alloc()

void* main_pool_alloc ( u32  size,
u32  side 
)

Allocate a block of memory from the pool of given size, and from the specified side of the pool (MEMORY_POOL_LEFT or MEMORY_POOL_RIGHT).

If there is not enough space, return NULL.

◆ main_pool_available()

u32 main_pool_available ( void  )

Return the size of the largest block that can currently be allocated from the pool.

◆ main_pool_free()

u32 main_pool_free ( void *  addr)

Free a block of memory that was allocated from the pool.

The block must be the most recently allocated block from its end of the pool. Return the amount of free space left in the pool.

◆ main_pool_init()

void main_pool_init ( void *  start,
void *  end 
)

Initialize the main memory pool.

This pool is conceptually a pair of stacks that grow inward from the left and right. It therefore only supports freeing the object that was most recently allocated from a side.

◆ main_pool_pop_state()

u32 main_pool_pop_state ( void  )

Restore pool state from a previous call to main_pool_push_state.

Return the amount of free space left in the pool.

◆ main_pool_push_state()

u32 main_pool_push_state ( void  )

Push pool state, to be restored later.

Return the amount of free space left in the pool.

◆ main_pool_realloc()

void* main_pool_realloc ( void *  addr,
u32  size 
)

Resize a block of memory that was allocated from the left side of the pool.

If the block is increasing in size, it must be the most recently allocated block from the left side. The block does not move.

◆ mem_pool_alloc()

void* mem_pool_alloc ( struct MemoryPool *  pool,
u32  size 
)

Allocate from a memory pool.

Return NULL if there is not enough space.

◆ mem_pool_free()

void mem_pool_free ( struct MemoryPool *  pool,
void *  addr 
)

Free a block that was allocated using mem_pool_alloc.

◆ mem_pool_init()

struct MemoryPool* mem_pool_init ( u32  size,
u32  side 
)

Allocate a memory pool from the main pool.

This pool supports arbitrary order for allocation/freeing. Return NULL if there is not enough space in the main pool.

◆ move_segment_table_to_dmem()

void move_segment_table_to_dmem ( void  )

◆ segmented_to_virtual()

void* segmented_to_virtual ( void *  addr)

◆ set_segment_base_addr()

u32 set_segment_base_addr ( s32  segment,
void *  addr 
)

◆ virtual_to_segmented()

void* virtual_to_segmented ( s32  segment,
void *  addr 
)

Variable Documentation

◆ D_8033A124

struct MemoryPool* D_8033A124