ciabatta/src/linux/entry.c

33 lines
734 B
C
Raw Normal View History

2023-07-22 14:30:04 +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-01 01:45:45 +00:00
_syscall_write(STDERR_FILENO, stack_chk_fail_msg, sizeof stack_chk_fail_msg);
2023-07-30 08:47:59 +00:00
_syscall_exit(1);
}
2023-07-27 13:49:53 +00:00
static void _fileapi_init();
2023-07-22 14:30:04 +00:00
void __libc_start_main(
int (*main)(int, char**, char**),
int argc, char **argv,
int (*init)(int, char**, char**),
void (*fini)(void),
void (*dl_fini)(void),
2023-07-22 14:30:04 +00:00
void *stack_end
) {
// Get the envp
2023-07-22 16:28:16 +00:00
char **envp = argv + (argc + 1);
init(argc, argv, envp);
2023-07-27 13:49:53 +00:00
_fileapi_init();
2023-07-22 16:28:16 +00:00
main(argc, argv, envp);
fini();
// glibc bug
2023-07-23 15:33:12 +00:00
// dl_fini();
2023-07-30 08:47:59 +00:00
_syscall_exit(0);
2023-07-22 14:30:04 +00:00
}