mm: Export migrate_page_move_mapping and migrate_page_copy
[pandora-kernel.git] / include / linux / moduleloader.h
1 #ifndef _LINUX_MODULELOADER_H
2 #define _LINUX_MODULELOADER_H
3 /* The stuff needed for archs to support modules. */
4
5 #include <linux/module.h>
6 #include <linux/elf.h>
7
8 /* These may be implemented by architectures that need to hook into the
9  * module loader code.  Architectures that don't need to do anything special
10  * can just rely on the 'weak' default hooks defined in kernel/module.c.
11  * Note, however, that at least one of apply_relocate or apply_relocate_add
12  * must be implemented by each architecture.
13  */
14
15 /* Adjust arch-specific sections.  Return 0 on success.  */
16 int module_frob_arch_sections(Elf_Ehdr *hdr,
17                               Elf_Shdr *sechdrs,
18                               char *secstrings,
19                               struct module *mod);
20
21 /* Additional bytes needed by arch in front of individual sections */
22 unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
23
24 /* Allocator used for allocating struct module, core sections and init
25    sections.  Returns NULL on failure. */
26 void *module_alloc(unsigned long size);
27
28 /* Free memory returned from module_alloc. */
29 void module_free(struct module *mod, void *module_region);
30
31 /* Apply the given relocation to the (simplified) ELF.  Return -error
32    or 0. */
33 int apply_relocate(Elf_Shdr *sechdrs,
34                    const char *strtab,
35                    unsigned int symindex,
36                    unsigned int relsec,
37                    struct module *mod);
38
39 /* Apply the given add relocation to the (simplified) ELF.  Return
40    -error or 0 */
41 int apply_relocate_add(Elf_Shdr *sechdrs,
42                        const char *strtab,
43                        unsigned int symindex,
44                        unsigned int relsec,
45                        struct module *mod);
46
47 /* Any final processing of module before access.  Return -error or 0. */
48 int module_finalize(const Elf_Ehdr *hdr,
49                     const Elf_Shdr *sechdrs,
50                     struct module *mod);
51
52 /* Any cleanup needed when module leaves. */
53 void module_arch_cleanup(struct module *mod);
54
55 #endif