summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-15 09:09:50 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-15 09:09:50 +0000
commit02605efdb3a8db28810894186b494c7186720cc7 (patch)
treec5d0f1b71b92e700cadde688cc528fdec0475e5b /libc/sysdeps/linux
parent0ee2f561e7fb3aed126daf57aaee5c3fa8b05f02 (diff)
add syscall() by d1mag in Bug 164
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/m68k/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/m68k/syscall.c49
2 files changed, 50 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/m68k/Makefile.arch b/libc/sysdeps/linux/m68k/Makefile.arch
index 935d2d203..1ce72a61a 100644
--- a/libc/sysdeps/linux/m68k/Makefile.arch
+++ b/libc/sysdeps/linux/m68k/Makefile.arch
@@ -5,7 +5,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := ptrace.c brk.c __syscall_error.c
+CSRC := ptrace.c brk.c __syscall_error.c syscall.c
SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S
diff --git a/libc/sysdeps/linux/m68k/syscall.c b/libc/sysdeps/linux/m68k/syscall.c
new file mode 100644
index 000000000..1d09962e5
--- /dev/null
+++ b/libc/sysdeps/linux/m68k/syscall.c
@@ -0,0 +1,49 @@
+/* syscall for m68k/uClibc
+ *
+ * Copyright (C) 2005 by Christian Magnusson <mag@mag.cx>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <features.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
+{
+ long __res;
+ __asm__ __volatile__ ("movel %7, %%a0\n\t"\
+ "movel %6, %%d5\n\t"\
+ "movel %5, %%d4\n\t"\
+ "movel %4, %%d3\n\t"\
+ "movel %3, %%d2\n\t"\
+ "movel %2, %%d1\n\t"\
+ "movel %1, %%d0\n\t"\
+ "trap #0\n\t"\
+ "movel %%d0, %0"\
+ : "=g" (__res)\
+ : "g" (sysnum),\
+ "a" ((long)a),\
+ "a" ((long)b),\
+ "a" ((long)c),\
+ "a" ((long)d),\
+ "a" ((long)e),\
+ "g" ((long)f)\
+ : "cc", "%d0", "%d1", "%d2", "%d3",\
+ "%d4", "%d5", "%a0");
+
+ __syscall_return(long,__res);
+}