WUT
0.1
Wii U Toolchain
Main Page
Modules
Data Structures
Files
File List
Globals
include
coreinit
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
15
extern
"C"
{
16
#endif
17
18
typedef
struct
MEMHeapHeader
MEMHeapHeader
;
19
20
typedef
enum
MEMHeapFillType
21
{
22
MEM_HEAP_FILL_TYPE_UNUSED
= 0,
23
MEM_HEAP_FILL_TYPE_ALLOCATED
= 1,
24
MEM_HEAP_FILL_TYPE_FREED
= 2,
25
}
MEMHeapFillType
;
26
27
typedef
enum
MEMHeapTag
28
{
29
MEM_BLOCK_HEAP_TAG
= 0x424C4B48u,
30
MEM_EXPANDED_HEAP_TAG
= 0x45585048u,
31
MEM_FRAME_HEAP_TAG
= 0x46524D48u,
32
MEM_UNIT_HEAP_TAG
= 0x554E5448u,
33
MEM_USER_HEAP_TAG
= 0x55535248u,
34
}
MEMHeapTag
;
35
36
typedef
enum
MEMHeapFlags
37
{
38
MEM_HEAP_FLAG_ZERO_ALLOCATED
= 1 << 0,
39
MEM_HEAP_FLAG_DEBUG_MODE
= 1 << 1,
40
MEM_HEAP_FLAG_USE_LOCK
= 1 << 2,
41
}
MEMHeapFlags
;
42
43
struct
MEMHeapHeader
44
{
46
MEMHeapTag
tag
;
47
49
MEMMemoryLink
link
;
50
52
MEMMemoryList
list
;
53
55
void
*
dataStart
;
56
58
void
*
dataEnd
;
59
61
OSSpinLock
lock
;
62
64
uint32_t
flags
;
65
66
UNKNOWN(0x0C);
67
};
68
CHECK_OFFSET(
MEMHeapHeader
, 0x00, tag);
69
CHECK_OFFSET(
MEMHeapHeader
, 0x04, link);
70
CHECK_OFFSET(
MEMHeapHeader
, 0x0C, list);
71
CHECK_OFFSET(
MEMHeapHeader
, 0x18, dataStart);
72
CHECK_OFFSET(
MEMHeapHeader
, 0x1C, dataEnd);
73
CHECK_OFFSET(
MEMHeapHeader
, 0x20, lock);
74
CHECK_OFFSET(
MEMHeapHeader
, 0x30, flags);
75
CHECK_SIZE(
MEMHeapHeader
, 0x40);
76
80
void
81
MEMDumpHeap
(
MEMHeapHeader
*heap);
82
86
MEMHeapHeader
*
87
MEMFindContainHeap
(
void
*block);
88
92
uint32_t
93
MEMGetFillValForHeap
(
MEMHeapFillType
type);
94
98
void
99
MEMSetFillValForHeap
(
MEMHeapFillType
type,
100
uint32_t value);
101
102
#ifdef __cplusplus
103
}
104
#endif
105
MEM_HEAP_FLAG_DEBUG_MODE
Definition:
memheap.h:39
MEMHeapHeader::list
MEMMemoryList list
List of all child heaps in this heap.
Definition:
memheap.h:52
MEMGetFillValForHeap
uint32_t MEMGetFillValForHeap(MEMHeapFillType type)
MEM_FRAME_HEAP_TAG
Definition:
memheap.h:31
MEM_HEAP_FILL_TYPE_UNUSED
Definition:
memheap.h:22
MEMSetFillValForHeap
void MEMSetFillValForHeap(MEMHeapFillType type, uint32_t value)
MEMFindContainHeap
MEMHeapHeader * MEMFindContainHeap(void *block)
MEM_HEAP_FLAG_USE_LOCK
Definition:
memheap.h:40
spinlock.h
MEMMemoryList
Definition:
memlist.h:26
MEMHeapHeader::dataEnd
void * dataEnd
Pointer to end of allocatable memory.
Definition:
memheap.h:58
MEMHeapHeader
Definition:
memheap.h:43
MEMHeapHeader::tag
MEMHeapTag tag
Tag indicating which type of heap this is.
Definition:
memheap.h:46
OSSpinLock
Definition:
spinlock.h:17
MEM_USER_HEAP_TAG
Definition:
memheap.h:33
MEM_HEAP_FLAG_ZERO_ALLOCATED
Definition:
memheap.h:38
MEM_HEAP_FILL_TYPE_ALLOCATED
Definition:
memheap.h:23
MEMHeapHeader::link
MEMMemoryLink link
Link for list this heap is in.
Definition:
memheap.h:49
wut.h
MEM_BLOCK_HEAP_TAG
Definition:
memheap.h:29
MEMHeapFillType
MEMHeapFillType
Definition:
memheap.h:20
MEMHeapHeader::dataStart
void * dataStart
Pointer to start of allocatable memory.
Definition:
memheap.h:55
MEMHeapFlags
MEMHeapFlags
Definition:
memheap.h:36
MEMMemoryLink
Definition:
memlist.h:17
MEMHeapHeader::flags
uint32_t flags
Flags set during heap creation.
Definition:
memheap.h:64
MEMHeapHeader::lock
OSSpinLock lock
Lock used when MEM_HEAP_FLAG_USE_LOCK is set.
Definition:
memheap.h:61
MEM_HEAP_FILL_TYPE_FREED
Definition:
memheap.h:24
MEM_EXPANDED_HEAP_TAG
Definition:
memheap.h:30
MEMDumpHeap
void MEMDumpHeap(MEMHeapHeader *heap)
memlist.h
MEM_UNIT_HEAP_TAG
Definition:
memheap.h:32
MEMHeapTag
MEMHeapTag
Definition:
memheap.h:27
Generated by
1.8.10