2023-07-22 14:30:04 +00:00
|
|
|
|
2023-08-03 18:36:03 +00:00
|
|
|
#include <syscall.h>
|
2023-07-22 15:23:39 +00:00
|
|
|
|
2023-07-23 07:28:04 +00:00
|
|
|
static char stack_chk_fail_msg[] =
|
|
|
|
"Stack check failed. "
|
|
|
|
"You've got a stack corruption somewhere. "
|
|
|
|
"Sorry these guys didn't tell me where\n";
|
|
|
|
|
|
|
|
void __stack_chk_fail(void) {
|
2023-08-03 18:36:03 +00:00
|
|
|
sys_write(STDERR_FILENO, stack_chk_fail_msg, sizeof stack_chk_fail_msg);
|
|
|
|
sys_exit(1);
|
2023-07-22 15:23:39 +00:00
|
|
|
}
|
|
|
|
|
2023-08-05 10:33:19 +00:00
|
|
|
extern int main(int argc, char **argv, char **envp);
|
2023-07-27 13:49:53 +00:00
|
|
|
static void _fileapi_init();
|
|
|
|
|
2023-08-05 11:20:20 +00:00
|
|
|
void _cia_start() {
|
2023-07-23 07:19:53 +00:00
|
|
|
// Get the envp
|
2023-08-05 10:33:19 +00:00
|
|
|
// char **envp = argv + (argc + 1);
|
|
|
|
// init(argc, argv, envp);
|
2023-07-27 13:49:53 +00:00
|
|
|
_fileapi_init();
|
2023-08-05 10:33:19 +00:00
|
|
|
int code = main(0, NULL, NULL);
|
|
|
|
// fini();
|
2023-07-23 07:19:53 +00:00
|
|
|
// glibc bug
|
2023-07-23 15:33:12 +00:00
|
|
|
// dl_fini();
|
2023-08-05 10:33:19 +00:00
|
|
|
sys_exit(code);
|
2023-07-22 14:30:04 +00:00
|
|
|
}
|