diff options
Diffstat (limited to 'Source/Library/Userland/Syscall')
-rw-r--r-- | Source/Library/Userland/Syscall/Syscall.wtf.cpp | 20 | ||||
-rw-r--r-- | Source/Library/Userland/Syscall/Syscall.wtf.h | 9 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Source/Library/Userland/Syscall/Syscall.wtf.cpp b/Source/Library/Userland/Syscall/Syscall.wtf.cpp new file mode 100644 index 0000000..2c03b20 --- /dev/null +++ b/Source/Library/Userland/Syscall/Syscall.wtf.cpp @@ -0,0 +1,20 @@ +#include "Syscall.wtf.h" + +int main(); + +unsigned int syscall(unsigned int n, unsigned int a, unsigned int b, unsigned int c) { + unsigned int r; + asm volatile ("int $64;" + : "=a"(r) : "a"(n), "b"(a), "c"(b), "d"(c)); + return r; +} + +extern "C" void start() { + unsigned int r = main(); + asm volatile("int $66" : : "a"(r)); +} + +void putch(char c) { + unsigned int x = c; + syscall(0xFFFFFF01, x); +} diff --git a/Source/Library/Userland/Syscall/Syscall.wtf.h b/Source/Library/Userland/Syscall/Syscall.wtf.h new file mode 100644 index 0000000..b220d14 --- /dev/null +++ b/Source/Library/Userland/Syscall/Syscall.wtf.h @@ -0,0 +1,9 @@ +#ifndef DEF_SYSCALL_WTF_H +#define DEF_SYSCALL_WTF_H + +#include <types.h> + +void putch(char); +unsigned int syscall(unsigned int n, unsigned int a, unsigned int b = 0, unsigned int c = 0); + +#endif |