2014-12-25 10:50:38 +00:00
|
|
|
#include <sys/iosupport.h>
|
2015-02-23 17:41:10 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
2014-12-25 10:50:38 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <3ds/types.h>
|
|
|
|
|
#include <3ds/svc.h>
|
|
|
|
|
|
|
|
|
|
void (*__system_retAddr)(void);
|
|
|
|
|
|
|
|
|
|
// Data from _prm structure
|
|
|
|
|
extern void* __service_ptr; // used to detect if we're run from a homebrew launcher
|
|
|
|
|
|
|
|
|
|
void __system_allocateHeaps();
|
|
|
|
|
void __system_initArgv();
|
2014-12-25 23:27:36 +00:00
|
|
|
void __appInit();
|
2014-12-25 10:50:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void __ctru_exit(int rc);
|
2015-02-23 17:41:10 +00:00
|
|
|
int __libctru_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz);
|
2014-12-25 10:50:38 +00:00
|
|
|
|
2014-12-30 22:37:53 +00:00
|
|
|
void __attribute__((weak)) __libctru_init(void (*retAddr)(void))
|
2014-12-25 10:50:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Register newlib exit() syscall
|
|
|
|
|
__syscalls.exit = __ctru_exit;
|
2015-02-23 17:41:10 +00:00
|
|
|
__syscalls.gettod_r = __libctru_gtod;
|
|
|
|
|
|
2014-12-25 10:50:38 +00:00
|
|
|
__system_retAddr = __service_ptr ? retAddr : NULL;
|
|
|
|
|
|
|
|
|
|
__system_allocateHeaps();
|
|
|
|
|
|
|
|
|
|
// Build argc/argv if present
|
|
|
|
|
__system_initArgv();
|
|
|
|
|
|
|
|
|
|
}
|