aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/crt/crt0.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libc/crt/crt0.c')
-rw-r--r--libs/libc/crt/crt0.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/libs/libc/crt/crt0.c b/libs/libc/crt/crt0.c
index 6c38474..3bd413f 100644
--- a/libs/libc/crt/crt0.c
+++ b/libs/libc/crt/crt0.c
@@ -1,18 +1,28 @@
// MIT License, Copyright (c) 2021 Marvin Borner
+#include <assert.h>
#include <def.h>
+#include <random.h>
#include <sys.h>
#ifdef USER
-extern int main(int, char **);
+extern u32 __stack_chk_guard;
+u32 __stack_chk_guard;
-void _start(void);
-void _start(void)
+int main(int, char **);
+
+int _start(int argc, char **argv);
+int _start(int argc, char **argv)
{
- exit(main(0, NULL));
- while (1)
- ;
+ u32 stamp = 0;
+ assert(read("/dev/rtc", &stamp, 0, sizeof(stamp)) == sizeof(stamp) && stamp);
+ srand(stamp);
+ rand_fill(&__stack_chk_guard, sizeof(__stack_chk_guard));
+
+ exit(main(argc, argv));
+
+ return 1;
}
#endif