Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney...
[pandora-kernel.git] / arch / arm / kernel / module.c
index 298363d..a68259a 100644 (file)
@@ -2,6 +2,7 @@
  *  linux/arch/arm/kernel/module.c
  *
  *  Copyright (C) 2002 Russell King.
+ *  Modified for nommu by Hyok S. Choi
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -12,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/moduleloader.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 #include <linux/elf.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
@@ -32,6 +34,7 @@ extern void _etext;
 #define MODULE_START   (((unsigned long)&_etext + ~PGDIR_MASK) & PGDIR_MASK)
 #endif
 
+#ifdef CONFIG_MMU
 void *module_alloc(unsigned long size)
 {
        struct vm_struct *area;
@@ -46,6 +49,12 @@ void *module_alloc(unsigned long size)
 
        return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
 }
+#else /* CONFIG_MMU */
+void *module_alloc(unsigned long size)
+{
+       return size == 0 ? NULL : vmalloc(size);
+}
+#endif /* !CONFIG_MMU */
 
 void module_free(struct module *module, void *region)
 {
@@ -108,8 +117,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
 
                        offset += sym->st_value - loc;
                        if (offset & 3 ||
-                           offset <= (s32)0xfc000000 ||
-                           offset >= (s32)0x04000000) {
+                           offset <= (s32)0xfe000000 ||
+                           offset >= (s32)0x02000000) {
                                printk(KERN_ERR
                                       "%s: relocation out of range, section "
                                       "%d reloc %d sym '%s'\n", module->name,