syscall_arch.h 2.9 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
#define SYSCALL_CLOBBERLIST \
	"$1", "$3", "$10", "$11", "$12", "$13", \
	"$14", "$15", "$24", "$25", "hi", "lo", "memory"

10 11 12
static inline long __syscall0(long n)
{
	register long r7 __asm__("$7");
13
	register long r2 __asm__("$2") = n;
14
	__asm__ __volatile__ (
15 16 17
		"syscall"
		: "+&r"(r2), "=r"(r7)
		:
18
		: SYSCALL_CLOBBERLIST);
19 20 21 22 23 24 25
	return r7 ? -r2 : r2;
}

static inline long __syscall1(long n, long a)
{
	register long r4 __asm__("$4") = a;
	register long r7 __asm__("$7");
26
	register long r2 __asm__("$2") = n;
27
	__asm__ __volatile__ (
28 29 30
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4)
31
		: SYSCALL_CLOBBERLIST);
32 33 34 35 36 37 38 39
	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");
40
	register long r2 __asm__("$2") = n;
41
	__asm__ __volatile__ (
42 43 44
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4), "r"(r5)
45
		: SYSCALL_CLOBBERLIST);
46
	return r7 ? -r2 : r2;
47 48 49 50 51 52 53 54
}

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");
55
	register long r2 __asm__("$2") = n;
56
	__asm__ __volatile__ (
57 58 59
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4), "r"(r5), "r"(r6)
60
		: SYSCALL_CLOBBERLIST);
61
	return r7 ? -r2 : r2;
62 63 64 65 66 67 68 69
}

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;
70
	register long r2 __asm__("$2") = n;
71
	__asm__ __volatile__ (
72 73 74
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6)
75
		: SYSCALL_CLOBBERLIST);
76
	return r7 ? -r2 : r2;
77 78 79 80
}

static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
81 82 83 84 85
	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;
86
	register long r2 __asm__("$2") = n;
87
	__asm__ __volatile__ (
88 89 90
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6), "r"(r8)
91
		: SYSCALL_CLOBBERLIST);
92
	return r7 ? -r2 : r2;
93 94 95 96
}

static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
97 98 99 100 101
	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;
102
	register long r9 __asm__("$9") = f;
103
	register long r2 __asm__("$2") = n;
104
	__asm__ __volatile__ (
105 106 107
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
108
		: SYSCALL_CLOBBERLIST);
109
	return r7 ? -r2 : r2;
110 111 112 113 114
}

#define VDSO_USEFUL
#define VDSO_CGT_SYM "__vdso_clock_gettime"
#define VDSO_CGT_VER "LINUX_2.6"
115 116 117

#define SO_SNDTIMEO_OLD 0x1005
#define SO_RCVTIMEO_OLD 0x1006