coreinit: Merge baseheap.h into memheap.h

This commit is contained in:
James Benton 2018-05-30 13:11:20 +01:00
parent 3c763b7a08
commit 3e117fe667
3 changed files with 38 additions and 52 deletions

View File

@ -39,11 +39,6 @@ OSXorAtomic64
OSTestAndClearAtomic64
OSTestAndSetAtomic64
// coreinit/baseheap.h
MEMGetArena
MEMGetBaseHeapHandle
MEMSetBaseHeapHandle
// coreinit/blockheap.h
MEMInitBlockHeap
MEMDestroyBlockHeap
@ -248,6 +243,9 @@ MCP_DeviceList
MCP_FullDeviceList
// coreinit/memheap.h
MEMGetArena
MEMGetBaseHeapHandle
MEMSetBaseHeapHandle
MEMDumpHeap
MEMFindContainHeap
MEMGetFillValForHeap

View File

@ -1,46 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_baseheap Base Heap
* \ingroup coreinit
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef void *MEMHeapHandle;
typedef enum MEMBaseHeapType
{
MEM_BASE_HEAP_MEM1 = 0,
MEM_BASE_HEAP_MEM2 = 1,
MEM_BASE_HEAP_FG = 8,
} MEMBaseHeapType;
/**
* Get which memory area a heap belongs to.
*/
MEMBaseHeapType
MEMGetArena(MEMHeapHandle handle);
/**
* Get base heap for memory area.
*/
MEMHeapHandle
MEMGetBaseHeapHandle(MEMBaseHeapType type);
/**
* Set base heap for memory area.
*/
MEMHeapHandle
MEMSetBaseHeapHandle(MEMBaseHeapType type,
MEMHeapHandle handle);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -16,6 +16,14 @@ extern "C" {
#endif
typedef struct MEMHeapHeader MEMHeapHeader;
typedef MEMHeapHeader *MEMHeapHandle;
typedef enum MEMBaseHeapType
{
MEM_BASE_HEAP_MEM1 = 0,
MEM_BASE_HEAP_MEM2 = 1,
MEM_BASE_HEAP_FG = 8,
} MEMBaseHeapType;
typedef enum MEMHeapFillType
{
@ -74,11 +82,35 @@ CHECK_OFFSET(MEMHeapHeader, 0x20, lock);
CHECK_OFFSET(MEMHeapHeader, 0x30, flags);
CHECK_SIZE(MEMHeapHeader, 0x40);
/**
* Get which memory area a heap belongs to.
*/
MEMBaseHeapType
MEMGetArena(MEMHeapHandle handle);
/**
* Get base heap for memory area.
*/
MEMHeapHandle
MEMGetBaseHeapHandle(MEMBaseHeapType type);
/**
* Set base heap for memory area.
*/
MEMHeapHandle
MEMSetBaseHeapHandle(MEMBaseHeapType type,
MEMHeapHandle handle);
/**
* Print details about heap to COSWarn
*/
void
MEMDumpHeap(MEMHeapHeader *heap);
MEMDumpHeap(MEMHeapHandle heap);
/**
* Find heap which contains a memory block.
@ -86,12 +118,14 @@ MEMDumpHeap(MEMHeapHeader *heap);
MEMHeapHeader *
MEMFindContainHeap(void *block);
/**
* Get the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set.
*/
uint32_t
MEMGetFillValForHeap(MEMHeapFillType type);
/**
* Set the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set.
*/