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,type1,arg1) \
19 type name(type1 arg1) \
20 { \
21 long __res; \
22 __asm__ volatile ("int $0x80" \
23 : "=a" (__res) \
24 : "0" (__NR_##name),"b" ((long)(arg1))); \
25 if (__res >= 0) \
26 return (type) __res; \
27 errno = -__res; \
28 return -1; \
29 }
30
31 #define _syscall2(type,name,type1,arg1,type2,arg2) \
32 type name(type1 arg1,type2 arg2) \
33 { \
34 long __res; \
35 __asm__ volatile ("int $0x80" \
36 : "=a" (__res) \
37 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
38 if (__res >= 0) \
39 return (type) __res; \
40 errno = -__res; \
41 return -1; \
42 }
43
44 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
45 type name(type1 arg1,type2 arg2,type3 arg3) \
46 { \
47 long __res; \
48 __asm__ volatile ("int $0x80" \
49 : "=a" (__res) \
50 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
51 "d" ((long)(arg3))); \
52 if (__res>=0) \
53 return (type) __res; \
54 errno=-__res; \
55 return -1; \
56 }
57
58 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
59 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
60 { \
61 long __res; \
62 __asm__ volatile ("int $0x80" \
63 : "=a" (__res) \
64 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
65 "d" ((long)(arg3)),"S" ((long)(arg4))); \
66 if (__res>=0) \
67 return (type) __res; \
68 errno=-__res; \
69 return -1; \
70 }
71
72 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
73 type5,arg5) \
74 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
75 { \
76 long __res; \
77 __asm__ volatile ("int $0x80" \
78 : "=a" (__res) \
79 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
80 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
81 if (__res>=0) \
82 return (type) __res; \
83 errno=-__res; \
84 return -1; \
85 }
86
87 #endif