Initial revision
authorMark Huang <mlhuang@cs.princeton.edu>
Fri, 17 Sep 2004 15:28:58 +0000 (15:28 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Fri, 17 Sep 2004 15:28:58 +0000 (15:28 +0000)
arch/um/sys-i386/bitops.c [new file with mode: 0644]
scripts/elfconfig.h [new file with mode: 0644]
scripts/mk_elfconfig [new file with mode: 0644]
scripts/modpost [new file with mode: 0644]

diff --git a/arch/um/sys-i386/bitops.c b/arch/um/sys-i386/bitops.c
new file mode 100644 (file)
index 0000000..97db385
--- /dev/null
@@ -0,0 +1,70 @@
+#include <linux/bitops.h>
+#include <linux/module.h>
+
+/**
+ * find_next_bit - find the first set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+int find_next_bit(const unsigned long *addr, int size, int offset)
+{
+       const unsigned long *p = addr + (offset >> 5);
+       int set = 0, bit = offset & 31, res;
+
+       if (bit) {
+               /*
+                * Look for nonzero in the first 32 bits:
+                */
+               __asm__("bsfl %1,%0\n\t"
+                       "jne 1f\n\t"
+                       "movl $32, %0\n"
+                       "1:"
+                       : "=r" (set)
+                       : "r" (*p >> bit));
+               if (set < (32 - bit))
+                       return set + offset;
+               set = 32 - bit;
+               p++;
+       }
+       /*
+        * No set bit yet, search remaining full words for a bit
+        */
+       res = find_first_bit (p, size - 32 * (p - addr));
+       return (offset + set + res);
+}
+EXPORT_SYMBOL(find_next_bit);
+
+/**
+ * find_next_zero_bit - find the first zero bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+int find_next_zero_bit(const unsigned long *addr, int size, int offset)
+{
+       unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
+       int set = 0, bit = offset & 31, res;
+
+       if (bit) {
+               /*
+                * Look for zero in the first 32 bits.
+                */
+               __asm__("bsfl %1,%0\n\t"
+                       "jne 1f\n\t"
+                       "movl $32, %0\n"
+                       "1:"
+                       : "=r" (set)
+                       : "r" (~(*p >> bit)));
+               if (set < (32 - bit))
+                       return set + offset;
+               set = 32 - bit;
+               p++;
+       }
+       /*
+        * No zero yet, search remaining full bytes for a zero
+        */
+       res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr));
+       return (offset + set + res);
+}
+EXPORT_SYMBOL(find_next_zero_bit);
diff --git a/scripts/elfconfig.h b/scripts/elfconfig.h
new file mode 100644 (file)
index 0000000..1b2f317
--- /dev/null
@@ -0,0 +1,5 @@
+#define KERNEL_ELFCLASS ELFCLASS32
+#define KERNEL_ELFDATA ELFDATA2LSB
+#define HOST_ELFCLASS ELFCLASS32
+#define HOST_ELFDATA ELFDATA2LSB
+#define MODULE_SYMBOL_PREFIX ""
diff --git a/scripts/mk_elfconfig b/scripts/mk_elfconfig
new file mode 100644 (file)
index 0000000..cff1abc
Binary files /dev/null and b/scripts/mk_elfconfig differ
diff --git a/scripts/modpost b/scripts/modpost
new file mode 100644 (file)
index 0000000..9bbb6fc
Binary files /dev/null and b/scripts/modpost differ