syscall_arch.h 2.9 KB
Newer Older
R
Rich Felker 已提交
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"

R
Rich Felker 已提交
10 11 12
static inline long __syscall0(long n)
{
	register long r7 __asm__("$7");
13
	register long r2 __asm__("$2") = n;
R
Rich Felker 已提交
14
	__asm__ __volatile__ (
15 16 17
		"syscall"
		: "+&r"(r2), "=r"(r7)
		:
18
		: SYSCALL_CLOBBERLIST);
R
Rich Felker 已提交
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;
R
Rich Felker 已提交
27
	__asm__ __volatile__ (
28 29 30
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4)
31
		: SYSCALL_CLOBBERLIST);
R
Rich Felker 已提交
32 33 34 35 36
	return r7 ? -r2 : r2;
}

static inline long __syscall2(long n, long a, long b)
{
37 38
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
R
Rich Felker 已提交
39
	register long r7 __asm__("$7");
40
	register long r2 __asm__("$2") = n;
R
Rich Felker 已提交
41 42

	__asm__ __volatile__ (
43 44 45
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4), "r"(r5)
46
		: SYSCALL_CLOBBERLIST);
47
	return r7 ? -r2 : r2;
R
Rich Felker 已提交
48 49 50 51
}

static inline long __syscall3(long n, long a, long b, long c)
{
52 53 54
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
	register long r6 __asm__("$6") = c;
R
Rich Felker 已提交
55
	register long r7 __asm__("$7");
56
	register long r2 __asm__("$2") = n;
R
Rich Felker 已提交
57 58

	__asm__ __volatile__ (
59 60 61
		"syscall"
		: "+&r"(r2), "=r"(r7)
		: "r"(r4), "r"(r5), "r"(r6)
62
		: SYSCALL_CLOBBERLIST);
63
	return r7 ? -r2 : r2;
R
Rich Felker 已提交
64 65 66 67
}

static inline long __syscall4(long n, long a, long b, long c, long d)
{
68 69 70 71
	register long r4 __asm__("$4") = a;
	register long r5 __asm__("$5") = b;
	register long r6 __asm__("$6") = c;
	register long r7 __asm__("$7") = d;
72
	register long r2 __asm__("$2") = n;
R
Rich Felker 已提交
73 74

	__asm__ __volatile__ (
75 76 77
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6)
78
		: SYSCALL_CLOBBERLIST);
79
	return r7 ? -r2 : r2;
R
Rich Felker 已提交
80 81 82 83
}

static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
84 85 86 87 88
	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;
89
	register long r2 __asm__("$2") = n;
R
Rich Felker 已提交
90

91
	__asm__ __volatile__ (
92 93 94
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6), "r"(r8)
95
		: SYSCALL_CLOBBERLIST);
96
	return r7 ? -r2 : r2;
R
Rich Felker 已提交
97 98 99 100
}

static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
101 102 103 104 105 106
	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;
	register long r9 __asm__("$9") = f;
107
	register long r2 __asm__("$2") = n;
R
Rich Felker 已提交
108

109
	__asm__ __volatile__ (
110 111 112
		"syscall"
		: "+&r"(r2), "+r"(r7)
		: "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
113
		: SYSCALL_CLOBBERLIST);
114
	return r7 ? -r2 : r2;
R
Rich Felker 已提交
115 116 117 118 119
}

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

#define SO_SNDTIMEO_OLD 0x1005
#define SO_RCVTIMEO_OLD 0x1006