wut  v1.7.0
Wii U Toolchain
Data Structures | Typedefs | Enumerations | Functions
Common Memory Heap

Common memory heap fucntions. More...

Collaboration diagram for Common Memory Heap:

Data Structures

struct  MEMHeapHeader
 

Typedefs

typedef struct MEMHeapHeader MEMHeapHeader
 
typedef MEMHeapHeaderMEMHeapHandle
 
typedef enum MEMBaseHeapType MEMBaseHeapType
 
typedef enum MEMHeapFillType MEMHeapFillType
 
typedef enum MEMHeapTag MEMHeapTag
 
typedef enum MEMHeapFlags MEMHeapFlags
 

Enumerations

enum  MEMBaseHeapType {
  MEM_BASE_HEAP_MEM1 = 0 ,
  MEM_BASE_HEAP_MEM2 = 1 ,
  MEM_BASE_HEAP_FG = 8
}
 
enum  MEMHeapFillType {
  MEM_HEAP_FILL_TYPE_UNUSED = 0 ,
  MEM_HEAP_FILL_TYPE_ALLOCATED = 1 ,
  MEM_HEAP_FILL_TYPE_FREED = 2
}
 
enum  MEMHeapTag {
  MEM_BLOCK_HEAP_TAG = 0x424C4B48u ,
  MEM_EXPANDED_HEAP_TAG = 0x45585048u ,
  MEM_FRAME_HEAP_TAG = 0x46524D48u ,
  MEM_UNIT_HEAP_TAG = 0x554E5448u ,
  MEM_USER_HEAP_TAG = 0x55535248u
}
 
enum  MEMHeapFlags {
  MEM_HEAP_FLAG_ZERO_ALLOCATED = 1 << 0 ,
  MEM_HEAP_FLAG_DEBUG_MODE = 1 << 1 ,
  MEM_HEAP_FLAG_USE_LOCK = 1 << 2
}
 

Functions

MEMBaseHeapType MEMGetArena (MEMHeapHandle handle)
 Get which memory area a heap belongs to. More...
 
MEMHeapHandle MEMGetBaseHeapHandle (MEMBaseHeapType type)
 Get base heap for memory area. More...
 
MEMHeapHandle MEMSetBaseHeapHandle (MEMBaseHeapType type, MEMHeapHandle handle)
 Set base heap for memory area. More...
 
MEMHeapHandle MEMCreateUserHeapHandle (void *heap, uint32_t size)
 Create a heap handle for a user defined heap. More...
 
void MEMDumpHeap (MEMHeapHandle heap)
 Print details about heap to COSWarn. More...
 
MEMHeapHeaderMEMFindContainHeap (void *block)
 Find heap which contains a memory block. More...
 
MEMHeapHandle MEMFindParentHeap (MEMHeapHandle handle)
 Find the parent heap of a given heap. More...
 
uint32_t MEMGetFillValForHeap (MEMHeapFillType type)
 Get the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set. More...
 
void MEMSetFillValForHeap (MEMHeapFillType type, uint32_t value)
 Set the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set. More...
 
BOOL MEMCheckHeap (MEMHeapHandle handle)
 Checks the heap for corruption. More...
 

Detailed Description

Common memory heap fucntions.


Data Structure Documentation

◆ MEMHeapHeader

struct MEMHeapHeader

Definition at line 51 of file memheap.h.

Data Fields
MEMHeapTag tag Tag indicating which type of heap this is.
MEMMemoryLink link Link for list this heap is in.
MEMMemoryList list List of all child heaps in this heap.
void * dataStart Pointer to start of allocatable memory.
void * dataEnd Pointer to end of allocatable memory.
OSSpinLock lock Lock used when MEM_HEAP_FLAG_USE_LOCK is set.
uint32_t flags Flags set during heap creation.

Typedef Documentation

◆ MEMHeapHeader

typedef struct MEMHeapHeader MEMHeapHeader

Definition at line 1 of file memheap.h.

◆ MEMHeapHandle

Definition at line 19 of file memheap.h.

◆ MEMBaseHeapType

◆ MEMHeapFillType

◆ MEMHeapTag

typedef enum MEMHeapTag MEMHeapTag

◆ MEMHeapFlags

typedef enum MEMHeapFlags MEMHeapFlags

Enumeration Type Documentation

◆ MEMBaseHeapType

Enumerator
MEM_BASE_HEAP_MEM1 
MEM_BASE_HEAP_MEM2 
MEM_BASE_HEAP_FG 

Definition at line 21 of file memheap.h.

◆ MEMHeapFillType

Enumerator
MEM_HEAP_FILL_TYPE_UNUSED 
MEM_HEAP_FILL_TYPE_ALLOCATED 
MEM_HEAP_FILL_TYPE_FREED 

Definition at line 28 of file memheap.h.

◆ MEMHeapTag

enum MEMHeapTag
Enumerator
MEM_BLOCK_HEAP_TAG 
MEM_EXPANDED_HEAP_TAG 
MEM_FRAME_HEAP_TAG 
MEM_UNIT_HEAP_TAG 
MEM_USER_HEAP_TAG 

Definition at line 35 of file memheap.h.

◆ MEMHeapFlags

Enumerator
MEM_HEAP_FLAG_ZERO_ALLOCATED 
MEM_HEAP_FLAG_DEBUG_MODE 
MEM_HEAP_FLAG_USE_LOCK 

Definition at line 44 of file memheap.h.

Function Documentation

◆ MEMGetArena()

MEMBaseHeapType MEMGetArena ( MEMHeapHandle  handle)

Get which memory area a heap belongs to.

◆ MEMGetBaseHeapHandle()

MEMHeapHandle MEMGetBaseHeapHandle ( MEMBaseHeapType  type)

Get base heap for memory area.

◆ MEMSetBaseHeapHandle()

MEMHeapHandle MEMSetBaseHeapHandle ( MEMBaseHeapType  type,
MEMHeapHandle  handle 
)

Set base heap for memory area.

◆ MEMCreateUserHeapHandle()

MEMHeapHandle MEMCreateUserHeapHandle ( void *  heap,
uint32_t  size 
)

Create a heap handle for a user defined heap.

◆ MEMDumpHeap()

void MEMDumpHeap ( MEMHeapHandle  heap)

Print details about heap to COSWarn.

◆ MEMFindContainHeap()

MEMHeapHeader* MEMFindContainHeap ( void *  block)

Find heap which contains a memory block.

◆ MEMFindParentHeap()

MEMHeapHandle MEMFindParentHeap ( MEMHeapHandle  handle)

Find the parent heap of a given heap.

Return NULL if no parent was found.

◆ MEMGetFillValForHeap()

uint32_t MEMGetFillValForHeap ( MEMHeapFillType  type)

Get the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set.

◆ MEMSetFillValForHeap()

void MEMSetFillValForHeap ( MEMHeapFillType  type,
uint32_t  value 
)

Set the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set.

◆ MEMCheckHeap()

BOOL MEMCheckHeap ( MEMHeapHandle  handle)

Checks the heap for corruption.