From 42ac732b2e9e2a24ee596a803a053b0761dcc32a Mon Sep 17 00:00:00 2001 From: James Benton Date: Wed, 30 May 2018 13:11:57 +0100 Subject: [PATCH] coreinit: Add some memory functions. Adds OSGetForegroundBucket, OSGetForegroundBucketFreeArea, OSGetMemBound. --- cafe/coreinit/exports.def | 3 +++ include/coreinit/memory.h | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/cafe/coreinit/exports.def b/cafe/coreinit/exports.def index d8f035c..5c9c7ec 100644 --- a/cafe/coreinit/exports.def +++ b/cafe/coreinit/exports.def @@ -266,6 +266,9 @@ OSBlockMove OSBlockSet OSAllocFromSystem OSFreeToSystem +OSGetForegroundBucket +OSGetForegroundBucketFreeArea +OSGetMemBound // coreinit/memorymap.h OSEffectiveToPhysical diff --git a/include/coreinit/memory.h b/include/coreinit/memory.h index 76c1f4f..ff83221 100644 --- a/include/coreinit/memory.h +++ b/include/coreinit/memory.h @@ -12,6 +12,12 @@ extern "C" { #endif +typedef enum OSMemoryType +{ + OS_MEM1 = 1, + OS_MEM2 = 2, +} OSMemoryType; + void * OSBlockMove(void *dst, const void *src, @@ -23,13 +29,26 @@ OSBlockSet(void *dst, uint8_t val, uint32_t size); -void* +void * OSAllocFromSystem(uint32_t size, int align); void OSFreeToSystem(void *ptr); +BOOL +OSGetForegroundBucket(uint32_t *outAddr, + uint32_t *outSize); + +BOOL +OSGetForegroundBucketFreeArea(uint32_t *outAddr, + uint32_t *outSize); + +int +OSGetMemBound(OSMemoryType type, + uint32_t *outAddr, + uint32_t *outSize); + #ifdef __cplusplus } #endif