diff options
Diffstat (limited to 'Source/Library/Userland')
-rw-r--r-- | Source/Library/Userland/Syscall/Syscall.wtf.cpp | 20 | ||||
-rw-r--r-- | Source/Library/Userland/Syscall/Syscall.wtf.h | 9 | ||||
-rw-r--r-- | Source/Library/Userland/common.h | 10 |
3 files changed, 39 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 diff --git a/Source/Library/Userland/common.h b/Source/Library/Userland/common.h new file mode 100644 index 0000000..27218f7 --- /dev/null +++ b/Source/Library/Userland/common.h @@ -0,0 +1,10 @@ +#ifndef DEF_COMMON +#define DEF_COMMON + +#define NULL 0 + +#include <types.h> + +#include <CMem.ns.h> + +#endif |