#ifndef KERNEL_STUB_H #define KERNEL_STUB_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, ... ); // definitions to emulate kernel functions by calling Linux kernel // syscalls directly (careful: works for 32-bit Intel only!) // those are defined in sys/syscall.h #define __NR_exit 1 #define __NR_write 4 // defined in unistd.h #define STDOUT_FILENO 1 long syscall0( long n ); long syscall1( long n, long a1 ); long syscall2( long n, long a1, long a2 ); long syscall3( long n, long a1, long a2, long a3 ); // SSP stub, we don't want to link against libssp #include #include #define STACK_CHK_GUARD 0xe2dee396 extern uintptr_t __stack_chk_guard; #endif