Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unistd.h
Go to the documentation of this file.
1 #ifndef _ASM_CRIS_ARCH_UNISTD_H_
2 #define _ASM_CRIS_ARCH_UNISTD_H_
3 
4 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
5 /*
6  * Don't remove the .ifnc tests; they are an insurance against
7  * any hard-to-spot gcc register allocation bugs.
8  */
9 #define _syscall0(type,name) \
10 type name(void) \
11 { \
12  register long __a __asm__ ("r10"); \
13  register long __n_ __asm__ ("r9") = (__NR_##name); \
14  __asm__ __volatile__ (".ifnc %0%1,$r10$r9\n\t" \
15  ".err\n\t" \
16  ".endif\n\t" \
17  "break 13" \
18  : "=r" (__a) \
19  : "r" (__n_)); \
20  if (__a >= 0) \
21  return (type) __a; \
22  errno = -__a; \
23  return (type) -1; \
24 }
25 
26 #define _syscall1(type,name,type1,arg1) \
27 type name(type1 arg1) \
28 { \
29  register long __a __asm__ ("r10") = (long) arg1; \
30  register long __n_ __asm__ ("r9") = (__NR_##name); \
31  __asm__ __volatile__ (".ifnc %0%1,$r10$r9\n\t" \
32  ".err\n\t" \
33  ".endif\n\t" \
34  "break 13" \
35  : "=r" (__a) \
36  : "r" (__n_), "0" (__a)); \
37  if (__a >= 0) \
38  return (type) __a; \
39  errno = -__a; \
40  return (type) -1; \
41 }
42 
43 #define _syscall2(type,name,type1,arg1,type2,arg2) \
44 type name(type1 arg1,type2 arg2) \
45 { \
46  register long __a __asm__ ("r10") = (long) arg1; \
47  register long __b __asm__ ("r11") = (long) arg2; \
48  register long __n_ __asm__ ("r9") = (__NR_##name); \
49  __asm__ __volatile__ (".ifnc %0%1%3,$r10$r9$r11\n\t" \
50  ".err\n\t" \
51  ".endif\n\t" \
52  "break 13" \
53  : "=r" (__a) \
54  : "r" (__n_), "0" (__a), "r" (__b)); \
55  if (__a >= 0) \
56  return (type) __a; \
57  errno = -__a; \
58  return (type) -1; \
59 }
60 
61 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
62 type name(type1 arg1,type2 arg2,type3 arg3) \
63 { \
64  register long __a __asm__ ("r10") = (long) arg1; \
65  register long __b __asm__ ("r11") = (long) arg2; \
66  register long __c __asm__ ("r12") = (long) arg3; \
67  register long __n_ __asm__ ("r9") = (__NR_##name); \
68  __asm__ __volatile__ (".ifnc %0%1%3%4,$r10$r9$r11$r12\n\t" \
69  ".err\n\t" \
70  ".endif\n\t" \
71  "break 13" \
72  : "=r" (__a) \
73  : "r" (__n_), "0" (__a), "r" (__b), "r" (__c)); \
74  if (__a >= 0) \
75  return (type) __a; \
76  errno = -__a; \
77  return (type) -1; \
78 }
79 
80 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
81 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
82 { \
83  register long __a __asm__ ("r10") = (long) arg1; \
84  register long __b __asm__ ("r11") = (long) arg2; \
85  register long __c __asm__ ("r12") = (long) arg3; \
86  register long __d __asm__ ("r13") = (long) arg4; \
87  register long __n_ __asm__ ("r9") = (__NR_##name); \
88  __asm__ __volatile__ (".ifnc %0%1%3%4%5,$r10$r9$r11$r12$r13\n\t" \
89  ".err\n\t" \
90  ".endif\n\t" \
91  "break 13" \
92  : "=r" (__a) \
93  : "r" (__n_), "0" (__a), "r" (__b), \
94  "r" (__c), "r" (__d)); \
95  if (__a >= 0) \
96  return (type) __a; \
97  errno = -__a; \
98  return (type) -1; \
99 }
100 
101 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
102  type5,arg5) \
103 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
104 { \
105  register long __a __asm__ ("r10") = (long) arg1; \
106  register long __b __asm__ ("r11") = (long) arg2; \
107  register long __c __asm__ ("r12") = (long) arg3; \
108  register long __d __asm__ ("r13") = (long) arg4; \
109  register long __n_ __asm__ ("r9") = (__NR_##name); \
110  __asm__ __volatile__ (".ifnc %0%1%3%4%5,$r10$r9$r11$r12$r13\n\t" \
111  ".err\n\t" \
112  ".endif\n\t" \
113  "move %6,$mof\n\t" \
114  "break 13" \
115  : "=r" (__a) \
116  : "r" (__n_), "0" (__a), "r" (__b), \
117  "r" (__c), "r" (__d), "g" (arg5)); \
118  if (__a >= 0) \
119  return (type) __a; \
120  errno = -__a; \
121  return (type) -1; \
122 }
123 
124 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
125  type5,arg5,type6,arg6) \
126 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
127 { \
128  register long __a __asm__ ("r10") = (long) arg1; \
129  register long __b __asm__ ("r11") = (long) arg2; \
130  register long __c __asm__ ("r12") = (long) arg3; \
131  register long __d __asm__ ("r13") = (long) arg4; \
132  register long __n_ __asm__ ("r9") = (__NR_##name); \
133  __asm__ __volatile__ (".ifnc %0%1%3%4%5,$r10$r9$r11$r12$r13\n\t" \
134  ".err\n\t" \
135  ".endif\n\t" \
136  "move %6,$mof\n\tmove %7,$srp\n\t" \
137  "break 13" \
138  : "=r" (__a) \
139  : "r" (__n_), "0" (__a), "r" (__b), \
140  "r" (__c), "r" (__d), "g" (arg5), "g" (arg6)\
141  : "srp"); \
142  if (__a >= 0) \
143  return (type) __a; \
144  errno = -__a; \
145  return (type) -1; \
146 }
147 
148 #endif