summaryrefslogtreecommitdiff
path: root/tests/libc/kernel_stub.h
blob: 467ad2038aaeeb289b5d460734dc1038be1b0e60 (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
#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 );

#endif