From 02605efdb3a8db28810894186b494c7186720cc7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 15 Jan 2006 09:09:50 +0000 Subject: add syscall() by d1mag in Bug 164 --- libc/sysdeps/linux/m68k/Makefile.arch | 2 +- libc/sysdeps/linux/m68k/syscall.c | 49 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/m68k/syscall.c (limited to 'libc/sysdeps/linux/m68k') 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 + * + * 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 +#include +#include +#include + +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); +} -- cgit v1.2.3