From d350e2e28ab5817d58fc112fbe25a27ae8194f71 Mon Sep 17 00:00:00 2001 From: James Benton Date: Wed, 30 May 2018 15:14:46 +0100 Subject: [PATCH] coreinit: Add a prototype for __preinit_user. Also throw in CoreInitDefaultHeap whilst we are there, it's the default implementation of __preinit_user. --- cafe/coreinit/exports.def | 5 ++++- include/coreinit/memdefaultheap.h | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/cafe/coreinit/exports.def b/cafe/coreinit/exports.def index 5c9c7ec8..dd1aa205 100644 --- a/cafe/coreinit/exports.def +++ b/cafe/coreinit/exports.def @@ -242,6 +242,9 @@ MCP_DeleteTitleAsync MCP_DeviceList MCP_FullDeviceList +// coreinit/memdefaultheap.h +CoreInitDefaultHeap + // coreinit/memheap.h MEMGetArena MEMGetBaseHeapHandle @@ -426,7 +429,7 @@ __os_snprintf // ---------------------------------------------------------------------------- :DATA -// coreinit/defaultheap.h +// coreinit/memdefaultheap.h MEMAllocFromDefaultHeap MEMAllocFromDefaultHeapEx MEMFreeToDefaultHeap diff --git a/include/coreinit/memdefaultheap.h b/include/coreinit/memdefaultheap.h index ac4c2b1a..cbb08787 100644 --- a/include/coreinit/memdefaultheap.h +++ b/include/coreinit/memdefaultheap.h @@ -1,5 +1,6 @@ #pragma once #include +#include "memheap.h" /** * \defgroup coreinit_memdefaultheap Default Heap @@ -19,6 +20,27 @@ extern MEMAllocFromDefaultHeapFn MEMAllocFromDefaultHeap; extern MEMAllocFromDefaultHeapExFn MEMAllocFromDefaultHeapEx; extern MEMFreeToDefaultHeapFn MEMFreeToDefaultHeap; +/** + * Default implementation of __preinit_user. + */ +void +CoreInitDefaultHeap(MEMHeapHandle *outMem1, + MEMHeapHandle *outFG, + MEMHeapHandle *outMem2); + +/** + * Allows the user to completely customise the default heaps, this runs after + * the rpx code section has loaded but before the data section as the data + * sections are allocated from the default heap. + * + * This is for a user to export from their .rpx file, it is not exported from + * coreinit.rpl + */ +void +__preinit_user(MEMHeapHandle *outMem1, + MEMHeapHandle *outFG, + MEMHeapHandle *outMem2); + #ifdef __cplusplus } #endif