ソースを参照

add syscall() by d1mag in Bug 164

Mike Frysinger 19 年 前
コミット
02605efdb3
2 ファイル変更50 行追加1 行削除
  1. 1 1
      libc/sysdeps/linux/m68k/Makefile.arch
  2. 49 0
      libc/sysdeps/linux/m68k/syscall.c

+ 1 - 1
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
 

+ 49 - 0
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);
+}