From 6cff52664744a3c7c6da0a9081c7b488127bda64 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 13 Jan 2025 20:17:10 -0600 Subject: [PATCH] [teagba] Add symbols needed for enabling exceptions --- deps/teagba/src/cstartup.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/deps/teagba/src/cstartup.cpp b/deps/teagba/src/cstartup.cpp index ea4a62c0..e3845e03 100644 --- a/deps/teagba/src/cstartup.cpp +++ b/deps/teagba/src/cstartup.cpp @@ -4,17 +4,20 @@ #include +#include +#include + namespace mgba { void initConsole(); } -#define MEM_EWRAM_BEGIN reinterpret_cast(0x02000000) -#define MEM_EWRAM_END reinterpret_cast(0x0203FFFF) +#define MEM_HEAP_BEGIN reinterpret_cast(0x02000000) +#define MEM_HEAP_END reinterpret_cast(0x0203FFFF) -#define HEAP_BEGIN reinterpret_cast(MEM_EWRAM_BEGIN) +#define HEAP_BEGIN reinterpret_cast(MEM_HEAP_BEGIN) // set size to half of EWRAM -#define HEAP_SIZE ((MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2) -#define HEAP_END reinterpret_cast(MEM_EWRAM_BEGIN + HEAP_SIZE) +#define HEAP_SIZE ((MEM_HEAP_END - MEM_HEAP_BEGIN) / 2) +#define HEAP_END reinterpret_cast(MEM_HEAP_BEGIN + HEAP_SIZE) extern void (*__preinit_array_start[]) (void); extern void (*__preinit_array_end[]) (void); @@ -25,6 +28,14 @@ int main(int argc, const char **argv); extern "C" { +void abort() { + REG_IE = 0; + teagba::intrwait(0, 0); + while (true); +} + +void *__gxx_personality_v0{}; + void __libc_init_array() { auto preInits = __preinit_array_end - __preinit_array_start; for (decltype(preInits) i = 0; i < preInits; i++) {