1 /*
2  *  syscall.c
3  *
4  *  Port on Texas Instruments TMS320C6x architecture
5  *
6  *  Copyright (C) 2006, 2010 Texas Instruments Incorporated
7  *  Author: Thomas Charleux (thomas.charleux@jaluna.com)
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License version 2 as
11  *  published by the Free Software Foundation.
12  */
13 
14 #include <features.h>
15 #include <errno.h>
16 #include <sys/types.h>
17 #include <sys/syscall.h>
18 #include <unistd.h>
19 #include <stdarg.h>
20 
syscall(long int __sysno,...)21 long int syscall (long int __sysno, ...)
22 {
23 	register long no __asm__("B0");
24 	register long a __asm__("A4");
25 	register long b __asm__("B4");
26 	register long c __asm__("A6");
27 	register long d __asm__("B6");
28 	register long e __asm__("A8");
29 	register long f __asm__("B8");
30 	long __res;
31 	va_list ap;
32 
33 	va_start( ap, __sysno);
34 	a = va_arg( ap, long);
35 	b = va_arg( ap, long);
36 	c = va_arg( ap, long);
37 	d = va_arg( ap, long);
38 	e = va_arg( ap, long);
39 	f = va_arg( ap, long);
40 	va_end( ap );
41 
42 	no = __sysno;
43 
44 	__asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (f), "b" (no)
45 			      : "memory", "cc");
46 
47 	__res = a;
48 	__SYSCALL_RETURN (long);
49 }
50