wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
memheap.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include "spinlock.h"
4#include "memlist.h"
5
14#ifdef __cplusplus
15extern "C" {
16#endif
17
20
27
34
35typedef enum MEMHeapTag
36{
37 MEM_BLOCK_HEAP_TAG = 0x424C4B48u,
38 MEM_EXPANDED_HEAP_TAG = 0x45585048u,
39 MEM_FRAME_HEAP_TAG = 0x46524D48u,
40 MEM_UNIT_HEAP_TAG = 0x554E5448u,
41 MEM_USER_HEAP_TAG = 0x55535248u,
43
50
52{
55
58
61
63 void *dataStart;
64
66 void *dataEnd;
67
70
72 uint32_t flags;
73
74 WUT_UNKNOWN_BYTES(0x0C);
75};
76WUT_CHECK_OFFSET(MEMHeapHeader, 0x00, tag);
77WUT_CHECK_OFFSET(MEMHeapHeader, 0x04, link);
78WUT_CHECK_OFFSET(MEMHeapHeader, 0x0C, list);
79WUT_CHECK_OFFSET(MEMHeapHeader, 0x18, dataStart);
80WUT_CHECK_OFFSET(MEMHeapHeader, 0x1C, dataEnd);
81WUT_CHECK_OFFSET(MEMHeapHeader, 0x20, lock);
82WUT_CHECK_OFFSET(MEMHeapHeader, 0x30, flags);
83WUT_CHECK_SIZE(MEMHeapHeader, 0x40);
84
85
91
92
98
99
105 MEMHeapHandle handle);
106
112 uint32_t size);
113
117void
119
120
126
132
136uint32_t
138
139
143void
145 uint32_t value);
146
150BOOL
152
153#ifdef __cplusplus
154}
155#endif
156
uint32_t flags
Flags set during heap creation.
Definition memheap.h:72
MEMMemoryList list
List of all child heaps in this heap.
Definition memheap.h:60
MEMHeapTag tag
Tag indicating which type of heap this is.
Definition memheap.h:54
MEMMemoryLink link
Link for list this heap is in.
Definition memheap.h:57
void * dataStart
Pointer to start of allocatable memory.
Definition memheap.h:63
OSSpinLock lock
Lock used when MEM_HEAP_FLAG_USE_LOCK is set.
Definition memheap.h:69
void * dataEnd
Pointer to end of allocatable memory.
Definition memheap.h:66
MEMHeapHeader * MEMFindContainHeap(void *block)
Find heap which contains a memory block.
MEMHeapHandle MEMSetBaseHeapHandle(MEMBaseHeapType type, MEMHeapHandle handle)
Set base heap for memory area.
void MEMDumpHeap(MEMHeapHandle heap)
Print details about heap to COSWarn.
void MEMSetFillValForHeap(MEMHeapFillType type, uint32_t value)
Set the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set.
MEMHeapHeader * MEMHeapHandle
Definition memheap.h:19
MEMBaseHeapType
Definition memheap.h:22
MEMHeapFillType
Definition memheap.h:29
MEMHeapFlags
Definition memheap.h:45
MEMBaseHeapType MEMGetArena(MEMHeapHandle handle)
Get which memory area a heap belongs to.
MEMHeapHandle MEMFindParentHeap(MEMHeapHandle handle)
Find the parent heap of a given heap.
BOOL MEMCheckHeap(MEMHeapHandle handle)
Checks the heap for corruption.
MEMHeapHandle MEMGetBaseHeapHandle(MEMBaseHeapType type)
Get base heap for memory area.
uint32_t MEMGetFillValForHeap(MEMHeapFillType type)
Get the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set.
MEMHeapHandle MEMCreateUserHeapHandle(void *heap, uint32_t size)
Create a heap handle for a user defined heap.
MEMHeapTag
Definition memheap.h:36
@ MEM_BASE_HEAP_MEM1
Definition memheap.h:23
@ MEM_BASE_HEAP_FG
Definition memheap.h:25
@ MEM_BASE_HEAP_MEM2
Definition memheap.h:24
@ MEM_HEAP_FILL_TYPE_FREED
Definition memheap.h:32
@ MEM_HEAP_FILL_TYPE_UNUSED
Definition memheap.h:30
@ MEM_HEAP_FILL_TYPE_ALLOCATED
Definition memheap.h:31
@ MEM_HEAP_FLAG_DEBUG_MODE
Definition memheap.h:47
@ MEM_HEAP_FLAG_ZERO_ALLOCATED
Definition memheap.h:46
@ MEM_HEAP_FLAG_USE_LOCK
Definition memheap.h:48
@ MEM_UNIT_HEAP_TAG
Definition memheap.h:40
@ MEM_USER_HEAP_TAG
Definition memheap.h:41
@ MEM_EXPANDED_HEAP_TAG
Definition memheap.h:38
@ MEM_FRAME_HEAP_TAG
Definition memheap.h:39
@ MEM_BLOCK_HEAP_TAG
Definition memheap.h:37
int32_t BOOL
Definition wut_types.h:7