2 * libc/sysdeps/linux/nios2/syscall.c -- generic syscall function for linux/nios2
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Library General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
16 * You should have received a copy of the GNU Library General Public License
17 * along with this program; see the file COPYING.LIB. If not, see
18 * <http://www.gnu.org/licenses/>.
23 #include <sys/types.h>
24 #include <sys/syscall.h>
27 long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
29 register long _r2 __asm__("r2")=(long)TRAP_ID_SYSCALL;
30 register long _r3 __asm__("r3")=(long)sysnum;
32 register long _r4 __asm__("r4")=(long)(a);
33 register long _r5 __asm__("r5")=(long)(b);
34 register long _r6 __asm__("r6")=(long)(c);
35 register long _r7 __asm__("r7")=(long)(d);
36 register long _r8 __asm__("r8")=(long)(e);
37 register long _r9 __asm__("r9")=(long)(f);
40 : "=r"(_r2), "=r"(_r3)
42 "r"(_r4), "r"(_r5), "r"(_r6), "r"(_r7), "r"(_r8), "r"(_r9)
45 __syscall_return (long, _r2);