cns3xxx: fix missing and incomplete cache flushes on DMA cache sync for cpu - fixes...
[openwrt.git] / target / linux / ubicom32 / patches-2.6.30 / 120-libgcc_func.patch
1 --- a/arch/ubicom32/Makefile
2 +++ b/arch/ubicom32/Makefile
3 @@ -60,9 +60,6 @@ cflags-$(CONFIG_UBICOM32_V4) := -march=
4 ldflags-$(CONFIG_LINKER_RELAXATION) := --relax
5 LDFLAGS_vmlinux := $(ldflags-y)
6
7 -GCCLIBDIR := $(dir $(shell $(CC) $(cflags-y) -print-libgcc-file-name))
8 -GCC_LIBS := $(GCCLIBDIR)/libgcc.a
9 -
10 KBUILD_CFLAGS += $(cflags-y) -ffunction-sections
11 KBUILD_AFLAGS += $(cflags-y)
12
13 @@ -84,7 +81,6 @@ core-y += arch/$(ARCH)/kernel/ \
14 drivers-$(CONFIG_OPROFILE) += arch/ubicom32/oprofile/
15
16 libs-y += arch/$(ARCH)/lib/
17 -libs-y += $(GCC_LIBS)
18
19 archclean:
20
21 --- a/arch/ubicom32/lib/Makefile
22 +++ b/arch/ubicom32/lib/Makefile
23 @@ -30,3 +30,4 @@
24 #
25
26 lib-y := checksum.o delay.o mem_ubicom32.o
27 +lib-y += ashldi3.o ashrdi3.o divmod.o lshrdi3.o muldi3.o
28 --- /dev/null
29 +++ b/arch/ubicom32/lib/ashldi3.c
30 @@ -0,0 +1,62 @@
31 +/* ashrdi3.c extracted from gcc-2.95.2/libgcc2.c which is: */
32 +/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
33 +
34 +This file is part of GNU CC.
35 +
36 +GNU CC is free software; you can redistribute it and/or modify
37 +it under the terms of the GNU General Public License as published by
38 +the Free Software Foundation; either version 2, or (at your option)
39 +any later version.
40 +
41 +GNU CC is distributed in the hope that it will be useful,
42 +but WITHOUT ANY WARRANTY; without even the implied warranty of
43 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 +GNU General Public License for more details.
45 +
46 +You should have received a copy of the GNU General Public License
47 +along with GNU CC; see the file COPYING. If not, write to
48 +the Free Software Foundation, 59 Temple Place - Suite 330,
49 +Boston, MA 02111-1307, USA. */
50 +
51 +#define BITS_PER_UNIT 8
52 +
53 +typedef int SItype __attribute__ ((mode (SI)));
54 +typedef unsigned int USItype __attribute__ ((mode (SI)));
55 +typedef int DItype __attribute__ ((mode (DI)));
56 +typedef int word_type __attribute__ ((mode (__word__)));
57 +
58 +struct DIstruct {SItype high, low;};
59 +
60 +typedef union
61 +{
62 + struct DIstruct s;
63 + DItype ll;
64 +} DIunion;
65 +
66 +DItype
67 +__ashldi3 (DItype u, word_type b)
68 +{
69 + DIunion w;
70 + word_type bm;
71 + DIunion uu;
72 +
73 + if (b == 0)
74 + return u;
75 +
76 + uu.ll = u;
77 +
78 + bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
79 + if (bm <= 0)
80 + {
81 + w.s.low = 0;
82 + w.s.high = (USItype)uu.s.low << -bm;
83 + }
84 + else
85 + {
86 + USItype carries = (USItype)uu.s.low >> bm;
87 + w.s.low = (USItype)uu.s.low << b;
88 + w.s.high = ((USItype)uu.s.high << b) | carries;
89 + }
90 +
91 + return w.ll;
92 +}
93 --- /dev/null
94 +++ b/arch/ubicom32/lib/ashrdi3.c
95 @@ -0,0 +1,63 @@
96 +/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
97 +/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
98 +
99 +This file is part of GNU CC.
100 +
101 +GNU CC is free software; you can redistribute it and/or modify
102 +it under the terms of the GNU General Public License as published by
103 +the Free Software Foundation; either version 2, or (at your option)
104 +any later version.
105 +
106 +GNU CC is distributed in the hope that it will be useful,
107 +but WITHOUT ANY WARRANTY; without even the implied warranty of
108 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109 +GNU General Public License for more details.
110 +
111 +You should have received a copy of the GNU General Public License
112 +along with GNU CC; see the file COPYING. If not, write to
113 +the Free Software Foundation, 59 Temple Place - Suite 330,
114 +Boston, MA 02111-1307, USA. */
115 +
116 +#define BITS_PER_UNIT 8
117 +
118 +typedef int SItype __attribute__ ((mode (SI)));
119 +typedef unsigned int USItype __attribute__ ((mode (SI)));
120 +typedef int DItype __attribute__ ((mode (DI)));
121 +typedef int word_type __attribute__ ((mode (__word__)));
122 +
123 +struct DIstruct {SItype high, low;};
124 +
125 +typedef union
126 +{
127 + struct DIstruct s;
128 + DItype ll;
129 +} DIunion;
130 +
131 +DItype
132 +__ashrdi3 (DItype u, word_type b)
133 +{
134 + DIunion w;
135 + word_type bm;
136 + DIunion uu;
137 +
138 + if (b == 0)
139 + return u;
140 +
141 + uu.ll = u;
142 +
143 + bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
144 + if (bm <= 0)
145 + {
146 + /* w.s.high = 1..1 or 0..0 */
147 + w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
148 + w.s.low = uu.s.high >> -bm;
149 + }
150 + else
151 + {
152 + USItype carries = (USItype)uu.s.high << bm;
153 + w.s.high = uu.s.high >> b;
154 + w.s.low = ((USItype)uu.s.low >> b) | carries;
155 + }
156 +
157 + return w.ll;
158 +}
159 --- /dev/null
160 +++ b/arch/ubicom32/lib/divmod.c
161 @@ -0,0 +1,85 @@
162 +unsigned long
163 +udivmodsi4(unsigned long num, unsigned long den, int modwanted)
164 +{
165 + unsigned long bit = 1;
166 + unsigned long res = 0;
167 +
168 + while (den < num && bit && !(den & (1L<<31)))
169 + {
170 + den <<=1;
171 + bit <<=1;
172 + }
173 + while (bit)
174 + {
175 + if (num >= den)
176 + {
177 + num -= den;
178 + res |= bit;
179 + }
180 + bit >>=1;
181 + den >>=1;
182 + }
183 + if (modwanted) return num;
184 + return res;
185 +}
186 +
187 +long
188 +__udivsi3 (long a, long b)
189 +{
190 + return udivmodsi4 (a, b, 0);
191 +}
192 +
193 +long
194 +__umodsi3 (long a, long b)
195 +{
196 + return udivmodsi4 (a, b, 1);
197 +}
198 +
199 +long
200 +__divsi3 (long a, long b)
201 +{
202 + int neg = 0;
203 + long res;
204 +
205 + if (a < 0)
206 + {
207 + a = -a;
208 + neg = !neg;
209 + }
210 +
211 + if (b < 0)
212 + {
213 + b = -b;
214 + neg = !neg;
215 + }
216 +
217 + res = udivmodsi4 (a, b, 0);
218 +
219 + if (neg)
220 + res = -res;
221 +
222 + return res;
223 +}
224 +
225 +long
226 +__modsi3 (long a, long b)
227 +{
228 + int neg = 0;
229 + long res;
230 +
231 + if (a < 0)
232 + {
233 + a = -a;
234 + neg = 1;
235 + }
236 +
237 + if (b < 0)
238 + b = -b;
239 +
240 + res = udivmodsi4 (a, b, 1);
241 +
242 + if (neg)
243 + res = -res;
244 +
245 + return res;
246 +}
247 --- /dev/null
248 +++ b/arch/ubicom32/lib/lshrdi3.c
249 @@ -0,0 +1,62 @@
250 +/* lshrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
251 +/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
252 +
253 +This file is part of GNU CC.
254 +
255 +GNU CC is free software; you can redistribute it and/or modify
256 +it under the terms of the GNU General Public License as published by
257 +the Free Software Foundation; either version 2, or (at your option)
258 +any later version.
259 +
260 +GNU CC is distributed in the hope that it will be useful,
261 +but WITHOUT ANY WARRANTY; without even the implied warranty of
262 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
263 +GNU General Public License for more details.
264 +
265 +You should have received a copy of the GNU General Public License
266 +along with GNU CC; see the file COPYING. If not, write to
267 +the Free Software Foundation, 59 Temple Place - Suite 330,
268 +Boston, MA 02111-1307, USA. */
269 +
270 +#define BITS_PER_UNIT 8
271 +
272 +typedef int SItype __attribute__ ((mode (SI)));
273 +typedef unsigned int USItype __attribute__ ((mode (SI)));
274 +typedef int DItype __attribute__ ((mode (DI)));
275 +typedef int word_type __attribute__ ((mode (__word__)));
276 +
277 +struct DIstruct {SItype high, low;};
278 +
279 +typedef union
280 +{
281 + struct DIstruct s;
282 + DItype ll;
283 +} DIunion;
284 +
285 +DItype
286 +__lshrdi3 (DItype u, word_type b)
287 +{
288 + DIunion w;
289 + word_type bm;
290 + DIunion uu;
291 +
292 + if (b == 0)
293 + return u;
294 +
295 + uu.ll = u;
296 +
297 + bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
298 + if (bm <= 0)
299 + {
300 + w.s.high = 0;
301 + w.s.low = (USItype)uu.s.high >> -bm;
302 + }
303 + else
304 + {
305 + USItype carries = (USItype)uu.s.high << bm;
306 + w.s.high = (USItype)uu.s.high >> b;
307 + w.s.low = ((USItype)uu.s.low >> b) | carries;
308 + }
309 +
310 + return w.ll;
311 +}
312 --- /dev/null
313 +++ b/arch/ubicom32/lib/muldi3.c
314 @@ -0,0 +1,87 @@
315 +/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and
316 + gcc-2.7.2.3/longlong.h which is: */
317 +/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
318 +
319 +This file is part of GNU CC.
320 +
321 +GNU CC is free software; you can redistribute it and/or modify
322 +it under the terms of the GNU General Public License as published by
323 +the Free Software Foundation; either version 2, or (at your option)
324 +any later version.
325 +
326 +GNU CC is distributed in the hope that it will be useful,
327 +but WITHOUT ANY WARRANTY; without even the implied warranty of
328 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
329 +GNU General Public License for more details.
330 +
331 +You should have received a copy of the GNU General Public License
332 +along with GNU CC; see the file COPYING. If not, write to
333 +the Free Software Foundation, 59 Temple Place - Suite 330,
334 +Boston, MA 02111-1307, USA. */
335 +
336 +#define UWtype USItype
337 +#define UHWtype USItype
338 +#define W_TYPE_SIZE 32
339 +#define __BITS4 (W_TYPE_SIZE / 4)
340 +#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2))
341 +#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
342 +#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
343 +
344 +#define umul_ppmm(w1, w0, u, v) \
345 + do { \
346 + UWtype __x0, __x1, __x2, __x3; \
347 + UHWtype __ul, __vl, __uh, __vh; \
348 + \
349 + __ul = __ll_lowpart (u); \
350 + __uh = __ll_highpart (u); \
351 + __vl = __ll_lowpart (v); \
352 + __vh = __ll_highpart (v); \
353 + \
354 + __x0 = (UWtype) __ul * __vl; \
355 + __x1 = (UWtype) __ul * __vh; \
356 + __x2 = (UWtype) __uh * __vl; \
357 + __x3 = (UWtype) __uh * __vh; \
358 + \
359 + __x1 += __ll_highpart (__x0);/* this can't give carry */ \
360 + __x1 += __x2; /* but this indeed can */ \
361 + if (__x1 < __x2) /* did we get it? */ \
362 + __x3 += __ll_B; /* yes, add it in the proper pos. */ \
363 + \
364 + (w1) = __x3 + __ll_highpart (__x1); \
365 + (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \
366 + } while (0)
367 +
368 +
369 +#define __umulsidi3(u, v) \
370 + ({DIunion __w; \
371 + umul_ppmm (__w.s.high, __w.s.low, u, v); \
372 + __w.ll; })
373 +
374 +typedef int SItype __attribute__ ((mode (SI)));
375 +typedef unsigned int USItype __attribute__ ((mode (SI)));
376 +typedef int DItype __attribute__ ((mode (DI)));
377 +typedef int word_type __attribute__ ((mode (__word__)));
378 +
379 +struct DIstruct {SItype high, low;};
380 +
381 +typedef union
382 +{
383 + struct DIstruct s;
384 + DItype ll;
385 +} DIunion;
386 +
387 +DItype
388 +__muldi3 (DItype u, DItype v)
389 +{
390 + DIunion w;
391 + DIunion uu, vv;
392 +
393 + uu.ll = u,
394 + vv.ll = v;
395 +
396 + w.ll = __umulsidi3 (uu.s.low, vv.s.low);
397 + w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
398 + + (USItype) uu.s.high * (USItype) vv.s.low);
399 +
400 + return w.ll;
401 +}
402 --- a/arch/ubicom32/kernel/ubicom32_ksyms.c
403 +++ b/arch/ubicom32/kernel/ubicom32_ksyms.c
404 @@ -72,7 +72,6 @@ EXPORT_SYMBOL(memmove);
405 extern void __ashldi3(void);
406 extern void __ashrdi3(void);
407 extern void __divsi3(void);
408 -extern void __divdi3(void);
409 extern void __lshrdi3(void);
410 extern void __modsi3(void);
411 extern void __muldi3(void);
412 @@ -83,7 +82,6 @@ extern void __umodsi3(void);
413 EXPORT_SYMBOL(__ashldi3);
414 EXPORT_SYMBOL(__ashrdi3);
415 EXPORT_SYMBOL(__divsi3);
416 -EXPORT_SYMBOL(__divdi3);
417 EXPORT_SYMBOL(__lshrdi3);
418 EXPORT_SYMBOL(__modsi3);
419 EXPORT_SYMBOL(__muldi3);
This page took 0.063255 seconds and 5 git commands to generate.