diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-20 20:19:15 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-20 20:19:15 -0700 |
commit | cfa76f024f7c9e65169425804e5b32e71f66d0ee (patch) | |
tree | ee64e98cbfb1b654842c9256446a9584857f6730 /arch/parisc/lib/libgcc | |
parent | 093faa1dd26fc6766f8f04c429030757a8a0def4 (diff) | |
parent | 7210c678202bb3107085bffeb63f66a9b8ba1c85 (diff) |
Merge branch 'master' of hera.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6
* 'master' of hera.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (29 commits)
[PARISC] fix uninitialized variable warning in asm/rtc.h
[PARISC] Port checkstack.pl to parisc
[PARISC] Make palo target work when $obj != $src
[PARISC] Zap unused variable warnings in pci.c
[PARISC] Fix tests in palo target
[PARISC] Fix palo target
[PARISC] Restore palo target
[PARISC] Attempt to clean up parisc/Makefile
[PARISC] Fix infinite loop in /proc/iomem
[PARISC] Quiet sysfs_create_link __must_check warnings in pdc_stable
[PARISC] Squelch pci_enable_device __must_check warning in superio
[PARISC] Kill off broken irqstack code
[PARISC] Remove hardcoded uses of PAGE_SIZE
[PARISC] Clean up pointless ASM_PAGE_SIZE_DIV use
[PARISC] Kill off the last vestiges of ASM_PAGE_SIZE
[PARISC] Kill off ASM_PAGE_SIZE use
[PARISC] Beautify parisc vmlinux.lds.S
[PARISC] Clean up a resource_size_t warning in sba_iommu
[PARISC] Kill incorrect cast warning in unwinder
[PARISC] Kill zone_to_nid printk warning
...
Fixed trivial conflict in include/asm-parisc/tlbflush.h manually
Diffstat (limited to 'arch/parisc/lib/libgcc')
-rw-r--r-- | arch/parisc/lib/libgcc/Makefile | 4 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__ashldi3.c | 19 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__ashrdi3.c | 19 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__clzsi2.c | 30 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__divdi3.c | 23 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__divsi3.c | 23 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__lshrdi3.c | 19 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__moddi3.c | 23 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__modsi3.c | 23 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__muldi3.c | 22 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__udivdi3.c | 7 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__udivmoddi4.c | 31 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__udivmodsi4.c | 31 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__udivsi3.c | 7 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__umoddi3.c | 10 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__umodsi3.c | 10 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/__umulsidi3.c | 46 | ||||
-rw-r--r-- | arch/parisc/lib/libgcc/libgcc.h | 32 |
18 files changed, 379 insertions, 0 deletions
diff --git a/arch/parisc/lib/libgcc/Makefile b/arch/parisc/lib/libgcc/Makefile new file mode 100644 index 000000000000..b67a85ad9c87 --- /dev/null +++ b/arch/parisc/lib/libgcc/Makefile @@ -0,0 +1,4 @@ +obj-y := __ashldi3.o __ashrdi3.o __clzsi2.o __divdi3.o __divsi3.o \ + __lshrdi3.o __moddi3.o __modsi3.o __udivdi3.o \ + __udivmoddi4.o __udivmodsi4.o __udivsi3.o \ + __umoddi3.o __umodsi3.o __muldi3.o __umulsidi3.o diff --git a/arch/parisc/lib/libgcc/__ashldi3.c b/arch/parisc/lib/libgcc/__ashldi3.c new file mode 100644 index 000000000000..a14a257abb2b --- /dev/null +++ b/arch/parisc/lib/libgcc/__ashldi3.c @@ -0,0 +1,19 @@ +#include "libgcc.h" + +u64 __ashldi3(u64 v, int cnt) +{ + int c = cnt & 31; + u32 vl = (u32) v; + u32 vh = (u32) (v >> 32); + + if (cnt & 32) { + vh = (vl << c); + vl = 0; + } else { + vh = (vh << c) + (vl >> (32 - c)); + vl = (vl << c); + } + + return ((u64) vh << 32) + vl; +} +EXPORT_SYMBOL(__ashldi3); diff --git a/arch/parisc/lib/libgcc/__ashrdi3.c b/arch/parisc/lib/libgcc/__ashrdi3.c new file mode 100644 index 000000000000..8636a5aa4f77 --- /dev/null +++ b/arch/parisc/lib/libgcc/__ashrdi3.c @@ -0,0 +1,19 @@ +#include "libgcc.h" + +u64 __ashrdi3(u64 v, int cnt) +{ + int c = cnt & 31; + u32 vl = (u32) v; + u32 vh = (u32) (v >> 32); + + if (cnt & 32) { + vl = ((s32) vh >> c); + vh = (s32) vh >> 31; + } else { + vl = (vl >> c) + (vh << (32 - c)); + vh = ((s32) vh >> c); + } + + return ((u64) vh << 32) + vl; +} +EXPORT_SYMBOL(__ashrdi3); diff --git a/arch/parisc/lib/libgcc/__clzsi2.c b/arch/parisc/lib/libgcc/__clzsi2.c new file mode 100644 index 000000000000..a7aa2f55a9c6 --- /dev/null +++ b/arch/parisc/lib/libgcc/__clzsi2.c @@ -0,0 +1,30 @@ +#include "libgcc.h" + +u32 __clzsi2(u32 v) +{ + int p = 31; + + if (v & 0xffff0000) { + p -= 16; + v >>= 16; + } + if (v & 0xff00) { + p -= 8; + v >>= 8; + } + if (v & 0xf0) { + p -= 4; + v >>= 4; + } + if (v & 0xc) { + p -= 2; + v >>= 2; + } + if (v & 0x2) { + p -= 1; + v >>= 1; + } + + return p; +} +EXPORT_SYMBOL(__clzsi2); diff --git a/arch/parisc/lib/libgcc/__divdi3.c b/arch/parisc/lib/libgcc/__divdi3.c new file mode 100644 index 000000000000..f23c6fe2838b --- /dev/null +++ b/arch/parisc/lib/libgcc/__divdi3.c @@ -0,0 +1,23 @@ +#include "libgcc.h" + +s64 __divdi3(s64 num, s64 den) +{ + int minus = 0; + s64 v; + + if (num < 0) { + num = -num; + minus = 1; + } + if (den < 0) { + den = -den; + minus ^= 1; + } + + v = __udivmoddi4(num, den, NULL); + if (minus) + v = -v; + + return v; +} +EXPORT_SYMBOL(__divdi3); diff --git a/arch/parisc/lib/libgcc/__divsi3.c b/arch/parisc/lib/libgcc/__divsi3.c new file mode 100644 index 000000000000..730fb530680d --- /dev/null +++ b/arch/parisc/lib/libgcc/__divsi3.c @@ -0,0 +1,23 @@ +#include "libgcc.h" + +s32 __divsi3(s32 num, s32 den) +{ + int minus = 0; + s32 v; + + if (num < 0) { + num = -num; + minus = 1; + } + if (den < 0) { + den = -den; + minus ^= 1; + } + + v = __udivmodsi4(num, den, NULL); + if (minus) + v = -v; + + return v; +} +EXPORT_SYMBOL(__divsi3); diff --git a/arch/parisc/lib/libgcc/__lshrdi3.c b/arch/parisc/lib/libgcc/__lshrdi3.c new file mode 100644 index 000000000000..4a820708ec57 --- /dev/null +++ b/arch/parisc/lib/libgcc/__lshrdi3.c @@ -0,0 +1,19 @@ +#include "libgcc.h" + +u64 __lshrdi3(u64 v, int cnt) +{ + int c = cnt & 31; + u32 vl = (u32) v; + u32 vh = (u32) (v >> 32); + + if (cnt & 32) { + vl = (vh >> c); + vh = 0; + } else { + vl = (vl >> c) + (vh << (32 - c)); + vh = (vh >> c); + } + + return ((u64) vh << 32) + vl; +} +EXPORT_SYMBOL(__lshrdi3); diff --git a/arch/parisc/lib/libgcc/__moddi3.c b/arch/parisc/lib/libgcc/__moddi3.c new file mode 100644 index 000000000000..ed64bbafc989 --- /dev/null +++ b/arch/parisc/lib/libgcc/__moddi3.c @@ -0,0 +1,23 @@ +#include "libgcc.h" + +s64 __moddi3(s64 num, s64 den) +{ + int minus = 0; + s64 v; + + if (num < 0) { + num = -num; + minus = 1; + } + if (den < 0) { + den = -den; + minus ^= 1; + } + + (void)__udivmoddi4(num, den, (u64 *) & v); + if (minus) + v = -v; + + return v; +} +EXPORT_SYMBOL(__moddi3); diff --git a/arch/parisc/lib/libgcc/__modsi3.c b/arch/parisc/lib/libgcc/__modsi3.c new file mode 100644 index 000000000000..62f773efaeea --- /dev/null +++ b/arch/parisc/lib/libgcc/__modsi3.c @@ -0,0 +1,23 @@ +#include "libgcc.h" + +s32 __modsi3(s32 num, s32 den) +{ + int minus = 0; + s32 v; + + if (num < 0) { + num = -num; + minus = 1; + } + if (den < 0) { + den = -den; + minus ^= 1; + } + + (void)__udivmodsi4(num, den, (u32 *) & v); + if (minus) + v = -v; + + return v; +} +EXPORT_SYMBOL(__modsi3); diff --git a/arch/parisc/lib/libgcc/__muldi3.c b/arch/parisc/lib/libgcc/__muldi3.c new file mode 100644 index 000000000000..3308abdd5580 --- /dev/null +++ b/arch/parisc/lib/libgcc/__muldi3.c @@ -0,0 +1,22 @@ +#include "libgcc.h" + +union DWunion { + struct { + s32 high; + s32 low; + } s; + s64 ll; +}; + +s64 __muldi3(s64 u, s64 v) +{ + const union DWunion uu = { .ll = u }; + const union DWunion vv = { .ll = v }; + union DWunion w = { .ll = __umulsidi3(uu.s.low, vv.s.low) }; + + w.s.high += ((u32)uu.s.low * (u32)vv.s.high + + (u32)uu.s.high * (u32)vv.s.low); + + return w.ll; +} +EXPORT_SYMBOL(__muldi3); diff --git a/arch/parisc/lib/libgcc/__udivdi3.c b/arch/parisc/lib/libgcc/__udivdi3.c new file mode 100644 index 000000000000..740023d690f5 --- /dev/null +++ b/arch/parisc/lib/libgcc/__udivdi3.c @@ -0,0 +1,7 @@ +#include "libgcc.h" + +u64 __udivdi3(u64 num, u64 den) +{ + return __udivmoddi4(num, den, NULL); +} +EXPORT_SYMBOL(__udivdi3); diff --git a/arch/parisc/lib/libgcc/__udivmoddi4.c b/arch/parisc/lib/libgcc/__udivmoddi4.c new file mode 100644 index 000000000000..2df0caa5a7d8 --- /dev/null +++ b/arch/parisc/lib/libgcc/__udivmoddi4.c @@ -0,0 +1,31 @@ +#include "libgcc.h" + +u64 __udivmoddi4(u64 num, u64 den, u64 * rem_p) +{ + u64 quot = 0, qbit = 1; + + if (den == 0) { + BUG(); + } + + /* Left-justify denominator and count shift */ + while ((s64) den >= 0) { + den <<= 1; + qbit <<= 1; + } + + while (qbit) { + if (den <= num) { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } + + if (rem_p) + *rem_p = num; + + return quot; +} +EXPORT_SYMBOL(__udivmoddi4); diff --git a/arch/parisc/lib/libgcc/__udivmodsi4.c b/arch/parisc/lib/libgcc/__udivmodsi4.c new file mode 100644 index 000000000000..2a2fc28b2026 --- /dev/null +++ b/arch/parisc/lib/libgcc/__udivmodsi4.c @@ -0,0 +1,31 @@ +#include "libgcc.h" + +u32 __udivmodsi4(u32 num, u32 den, u32 * rem_p) +{ + u32 quot = 0, qbit = 1; + + if (den == 0) { + BUG(); + } + + /* Left-justify denominator and count shift */ + while ((s32) den >= 0) { + den <<= 1; + qbit <<= 1; + } + + while (qbit) { + if (den <= num) { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } + + if (rem_p) + *rem_p = num; + + return quot; +} +EXPORT_SYMBOL(__udivmodsi4); diff --git a/arch/parisc/lib/libgcc/__udivsi3.c b/arch/parisc/lib/libgcc/__udivsi3.c new file mode 100644 index 000000000000..756a44164e90 --- /dev/null +++ b/arch/parisc/lib/libgcc/__udivsi3.c @@ -0,0 +1,7 @@ +#include "libgcc.h" + +u32 __udivsi3(u32 num, u32 den) +{ + return __udivmodsi4(num, den, NULL); +} +EXPORT_SYMBOL(__udivsi3); diff --git a/arch/parisc/lib/libgcc/__umoddi3.c b/arch/parisc/lib/libgcc/__umoddi3.c new file mode 100644 index 000000000000..ac744e948bc1 --- /dev/null +++ b/arch/parisc/lib/libgcc/__umoddi3.c @@ -0,0 +1,10 @@ +#include "libgcc.h" + +u64 __umoddi3(u64 num, u64 den) +{ + u64 v; + + (void)__udivmoddi4(num, den, &v); + return v; +} +EXPORT_SYMBOL(__umoddi3); diff --git a/arch/parisc/lib/libgcc/__umodsi3.c b/arch/parisc/lib/libgcc/__umodsi3.c new file mode 100644 index 000000000000..51f55aa89f9a --- /dev/null +++ b/arch/parisc/lib/libgcc/__umodsi3.c @@ -0,0 +1,10 @@ +#include "libgcc.h" + +u32 __umodsi3(u32 num, u32 den) +{ + u32 v; + + (void)__udivmodsi4(num, den, &v); + return v; +} +EXPORT_SYMBOL(__umodsi3); diff --git a/arch/parisc/lib/libgcc/__umulsidi3.c b/arch/parisc/lib/libgcc/__umulsidi3.c new file mode 100644 index 000000000000..396f669164d4 --- /dev/null +++ b/arch/parisc/lib/libgcc/__umulsidi3.c @@ -0,0 +1,46 @@ +#include "libgcc.h" + +#define __ll_B ((u32) 1 << (32 / 2)) +#define __ll_lowpart(t) ((u32) (t) & (__ll_B - 1)) +#define __ll_highpart(t) ((u32) (t) >> 16) + +#define umul_ppmm(w1, w0, u, v) \ + do { \ + u32 __x0, __x1, __x2, __x3; \ + u16 __ul, __vl, __uh, __vh; \ + \ + __ul = __ll_lowpart (u); \ + __uh = __ll_highpart (u); \ + __vl = __ll_lowpart (v); \ + __vh = __ll_highpart (v); \ + \ + __x0 = (u32) __ul * __vl; \ + __x1 = (u32) __ul * __vh; \ + __x2 = (u32) __uh * __vl; \ + __x3 = (u32) __uh * __vh; \ + \ + __x1 += __ll_highpart (__x0);/* this can't give carry */ \ + __x1 += __x2; /* but this indeed can */ \ + if (__x1 < __x2) /* did we get it? */ \ + __x3 += __ll_B; /* yes, add it in the proper pos. */ \ + \ + (w1) = __x3 + __ll_highpart (__x1); \ + (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ + } while (0) + +union DWunion { + struct { + s32 high; + s32 low; + } s; + s64 ll; +}; + +u64 __umulsidi3(u32 u, u32 v) +{ + union DWunion __w; + + umul_ppmm(__w.s.high, __w.s.low, u, v); + + return __w.ll; +} diff --git a/arch/parisc/lib/libgcc/libgcc.h b/arch/parisc/lib/libgcc/libgcc.h new file mode 100644 index 000000000000..5a6f7a510fbd --- /dev/null +++ b/arch/parisc/lib/libgcc/libgcc.h @@ -0,0 +1,32 @@ +#ifndef _PA_LIBGCC_H_ +#define _PA_LIBGCC_H_ + +#include <linux/types.h> +#include <linux/module.h> + +/* Cribbed from klibc/libgcc/ */ +u64 __ashldi3(u64 v, int cnt); +u64 __ashrdi3(u64 v, int cnt); + +u32 __clzsi2(u32 v); + +s64 __divdi3(s64 num, s64 den); +s32 __divsi3(s32 num, s32 den); + +u64 __lshrdi3(u64 v, int cnt); + +s64 __moddi3(s64 num, s64 den); +s32 __modsi3(s32 num, s32 den); + +u64 __udivdi3(u64 num, u64 den); +u32 __udivsi3(u32 num, u32 den); + +u64 __udivmoddi4(u64 num, u64 den, u64 * rem_p); +u32 __udivmodsi4(u32 num, u32 den, u32 * rem_p); + +u64 __umulsidi3(u32 u, u32 v); + +u64 __umoddi3(u64 num, u64 den); +u32 __umodsi3(u32 num, u32 den); + +#endif /*_PA_LIBGCC_H_*/ |