summaryrefslogtreecommitdiff
path: root/tests/libc/kernel_stub.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libc/kernel_stub.h')
-rw-r--r--tests/libc/kernel_stub.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/libc/kernel_stub.h b/tests/libc/kernel_stub.h
new file mode 100644
index 0000000..467ad20
--- /dev/null
+++ b/tests/libc/kernel_stub.h
@@ -0,0 +1,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