Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[pandora-kernel.git] / arch / mips / kernel / module.c
index d7bf021..1f60e27 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <linux/moduleloader.h>
 #include <linux/elf.h>
+#include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
@@ -29,6 +30,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 +45,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 +382,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)