syscall_arch.h 3.0 KB
Newer Older
1 2 3 4 5
#define __SYSCALL_LL_E(x) (x)
#define __SYSCALL_LL_O(x) (x)

#define SYSCALL_RLIM_INFINITY (-1UL/2)

6 7 8 9 10
#if __mips_isa_rev >= 6
#define SYSCALL_CLOBBERLIST \
	"$1", "$3", "$10", "$11", "$12", "$13", \
	"$14", "$15", "$24", "$25", "memory"
#else
11 12 13
#define SYSCALL_CLOBBERLIST \
	"$1", "$3", "$10", "$11", "$12", "$13", \
	"$14", "$15", "$24", "$25", "hi", "lo", "memory"
14
#endif
15

16 17 18
static inline long __syscall0(long n)
{
	register long r7 __asm__("$7");
19
	register long r2 __asm__("$2") = n;
20
	__asm__ __volatile__ (
21 22 23
		"syscall"
		: "+&r"(r2), "=r"(r7)
		:
24
		: SYSCALL_CLOBBERLIST);
25 26 27 28 29 30 31
	return r7 ? -r2 : r2;
}

static inline long __syscall1(long n, long a)
{
	register long r4 __asm__("$4") = a;
	register long r7 __asm__("$7");
32
	register long r2 __asm__("$2") = n;
33
	__asm__ __volatile__ (
34 35 36
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4)
37
		: SYSCALL_CLOBBERLIST);
38 39 40 41 42 43 44 45
	return r7 ? -r2 : r2;
}

static inline long __syscall2(long n, long a, long b)
{
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
	register long r7 __asm__("$7");
46
	register long r2 __asm__("$2") = n;
47
	__asm__ __volatile__ (
48 49 50
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4), "r"(r5)
51
		: SYSCALL_CLOBBERLIST);
52
	return r7 ? -r2 : r2;
53 54 55 56 57 58 59 60
}

static inline long __syscall3(long n, long a, long b, long c)
{
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
	register long r6 __asm__("$6") = c;
	register long r7 __asm__("$7");
61
	register long r2 __asm__("$2") = n;
62
	__asm__ __volatile__ (
63 64 65
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4), "r"(r5), "r"(r6)
66
		: SYSCALL_CLOBBERLIST);
67
	return r7 ? -r2 : r2;
68 69 70 71 72 73 74 75
}

static inline long __syscall4(long n, long a, long b, long c, long d)
{
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
	register long r6 __asm__("$6") = c;
	register long r7 __asm__("$7") = d;
76
	register long r2 __asm__("$2") = n;
77
	__asm__ __volatile__ (
78 79 80
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6)
81
		: SYSCALL_CLOBBERLIST);
82
	return r7 ? -r2 : r2;
83 84 85 86
}

static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
87 88 89 90 91
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
	register long r6 __asm__("$6") = c;
	register long r7 __asm__("$7") = d;
	register long r8 __asm__("$8") = e;
92
	register long r2 __asm__("$2") = n;
93
	__asm__ __volatile__ (
94 95 96
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6), "r"(r8)
97
		: SYSCALL_CLOBBERLIST);
98
	return r7 ? -r2 : r2;
99 100 101 102
}

static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
103 104 105 106 107
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
	register long r6 __asm__("$6") = c;
	register long r7 __asm__("$7") = d;
	register long r8 __asm__("$8") = e;
108
	register long r9 __asm__("$9") = f;
109
	register long r2 __asm__("$2") = n;
110
	__asm__ __volatile__ (
111 112 113
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
114
		: SYSCALL_CLOBBERLIST);
115
	return r7 ? -r2 : r2;
116 117 118 119 120
}

#define VDSO_USEFUL
#define VDSO_CGT_SYM "__vdso_clock_gettime"
#define VDSO_CGT_VER "LINUX_2.6"
121 122 123

#define SO_SNDTIMEO_OLD 0x1005
#define SO_RCVTIMEO_OLD 0x1006