Merge git://git.infradead.org/battery-2.6
[pandora-kernel.git] / arch / mips / kernel / module.c
index d7bf021..e7ed0ac 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
+#include <asm/pgtable.h>       /* MODULE_START */
 
 struct mips_hi16 {
        struct mips_hi16 *next;
@@ -43,9 +44,23 @@ static DEFINE_SPINLOCK(dbe_lock);
 
 void *module_alloc(unsigned long size)
 {
+#ifdef MODULE_START
+       struct vm_struct *area;
+
+       size = PAGE_ALIGN(size);
+       if (!size)
+               return NULL;
+
+       area = __get_vm_area(size, VM_ALLOC, MODULE_START, MODULE_END);
+       if (!area)
+               return NULL;
+
+       return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
+#else
        if (size == 0)
                return NULL;
        return vmalloc(size);
+#endif
 }
 
 /* Free memory returned from module_alloc */
@@ -366,7 +381,7 @@ const struct exception_table_entry *search_module_dbetables(unsigned long addr)
        return e;
 }
 
-/* Put in dbe list if neccessary. */
+/* Put in dbe list if necessary. */
 int module_finalize(const Elf_Ehdr *hdr,
                    const Elf_Shdr *sechdrs,
                    struct module *me)