summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-09 14:41:04 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-09 14:41:04 +0000
commit6cfdc9dd640e4d52483e59b00b329e161f2af35c (patch)
tree2a33413bd52561aaf74f6120e0b34bea44234a4b
parent888fe2ff609b9bb7a8f7ad9f415f8e8419b53430 (diff)
Ok, bad idea. didn't work.
-Erik
-rw-r--r--ldso/ldso/arm/dl-sysdep.h29
-rw-r--r--ldso/ldso/arm/ld_sysdep.h29
2 files changed, 56 insertions, 2 deletions
diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h
index 74abb305e..ef994caad 100644
--- a/ldso/ldso/arm/dl-sysdep.h
+++ b/ldso/ldso/arm/dl-sysdep.h
@@ -89,7 +89,34 @@
struct elf_resolve;
unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
-#define do_rem(result, n, base) result = (n % base)
+static inline unsigned long arm_modulus(unsigned long m, unsigned long p) {
+ unsigned long i,t,inc;
+ i=p; t=0;
+ while(!(i&(1<<31))) {
+ i<<=1;
+ t++;
+ }
+ t--;
+ for(inc=t;inc>2;inc--) {
+ i=p<<inc;
+ if(i&(1<<31))
+ break;
+ while(m>=i) {
+ m-=i;
+ i<<=1;
+ if(i&(1<<31))
+ break;
+ if(i<p)
+ break;
+ }
+ }
+ while(m>=p) {
+ m-=p;
+ }
+ return m;
+}
+
+#define do_rem(result, n, base) result=arm_modulus(n,base);
/* 4096 bytes alignment */
#define PAGE_ALIGN 0xfffff000
diff --git a/ldso/ldso/arm/ld_sysdep.h b/ldso/ldso/arm/ld_sysdep.h
index 74abb305e..ef994caad 100644
--- a/ldso/ldso/arm/ld_sysdep.h
+++ b/ldso/ldso/arm/ld_sysdep.h
@@ -89,7 +89,34 @@
struct elf_resolve;
unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
-#define do_rem(result, n, base) result = (n % base)
+static inline unsigned long arm_modulus(unsigned long m, unsigned long p) {
+ unsigned long i,t,inc;
+ i=p; t=0;
+ while(!(i&(1<<31))) {
+ i<<=1;
+ t++;
+ }
+ t--;
+ for(inc=t;inc>2;inc--) {
+ i=p<<inc;
+ if(i&(1<<31))
+ break;
+ while(m>=i) {
+ m-=i;
+ i<<=1;
+ if(i&(1<<31))
+ break;
+ if(i<p)
+ break;
+ }
+ }
+ while(m>=p) {
+ m-=p;
+ }
+ return m;
+}
+
+#define do_rem(result, n, base) result=arm_modulus(n,base);
/* 4096 bytes alignment */
#define PAGE_ALIGN 0xfffff000