aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/crt/crt0.c
blob: 409ec196330ac0a0920cfcd3f0a4a4b8fe07505e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// MIT License, Copyright (c) 2021 Marvin Borner

#include <assert.h>
#include <def.h>
#include <rand.h>
#include <sys.h>

#ifdef USER

extern u32 __stack_chk_guard;
u32 __stack_chk_guard;

int main(int, char **);

int _start(int argc, char **argv);
int _start(int argc, char **argv)
{
	struct timer timer = { 0 };
	assert(dev_read(DEV_TIMER, &timer, 0, sizeof(timer)) == sizeof(timer));
	srand(timer.rtc + timer.time);
	__stack_chk_guard = rand();

	exit(main(argc, argv));

	return 1;
}

#endif