summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/cris/syscall-cris.c
diff options
context:
space:
mode:
authorTobias Anderberg <tobias.anderberg@axis.com>2002-09-16 08:08:37 +0000
committerTobias Anderberg <tobias.anderberg@axis.com>2002-09-16 08:08:37 +0000
commit35df59db508dbf23437f3253f25147191796e19f (patch)
tree59047d1c78611a04816d17cb8182666e1ae4b3b1 /libc/sysdeps/linux/cris/syscall-cris.c
parentda6874a62e91b80e39cfd8f20a5b9d36ec28db0b (diff)
Initial version of the CRIS port.
Diffstat (limited to 'libc/sysdeps/linux/cris/syscall-cris.c')
-rw-r--r--libc/sysdeps/linux/cris/syscall-cris.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/cris/syscall-cris.c b/libc/sysdeps/linux/cris/syscall-cris.c
new file mode 100644
index 000000000..fa923ec9d
--- /dev/null
+++ b/libc/sysdeps/linux/cris/syscall-cris.c
@@ -0,0 +1,41 @@
+/* syscall.c - generalized linux system call interface */
+
+#include <stdarg.h>
+#include <syscall.h>
+#include <errno.h>
+
+/* perform a Linux/CRIS system call with variable number of arguments
+ * put them and the syscall number in the right registers and call
+ * break 13.
+ */
+
+int
+syscall(int number, ...)
+{
+ register long __a __asm__ ("r10");
+ register long __b __asm__ ("r11");
+ register long __c __asm__ ("r12");
+ register long __d __asm__ ("r13");
+ register long __e __asm__ ("r0");
+ va_list args;
+
+ va_start(args, number);
+ __a = va_arg(args, int);
+ __b = va_arg(args, int);
+ __c = va_arg(args, int);
+ __d = va_arg(args, int);
+ __e = va_arg(args, int);
+ va_end(args);
+
+ __asm__ volatile ("movu.w %1,$r9\n\tbreak 13\n\t"
+ : "=r" (__a)
+ : "g" (number), "0" (__a), "r" (__b), "r" (__c), "r" (__d),
+ "r" (__e)
+ : "r10", "r9");
+
+ if (__a >= 0)
+ return __a;
+
+ errno = -__a;
+ return -1;
+}