From 766e832363207702b3d840a23fc100cebaebc340 Mon Sep 17 00:00:00 2001 From: James Benton Date: Tue, 29 May 2018 10:50:49 +0100 Subject: [PATCH] coreinit: Add default heap data exports. --- cafe/coreinit/exports.def | 10 ++++++++++ include/coreinit/defaultheap.h | 26 ++++++++++++++++++++++++++ share/wut.ld | 4 ++++ 3 files changed, 40 insertions(+) create mode 100644 include/coreinit/defaultheap.h diff --git a/cafe/coreinit/exports.def b/cafe/coreinit/exports.def index a0e0ea8..e040e27 100644 --- a/cafe/coreinit/exports.def +++ b/cafe/coreinit/exports.def @@ -407,3 +407,13 @@ OSGetTitleID // coreinit/internal.h __os_snprintf + +// ---------------------------------------------------------------------------- +// Data exports +// ---------------------------------------------------------------------------- + +:DATA +// coreinit/defaultheap.h +MEMAllocFromDefaultHeap +MEMAllocFromDefaultHeapEx +MEMFreeToDefaultHeap diff --git a/include/coreinit/defaultheap.h b/include/coreinit/defaultheap.h new file mode 100644 index 0000000..a028859 --- /dev/null +++ b/include/coreinit/defaultheap.h @@ -0,0 +1,26 @@ +#pragma once +#include + +/** + * \defgroup coreinit_defaultheap Default Heap + * \ingroup coreinit + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*MEMAllocFromDefaultHeapFn)(uint32_t size); +typedef void *(*MEMAllocFromDefaultHeapExFn)(uint32_t size, int32_t alignment); +typedef void (*MEMFreeToDefaultHeapFn)(void *ptr); + +extern MEMAllocFromDefaultHeapFn MEMAllocFromDefaultHeap; +extern MEMAllocFromDefaultHeapExFn MEMAllocFromDefaultHeapEx; +extern MEMFreeToDefaultHeapFn MEMFreeToDefaultHeap; + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/share/wut.ld b/share/wut.ld index 3929375..c76359a 100644 --- a/share/wut.ld +++ b/share/wut.ld @@ -176,6 +176,10 @@ SECTIONS *(.fimport_vpad) } > loadmem + .dimport_coreinit ALIGN(16) : { + *(.dimport_coreinit) + } > loadmem + .symtab ALIGN(4) : { *(.symtab) } > loadmem