Blame view

buildroot/buildroot-2016.08.1/package/libaio/0001-arches.patch 7.57 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
  Patch borrowed from OpenEmbedded, available at
  /meta/recipes-extended/libaio/libaio/00_arches.patch in their source
  tree. This patch has been modified to only add the MIPS definitions.
  
  The patch adds MIPS specific definitions (syscall number and macros).
  
  Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
  
  Index: libaio-0.3.110/src/syscall.h
  ===================================================================
  --- libaio-0.3.110.orig/src/syscall.h
  +++ libaio-0.3.110/src/syscall.h
  @@ -28,6 +28,8 @@
   #include "syscall-sparc.h"
   #elif defined(__aarch64__)
   #include "syscall-arm64.h"
  +#elif defined(__mips__)
  +#include "syscall-mips.h"
   #else
   #warning "using generic syscall method"
   #include "syscall-generic.h"
  Index: libaio-0.3.110/src/syscall-mips.h
  ===================================================================
  --- /dev/null
  +++ libaio-0.3.110/src/syscall-mips.h
  @@ -0,0 +1,223 @@
  +/*
  + * This file is subject to the terms and conditions of the GNU General Public
  + * License.  See the file "COPYING" in the main directory of this archive
  + * for more details.
  + *
  + * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
  + * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  + *
  + * Changed system calls macros _syscall5 - _syscall7 to push args 5 to 7 onto
  + * the stack. Robin Farine for ACN S.A, Copyright (C) 1996 by ACN S.A
  + */
  +
  +#ifndef _MIPS_SIM_ABI32
  +#define _MIPS_SIM_ABI32			1
  +#define _MIPS_SIM_NABI32		2
  +#define _MIPS_SIM_ABI64			3
  +#endif
  +
  +#if _MIPS_SIM == _MIPS_SIM_ABI32
  +
  +/*
  + * Linux o32 style syscalls are in the range from 4000 to 4999.
  + */
  +#define __NR_Linux			4000
  +#define __NR_io_setup			(__NR_Linux + 241)
  +#define __NR_io_destroy			(__NR_Linux + 242)
  +#define __NR_io_getevents		(__NR_Linux + 243)
  +#define __NR_io_submit			(__NR_Linux + 244)
  +#define __NR_io_cancel			(__NR_Linux + 245)
  +
  +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
  +
  +#if _MIPS_SIM == _MIPS_SIM_ABI64
  +
  +/*
  + * Linux 64-bit syscalls are in the range from 5000 to 5999.
  + */
  +#define __NR_Linux			5000
  +#define __NR_io_setup			(__NR_Linux + 200)
  +#define __NR_io_destroy			(__NR_Linux + 201)
  +#define __NR_io_getevents		(__NR_Linux + 202)
  +#define __NR_io_submit			(__NR_Linux + 203)
  +#define __NR_io_cancel			(__NR_Linux + 204)
  +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
  +
  +#if _MIPS_SIM == _MIPS_SIM_NABI32
  +
  +/*
  + * Linux N32 syscalls are in the range from 6000 to 6999.
  + */
  +#define __NR_Linux			6000
  +#define __NR_io_setup			(__NR_Linux + 200)
  +#define __NR_io_destroy			(__NR_Linux + 201)
  +#define __NR_io_getevents		(__NR_Linux + 202)
  +#define __NR_io_submit			(__NR_Linux + 203)
  +#define __NR_io_cancel			(__NR_Linux + 204)
  +#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
  +
  +#define io_syscall1(type,fname,sname,atype,a) \
  +type fname(atype a) \
  +{ \
  +	register unsigned long __a0 asm("$4") = (unsigned long) a; \
  +	register unsigned long __a3 asm("$7"); \
  +	unsigned long __v0; \
  +	\
  +	__asm__ volatile ( \
  +	".set\tnoreorder
  \t" \
  +	"li\t$2, %3\t\t\t# " #fname "
  \t" \
  +	"syscall
  \t" \
  +	"move\t%0, $2
  \t" \
  +	".set\treorder" \
  +	: "=&r" (__v0), "=r" (__a3) \
  +	: "r" (__a0), "i" (__NR_##sname) \
  +	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  +	  "memory"); \
  +	\
  +	if (__a3 == 0) \
  +		return (type) __v0; \
  +	return (type) -1; \
  +}
  +
  +#define io_syscall2(type,fname,sname,atype,a,btype,b) \
  +type fname(atype a, btype b) \
  +{ \
  +	register unsigned long __a0 asm("$4") = (unsigned long) a; \
  +	register unsigned long __a1 asm("$5") = (unsigned long) b; \
  +	register unsigned long __a3 asm("$7"); \
  +	unsigned long __v0; \
  +	\
  +	__asm__ volatile ( \
  +	".set\tnoreorder
  \t" \
  +	"li\t$2, %4\t\t\t# " #fname "
  \t" \
  +	"syscall
  \t" \
  +	"move\t%0, $2
  \t" \
  +	".set\treorder" \
  +	: "=&r" (__v0), "=r" (__a3) \
  +	: "r" (__a0), "r" (__a1), "i" (__NR_##sname) \
  +	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  +	  "memory"); \
  +	\
  +	if (__a3 == 0) \
  +		return (type) __v0; \
  +	return (type) -1; \
  +}
  +
  +#define io_syscall3(type,fname,sname,atype,a,btype,b,ctype,c) \
  +type fname(atype a, btype b, ctype c) \
  +{ \
  +	register unsigned long __a0 asm("$4") = (unsigned long) a; \
  +	register unsigned long __a1 asm("$5") = (unsigned long) b; \
  +	register unsigned long __a2 asm("$6") = (unsigned long) c; \
  +	register unsigned long __a3 asm("$7"); \
  +	unsigned long __v0; \
  +	\
  +	__asm__ volatile ( \
  +	".set\tnoreorder
  \t" \
  +	"li\t$2, %5\t\t\t# " #fname "
  \t" \
  +	"syscall
  \t" \
  +	"move\t%0, $2
  \t" \
  +	".set\treorder" \
  +	: "=&r" (__v0), "=r" (__a3) \
  +	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##sname) \
  +	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  +	  "memory"); \
  +	\
  +	if (__a3 == 0) \
  +		return (type) __v0; \
  +	return (type) -1; \
  +}
  +
  +#define io_syscall4(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d) \
  +type fname(atype a, btype b, ctype c, dtype d) \
  +{ \
  +	register unsigned long __a0 asm("$4") = (unsigned long) a; \
  +	register unsigned long __a1 asm("$5") = (unsigned long) b; \
  +	register unsigned long __a2 asm("$6") = (unsigned long) c; \
  +	register unsigned long __a3 asm("$7") = (unsigned long) d; \
  +	unsigned long __v0; \
  +	\
  +	__asm__ volatile ( \
  +	".set\tnoreorder
  \t" \
  +	"li\t$2, %5\t\t\t# " #fname "
  \t" \
  +	"syscall
  \t" \
  +	"move\t%0, $2
  \t" \
  +	".set\treorder" \
  +	: "=&r" (__v0), "+r" (__a3) \
  +	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##sname) \
  +	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  +	  "memory"); \
  +	\
  +	if (__a3 == 0) \
  +		return (type) __v0; \
  +	return (type) -1; \
  +}
  +
  +#if (_MIPS_SIM == _MIPS_SIM_ABI32)
  +
  +/*
  + * Using those means your brain needs more than an oil change ;-)
  + */
  +
  +#define io_syscall5(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  +type fname(atype a, btype b, ctype c, dtype d, etype e) \
  +{ \
  +	register unsigned long __a0 asm("$4") = (unsigned long) a; \
  +	register unsigned long __a1 asm("$5") = (unsigned long) b; \
  +	register unsigned long __a2 asm("$6") = (unsigned long) c; \
  +	register unsigned long __a3 asm("$7") = (unsigned long) d; \
  +	unsigned long __v0; \
  +	\
  +	__asm__ volatile ( \
  +	".set\tnoreorder
  \t" \
  +	"lw\t$2, %6
  \t" \
  +	"subu\t$29, 32
  \t" \
  +	"sw\t$2, 16($29)
  \t" \
  +	"li\t$2, %5\t\t\t# " #fname "
  \t" \
  +	"syscall
  \t" \
  +	"move\t%0, $2
  \t" \
  +	"addiu\t$29, 32
  \t" \
  +	".set\treorder" \
  +	: "=&r" (__v0), "+r" (__a3) \
  +	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##sname), \
  +	  "m" ((unsigned long)e) \
  +	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  +	  "memory"); \
  +	\
  +	if (__a3 == 0) \
  +		return (type) __v0; \
  +	return (type) -1; \
  +}
  +
  +#endif /* (_MIPS_SIM == _MIPS_SIM_ABI32) */
  +
  +#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
  +
  +#define io_syscall5(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  +type fname (atype a,btype b,ctype c,dtype d,etype e) \
  +{ \
  +	register unsigned long __a0 asm("$4") = (unsigned long) a; \
  +	register unsigned long __a1 asm("$5") = (unsigned long) b; \
  +	register unsigned long __a2 asm("$6") = (unsigned long) c; \
  +	register unsigned long __a3 asm("$7") = (unsigned long) d; \
  +	register unsigned long __a4 asm("$8") = (unsigned long) e; \
  +	unsigned long __v0; \
  +	\
  +	__asm__ volatile ( \
  +	".set\tnoreorder
  \t" \
  +	"li\t$2, %6\t\t\t# " #fname "
  \t" \
  +	"syscall
  \t" \
  +	"move\t%0, $2
  \t" \
  +	".set\treorder" \
  +	: "=&r" (__v0), "+r" (__a3) \
  +	: "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), "i" (__NR_##sname) \
  +	: "$2", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  +	  "memory"); \
  +	\
  +	if (__a3 == 0) \
  +		return (type) __v0; \
  +	return (type) -1; \
  +}
  +
  +#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
  +