wut/include/coreinit/frameheap.h

92 lines
1.9 KiB
C
Raw Normal View History

2016-01-07 14:20:32 +01:00
#pragma once
#include <wut.h>
#include "memheap.h"
2016-01-07 14:20:32 +01:00
2016-01-07 17:02:54 +01:00
/**
* \defgroup coreinit_frameheap Frame Heap
* \ingroup coreinit
* @{
*/
2016-01-07 15:09:43 +01:00
#ifdef __cplusplus
extern "C" {
#endif
2016-01-07 14:20:32 +01:00
2016-01-08 16:28:52 +01:00
typedef enum MEMFrameHeapFreeMode
2016-01-07 14:20:32 +01:00
{
MEM_FRAME_HEAP_FREE_FROM_BOTTOM = 1 << 0,
MEM_FRAME_HEAP_FREE_FROM_TOP = 1 << 1,
2016-01-08 16:28:52 +01:00
} MEMFrameHeapFreeMode;
2016-01-07 14:20:32 +01:00
2016-01-08 17:52:12 +01:00
typedef struct MEMFrameHeap MEMFrameHeap;
typedef struct MEMFrameHeapState MEMFrameHeapState;
struct MEMFrameHeapState
{
uint32_t tag;
void *head;
void *tail;
MEMFrameHeapState *previous;
};
CHECK_OFFSET(MEMFrameHeapState, 0x00, tag);
CHECK_OFFSET(MEMFrameHeapState, 0x04, head);
CHECK_OFFSET(MEMFrameHeapState, 0x08, tail);
CHECK_OFFSET(MEMFrameHeapState, 0x0C, previous);
CHECK_SIZE(MEMFrameHeapState, 0x10);
2016-01-08 17:52:12 +01:00
struct MEMFrameHeap
{
MEMHeapHeader header;
void *head;
void *tail;
MEMFrameHeapState *previousState;
2016-01-08 17:52:12 +01:00
};
CHECK_OFFSET(MEMFrameHeap, 0x00, header);
CHECK_OFFSET(MEMFrameHeap, 0x40, head);
CHECK_OFFSET(MEMFrameHeap, 0x44, tail);
CHECK_OFFSET(MEMFrameHeap, 0x48, previousState);
CHECK_SIZE(MEMFrameHeap, 0x4C);
2016-01-08 17:52:12 +01:00
2016-01-07 14:20:32 +01:00
MEMFrameHeap *
MEMCreateFrmHeapEx(MEMFrameHeap *heap,
uint32_t size,
uint32_t flags);
2016-01-07 14:20:32 +01:00
void *
MEMDestroyFrmHeap(MEMFrameHeap *heap);
void *
MEMAllocFromFrmHeapEx(MEMFrameHeap *heap,
uint32_t size,
int alignment);
void
MEMFreeToFrmHeap(MEMFrameHeap *heap,
MEMFrameHeapFreeMode mode);
BOOL
MEMRecordStateForFrmHeap(MEMFrameHeap *heap,
uint32_t tag);
BOOL
MEMFreeByStateToFrmHeap(MEMFrameHeap *heap,
uint32_t tag);
uint32_t
MEMAdjustFrmHeap(MEMFrameHeap *heap);
uint32_t
MEMResizeForMBlockFrmHeap(MEMFrameHeap *heap,
uint32_t addr,
uint32_t size);
uint32_t
MEMGetAllocatableSizeForFrmHeapEx(MEMFrameHeap *heap,
int alignment);
2016-01-07 15:09:43 +01:00
#ifdef __cplusplus
}
#endif
2016-01-07 17:02:54 +01:00
/** @} */