From f92657e8b59517866efb25b3295bc9a31e8cc348 Mon Sep 17 00:00:00 2001 From: Ash Logan Date: Mon, 22 Apr 2019 12:43:37 +1000 Subject: [PATCH] coreinit: Use rplwrap for exit (__rplwrap_exit) --- cafe/coreinit.def | 4 +++- include/coreinit/exit.h | 2 +- include/wut.h | 1 + include/wut_rplwrap.h | 3 +++ libraries/wutnewlib/wut_newlib.c | 6 ++---- 5 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 include/wut_rplwrap.h diff --git a/cafe/coreinit.def b/cafe/coreinit.def index bb3be89..32939ef 100644 --- a/cafe/coreinit.def +++ b/cafe/coreinit.def @@ -1210,7 +1210,6 @@ bspQuery bspRead bspShutdown bspWrite -exit //memclr //memcpy //memmove @@ -1229,6 +1228,9 @@ smdSimpleBufFree smdSimpleBufGetStatistics smdSimpleBufPoolCreate +:TEXT_WRAP +exit + :DATA MEMAllocFromDefaultHeap MEMAllocFromDefaultHeapEx diff --git a/include/coreinit/exit.h b/include/coreinit/exit.h index 51bcb98..5dc0087 100644 --- a/include/coreinit/exit.h +++ b/include/coreinit/exit.h @@ -12,7 +12,7 @@ extern "C" { #endif void -exit(int code); +RPLWRAP(exit)(int code); void _Exit(int code); diff --git a/include/wut.h b/include/wut.h index a704f41..cdbd464 100644 --- a/include/wut.h +++ b/include/wut.h @@ -8,3 +8,4 @@ #include "wut_structsize.h" #include "wut_types.h" +#include "wut_rplwrap.h" diff --git a/include/wut_rplwrap.h b/include/wut_rplwrap.h new file mode 100644 index 0000000..433903a --- /dev/null +++ b/include/wut_rplwrap.h @@ -0,0 +1,3 @@ +#pragma once + +#define RPLWRAP(func) __rplwrap_##func diff --git a/libraries/wutnewlib/wut_newlib.c b/libraries/wutnewlib/wut_newlib.c index 4eda7d0..3623229 100644 --- a/libraries/wutnewlib/wut_newlib.c +++ b/libraries/wutnewlib/wut_newlib.c @@ -1,9 +1,6 @@ #include "wut_newlib.h" #include -// Forward newlib _exit to the coreinit.rpl _Exit -extern void _Exit(int status); - static void __init_wut_syscall_array() { @@ -14,7 +11,8 @@ __init_wut_syscall_array() __syscalls.lock_release = __wut_lock_release; //__syscalls.malloc_lock = __wut_malloc_lock; //__syscalls.malloc_unlock = __wut_malloc_unlock; - __syscalls.exit = _Exit; + //use coreinit's exit function + __syscalls.exit = RPLWRAP(exit); __syscalls.gettod_r = __wut_gettod_r; __syscalls.clock_gettime = __wut_clock_gettime; __syscalls.clock_settime = __wut_clock_settime;