1 #ifndef _ASM_I386_UNISTD_H_
2 #define _ASM_I386_UNISTD_H_
3
4
5 #define _syscall0(type,name) \
6 type name(void) \
7 { \
8 long __res; \
9 __asm__ volatile ("int $0x80" \
10 : "=a" (__res) \
11 : "0" (__NR_##name)); \
12 if (__res >= 0) \
13 return (type) __res; \
14 errno = -__res; \
15 return -1; \
16 }
17
18 #define _syscall1(type,name,atype,a) \
19 type name(atype a) \
20 { \
21 long __res; \
22 __asm__ volatile ("int $0x80" \
23 : "=a" (__res) \
24 : "0" (__NR_##name),"b" ((long)(a))); \
25 if (__res >= 0) \
26 return (type) __res; \
27 errno = -__res; \
28 return -1; \
29 }
30
31 #define _syscall2(type,name,atype,a,btype,b) \
32 type name(atype a,btype b) \
33 { \
34 long __res; \
35 __asm__ volatile ("int $0x80" \
36 : "=a" (__res) \
37 : "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b))); \
38 if (__res >= 0) \
39 return (type) __res; \
40 errno = -__res; \
41 return -1; \
42 }
43
44 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
45 type name(atype a,btype b,ctype c) \
46 { \
47 long __res; \
48 __asm__ volatile ("int $0x80" \
49 : "=a" (__res) \
50 : "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
51 if (__res>=0) \
52 return (type) __res; \
53 errno=-__res; \
54 return -1; \
55 }
56
57 #define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
58 type name (atype a, btype b, ctype c, dtype d) \
59 { \
60 long __res; \
61 __asm__ volatile ("int $0x80" \
62 : "=a" (__res) \
63 : "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)), \
64 "d" ((long)(c)),"S" ((long)(d))); \
65 if (__res>=0) \
66 return (type) __res; \
67 errno=-__res; \
68 return -1; \
69 }
70
71 #define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
72 type name (atype a,btype b,ctype c,dtype d,etype e) \
73 { \
74 long __res; \
75 __asm__ volatile ("int $0x80" \
76 : "=a" (__res) \
77 : "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)), \
78 "d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \
79 if (__res>=0) \
80 return (type) __res; \
81 errno=-__res; \
82 return -1; \
83 }
84
85 #endif