]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/parisc/kernel/module.c
lib: Correct printk %pF to work on all architectures
[linux-2.6-omap-h63xx.git] / arch / parisc / kernel / module.c
index 1808f857a73a184cbeeb611cead126f899bc9ee1..44138c3e6ea74e3042b2ddb66058714eb74bc27f 100644 (file)
@@ -47,7 +47,9 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/bug.h>
+#include <linux/uaccess.h>
 
+#include <asm/sections.h>
 #include <asm/unwind.h>
 
 #if 0
@@ -97,7 +99,7 @@ static inline int in_local_section(struct module *me, void *loc, void *dot)
 }
 
 
-#ifndef __LP64__
+#ifndef CONFIG_64BIT
 struct got_entry {
        Elf32_Addr addr;
 };
@@ -177,7 +179,7 @@ void *module_alloc(unsigned long size)
        return vmalloc(size);
 }
 
-#ifndef __LP64__
+#ifndef CONFIG_64BIT
 static inline unsigned long count_gots(const Elf_Rela *rela, unsigned long n)
 {
        return 0;
@@ -320,7 +322,7 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
        return 0;
 }
 
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
 static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
 {
        unsigned int i;
@@ -343,9 +345,9 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
               value);
        return i * sizeof(struct got_entry);
 }
-#endif /* __LP64__ */
+#endif /* CONFIG_64BIT */
 
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
 static Elf_Addr get_fdesc(struct module *me, unsigned long value)
 {
        Elf_Fdesc *fdesc = me->module_core + me->arch.fdesc_offset;
@@ -369,7 +371,7 @@ static Elf_Addr get_fdesc(struct module *me, unsigned long value)
        fdesc->gp = (Elf_Addr)me->module_core + me->arch.got_offset;
        return (Elf_Addr)fdesc;
 }
-#endif /* __LP64__ */
+#endif /* CONFIG_64BIT */
 
 enum elf_stub_type {
        ELF_STUB_GOT,
@@ -395,7 +397,7 @@ static Elf_Addr get_stub(struct module *me, unsigned long value, long addend,
                        i * sizeof(struct stub_entry);
        }
 
-#ifndef __LP64__
+#ifndef CONFIG_64BIT
 /* for 32-bit the stub looks like this:
  *     ldil L'XXX,%r1
  *     be,n R'XXX(%sr4,%r1)
@@ -473,7 +475,7 @@ int apply_relocate(Elf_Shdr *sechdrs,
        return -ENOEXEC;
 }
 
-#ifndef __LP64__
+#ifndef CONFIG_64BIT
 int apply_relocate_add(Elf_Shdr *sechdrs,
                       const char *strtab,
                       unsigned int symindex,
@@ -860,3 +862,15 @@ void module_arch_cleanup(struct module *mod)
        deregister_unwind_table(mod);
        module_bug_cleanup(mod);
 }
+
+#ifdef CONFIG_64BIT
+void *dereference_function_descriptor(void *ptr)
+{
+       Elf64_Fdesc *desc = ptr;
+       void *p;
+
+       if (!probe_kernel_address(&desc->addr, p))
+               ptr = p;
+       return ptr;
+}
+#endif