summaryrefslogtreecommitdiff
path: root/tests/libc/kernel_stub.c
blob: cacab3431b3e23a3ae04bc88f0e7a0710d5dae3e (plain)
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
29
30
31
#include <stdarg.h>

#include "stdio.h"
#include "stdlib.h"

// abaos has a kernel_panic function
// TODO: we should not need this stub, rather, libc functions should
// use other means to abort the process (e.g. with abort), then the
// kernel should catch this exception and issue the kernel_panic itself.
// anyway: the kernel has to decide whether it dies in panic or it
// kills the culprid child an merely goes his way..
void kernel_panic( const char *format, ... )
{
	(void)printf( "\n*** KERNEL PANIC ***\n" );
	
	va_list args;
        va_start( args, format );
        (void)vprintf( format, args );
        va_end( args );
	puts( "" );
	
	exit( 255 );
}

uintptr_t __stack_chk_guard = STACK_CHK_GUARD;

__attribute__( ( noreturn ) )
void __stack_chk_fail_local( void )
{
	abort( );
}