summaryrefslogtreecommitdiff
path: root/Source/Library/Userland/Syscall
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-18 15:27:34 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-18 15:27:34 +0200
commit323e12f1f9ab33df15dcfed210e807561d98fa8c (patch)
tree7d76e6932d4a979a1f2bfafc94478b66b1479bbc /Source/Library/Userland/Syscall
parentbc2eccdd11c27029096fb3e891073503eb269e27 (diff)
downloadMelon-323e12f1f9ab33df15dcfed210e807561d98fa8c.tar.gz
Melon-323e12f1f9ab33df15dcfed210e807561d98fa8c.zip
Re-organized everything
Diffstat (limited to 'Source/Library/Userland/Syscall')
-rw-r--r--Source/Library/Userland/Syscall/Syscall.wtf.cpp20
-rw-r--r--Source/Library/Userland/Syscall/Syscall.wtf.h9
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