summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/nios2/syscall.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-07-16 11:09:34 +0000
committerEric Andersen <andersen@codepoet.org>2004-07-16 11:09:34 +0000
commitc3d50a69839f8d80fc7244fde6e4a57e5e39dd36 (patch)
treec9e27baac7541384b806cce0845f28c1f59b5a2e /libc/sysdeps/linux/nios2/syscall.c
parent3cf731bf40f153a73373798085d1f45a80b972d6 (diff)
Pete Popov writes:
Hi Erik, I'm not sure why the NIOS support is not in uClibc -- perhaps the patch was rejected or never submitted? In any case, I'm playing with some NIOS stuff and created this patch against 0.9.26. The work was done by Microtronix. I'm not sure who else contributed to it. It would be great to have the NIOS support available in uClibc so developers don't have to go searching for these bits. Pete
Diffstat (limited to 'libc/sysdeps/linux/nios2/syscall.c')
-rw-r--r--libc/sysdeps/linux/nios2/syscall.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/nios2/syscall.c b/libc/sysdeps/linux/nios2/syscall.c
new file mode 100644
index 000000000..c6cce215a
--- /dev/null
+++ b/libc/sysdeps/linux/nios2/syscall.c
@@ -0,0 +1,47 @@
+/*
+ * libc/sysdeps/linux/nios2/syscall.c -- generic syscall function for linux/nios2
+ *
+ * Copyright (C) 2004 Microtronix Datacom Ltd.
+ *
+ * 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)
+{
+ register long _r2 asm("r2")=(long)TRAP_ID_SYSCALL;
+ register long _r3 asm("r3")=(long)sysnum;
+
+ register long _r4 asm("r4")=(long)(a);
+ register long _r5 asm("r5")=(long)(b);
+ register long _r6 asm("r6")=(long)(c);
+ register long _r7 asm("r7")=(long)(d);
+ register long _r8 asm("r8")=(long)(e);
+ register long _r9 asm("r9")=(long)(f);
+ asm volatile(
+ "trap "
+ : "=r"(_r2), "=r"(_r3)
+ : "0"(_r2), "1"(_r3),
+ "r"(_r4), "r"(_r5), "r"(_r6), "r"(_r7), "r"(_r8), "r"(_r9)
+ : "memory");
+
+ __syscall_return (long, _r2);
+}
+