Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
gd_memory.h
Go to the documentation of this file.
1 #ifndef GD_MEMORY_H
2 #define GD_MEMORY_H
3 
4 #include <ultra64.h>
5 
7 struct GMemBlock {
8  /* 0x00 */ union {
9  void *ptr;
10  u32 addr; //TODO: assumes 32bit pointers; use uintptr_t
11  } data;
12  /* 0x04 */ u32 size;
13  /* 0x08 */ u8 blockType;
14  /* 0x09 */ u8 permFlag;
15  /* 0x0A u8 fieldAlginment[2]; */
16  /* 0x0C */ struct GMemBlock *next;
17  /* 0x10 */ struct GMemBlock *prev;
18 };
19 
25 };
26 /* Block Permanence Defines */
27 /* This may be collections of certain allocation types
28  * eg. 0x10 = Object; 0x20 = Color Buffer; 0x40 = Z Buf; 0x01 = basic; etc. */
29 #define PERM_G_MEM_BLOCK 0xF0
30 #define TEMP_G_MEM_BLOCK 0x0F
31 
32 // functions
33 extern u32 gd_free_mem(void *);
34 extern void *gd_request_mem(u32, u8);
35 extern struct GMemBlock *gd_add_mem_to_heap(u32, u32, u8);
36 extern void init_mem_block_lists(void);
37 extern void mem_stats(void);
38 
39 #endif /* GD_MEMORY_H */
Definition: gd_memory.h:23
u32 size
Definition: gd_memory.h:12
void init_mem_block_lists(void)
NULL the various GMemBlock list heads.
Definition: gd_memory.c:234
void mem_stats(void)
Print summary information about all used, free, and empty GMemBlocks.
Definition: gd_memory.c:277
Definition: gd_memory.h:24
struct GMemBlock * gd_add_mem_to_heap(u32, u32, u8)
Add memory of size at addr to the goddard heap for later allocation.
Definition: gd_memory.c:218
u32 gd_free_mem(void *)
Free memory allocated on the goddard heap.
Definition: gd_memory.c:142
A structure that holds information about memory allocation on goddard&#39;s heap.
Definition: gd_memory.h:7
u32 addr
Definition: gd_memory.h:10
union GMemBlock::@17 data
GMemBlockTypes
Block list types for GMemBlock.blockType.
Definition: gd_memory.h:22
u8 permFlag
Permanent (upper four bits) or Temporary (lower four bits)
Definition: gd_memory.h:14
unsigned char u8
Definition: ultratypes.h:12
struct GMemBlock * next
Definition: gd_memory.h:16
void * ptr
Definition: gd_memory.h:9
struct GMemBlock * prev
Definition: gd_memory.h:17
u8 blockType
Definition: gd_memory.h:13
unsigned int u32
Definition: ultratypes.h:16
void * gd_request_mem(u32, u8)
Request a pointer to goddard heap memory of at least size and of the same permanence.
Definition: gd_memory.c:168