mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-09 15:09:22 +01:00
26ac7b3ff2
- Added (dummy) __init/fini_wut_malloc stubs called by wutcrt in order to ensure that wutmalloc gets linked in - malloc/realloc/calloc now properly set errno to ENOMEM during failure - realloc no longer fails if ptr==NULL (in this case it works like a regular malloc) - realloc no longer does an out of bounds copy if the new size is smaller than the old size - free(NULL) is now supported as per the C standard - Disabled sbrk/malloc-lock support code in wutnewlib because newlib's malloc is replaced with wutmalloc
38 lines
947 B
C
38 lines
947 B
C
#include "wut_newlib.h"
|
|
#include <coreinit/exit.h>
|
|
|
|
// Forward newlib _exit to the coreinit.rpl _Exit
|
|
extern void _Exit(int status);
|
|
|
|
static void
|
|
__init_wut_syscall_array()
|
|
{
|
|
//__syscalls.sbrk_r = __wut_sbrk_r;
|
|
__syscalls.lock_init = __wut_lock_init;
|
|
__syscalls.lock_close = __wut_lock_close;
|
|
__syscalls.lock_acquire = __wut_lock_acquire;
|
|
__syscalls.lock_release = __wut_lock_release;
|
|
//__syscalls.malloc_lock = __wut_malloc_lock;
|
|
//__syscalls.malloc_unlock = __wut_malloc_unlock;
|
|
__syscalls.exit = _Exit;
|
|
__syscalls.gettod_r = __wut_gettod_r;
|
|
__syscalls.clock_gettime = __wut_clock_gettime;
|
|
__syscalls.clock_settime = __wut_clock_settime;
|
|
__syscalls.clock_getres = __wut_clock_getres;
|
|
__syscalls.nanosleep = __wut_nanosleep;
|
|
}
|
|
|
|
void
|
|
__init_wut_newlib()
|
|
{
|
|
//__init_wut_sbrk_heap();
|
|
//__init_wut_malloc_lock();
|
|
__init_wut_syscall_array();
|
|
}
|
|
|
|
void
|
|
__fini_wut_newlib()
|
|
{
|
|
//__fini_wut_sbrk_heap();
|
|
}
|