]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/asm-cris/arch-v32/unistd.h
CRIS v32: Let compiler know that memory is clobbered after a break op.
[net-next-2.6.git] / include / asm-cris / arch-v32 / unistd.h
CommitLineData
51533b61
MS
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) \
10type 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) \
57e6f964
JN
19 : "r" (__n_) \
20 : "memory"); \
51533b61
MS
21 if (__a >= 0) \
22 return (type) __a; \
23 errno = -__a; \
24 return (type) -1; \
25}
26
27#define _syscall1(type,name,type1,arg1) \
28type name(type1 arg1) \
29{ \
30 register long __a __asm__ ("r10") = (long) arg1; \
31 register long __n_ __asm__ ("r9") = (__NR_##name); \
32 __asm__ __volatile__ (".ifnc %0%1,$r10$r9\n\t" \
33 ".err\n\t" \
34 ".endif\n\t" \
35 "break 13" \
36 : "=r" (__a) \
57e6f964
JN
37 : "r" (__n_), "0" (__a) \
38 : "memory"); \
51533b61
MS
39 if (__a >= 0) \
40 return (type) __a; \
41 errno = -__a; \
42 return (type) -1; \
43}
44
45#define _syscall2(type,name,type1,arg1,type2,arg2) \
46type name(type1 arg1,type2 arg2) \
47{ \
48 register long __a __asm__ ("r10") = (long) arg1; \
49 register long __b __asm__ ("r11") = (long) arg2; \
50 register long __n_ __asm__ ("r9") = (__NR_##name); \
51 __asm__ __volatile__ (".ifnc %0%1%3,$r10$r9$r11\n\t" \
52 ".err\n\t" \
53 ".endif\n\t" \
54 "break 13" \
55 : "=r" (__a) \
57e6f964
JN
56 : "r" (__n_), "0" (__a), "r" (__b) \
57 : "memory"); \
51533b61
MS
58 if (__a >= 0) \
59 return (type) __a; \
60 errno = -__a; \
61 return (type) -1; \
62}
63
64#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
65type name(type1 arg1,type2 arg2,type3 arg3) \
66{ \
67 register long __a __asm__ ("r10") = (long) arg1; \
68 register long __b __asm__ ("r11") = (long) arg2; \
69 register long __c __asm__ ("r12") = (long) arg3; \
70 register long __n_ __asm__ ("r9") = (__NR_##name); \
71 __asm__ __volatile__ (".ifnc %0%1%3%4,$r10$r9$r11$r12\n\t" \
72 ".err\n\t" \
73 ".endif\n\t" \
74 "break 13" \
75 : "=r" (__a) \
57e6f964
JN
76 : "r" (__n_), "0" (__a), "r" (__b), "r" (__c) \
77 : "memory"); \
51533b61
MS
78 if (__a >= 0) \
79 return (type) __a; \
80 errno = -__a; \
81 return (type) -1; \
82}
83
84#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
85type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
86{ \
87 register long __a __asm__ ("r10") = (long) arg1; \
88 register long __b __asm__ ("r11") = (long) arg2; \
89 register long __c __asm__ ("r12") = (long) arg3; \
90 register long __d __asm__ ("r13") = (long) arg4; \
91 register long __n_ __asm__ ("r9") = (__NR_##name); \
92 __asm__ __volatile__ (".ifnc %0%1%3%4%5,$r10$r9$r11$r12$r13\n\t" \
93 ".err\n\t" \
94 ".endif\n\t" \
95 "break 13" \
96 : "=r" (__a) \
97 : "r" (__n_), "0" (__a), "r" (__b), \
57e6f964
JN
98 "r" (__c), "r" (__d)\
99 : "memory"); \
51533b61
MS
100 if (__a >= 0) \
101 return (type) __a; \
102 errno = -__a; \
103 return (type) -1; \
104}
105
106#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
107 type5,arg5) \
108type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
109{ \
110 register long __a __asm__ ("r10") = (long) arg1; \
111 register long __b __asm__ ("r11") = (long) arg2; \
112 register long __c __asm__ ("r12") = (long) arg3; \
113 register long __d __asm__ ("r13") = (long) arg4; \
114 register long __e __asm__ ("mof") = (long) arg5; \
115 register long __n_ __asm__ ("r9") = (__NR_##name); \
116 __asm__ __volatile__ (".ifnc %0%1%3%4%5%6,$r10$r9$r11$r12$r13$mof\n\t" \
117 ".err\n\t" \
118 ".endif\n\t" \
119 "break 13" \
120 : "=r" (__a) \
121 : "r" (__n_), "0" (__a), "r" (__b), \
57e6f964
JN
122 "r" (__c), "r" (__d), "h" (__e) \
123 : "memory"); \
51533b61
MS
124 if (__a >= 0) \
125 return (type) __a; \
126 errno = -__a; \
127 return (type) -1; \
128}
129
130#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
131 type5,arg5,type6,arg6) \
132type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
133{ \
134 register long __a __asm__ ("r10") = (long) arg1; \
135 register long __b __asm__ ("r11") = (long) arg2; \
136 register long __c __asm__ ("r12") = (long) arg3; \
137 register long __d __asm__ ("r13") = (long) arg4; \
138 register long __e __asm__ ("mof") = (long) arg5; \
139 register long __f __asm__ ("srp") = (long) arg6; \
140 register long __n_ __asm__ ("r9") = (__NR_##name); \
141 __asm__ __volatile__ (".ifnc %0%1%3%4%5%6%7,$r10$r9$r11$r12$r13$mof$srp\n\t" \
142 ".err\n\t" \
143 ".endif\n\t" \
144 "break 13" \
145 : "=r" (__a) \
146 : "r" (__n_), "0" (__a), "r" (__b), \
57e6f964
JN
147 "r" (__c), "r" (__d), "h" (__e), "x" (__f) \
148 : "memory"); \
51533b61
MS
149 if (__a >= 0) \
150 return (type) __a; \
151 errno = -__a; \
152 return (type) -1; \
153}
154
155#endif