Linux 2.6.33-rc2
[pohmelfs.git] / include / linux / moduleloader.h
blobc1f40c2f7ffbdffae2ff037d17df5a8a6b857957
1 #ifndef _LINUX_MODULELOADER_H
2 #define _LINUX_MODULELOADER_H
3 /* The stuff needed for archs to support modules. */
5 #include <linux/module.h>
6 #include <linux/elf.h>
8 /* These must be implemented by the specific architecture */
10 /* Adjust arch-specific sections. Return 0 on success. */
11 int module_frob_arch_sections(Elf_Ehdr *hdr,
12 Elf_Shdr *sechdrs,
13 char *secstrings,
14 struct module *mod);
16 /* Additional bytes needed by arch in front of individual sections */
17 unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
19 /* Allocator used for allocating struct module, core sections and init
20 sections. Returns NULL on failure. */
21 void *module_alloc(unsigned long size);
23 /* Free memory returned from module_alloc. */
24 void module_free(struct module *mod, void *module_region);
26 /* Apply the given relocation to the (simplified) ELF. Return -error
27 or 0. */
28 int apply_relocate(Elf_Shdr *sechdrs,
29 const char *strtab,
30 unsigned int symindex,
31 unsigned int relsec,
32 struct module *mod);
34 /* Apply the given add relocation to the (simplified) ELF. Return
35 -error or 0 */
36 int apply_relocate_add(Elf_Shdr *sechdrs,
37 const char *strtab,
38 unsigned int symindex,
39 unsigned int relsec,
40 struct module *mod);
42 /* Any final processing of module before access. Return -error or 0. */
43 int module_finalize(const Elf_Ehdr *hdr,
44 const Elf_Shdr *sechdrs,
45 struct module *mod);
47 /* Any cleanup needed when module leaves. */
48 void module_arch_cleanup(struct module *mod);
50 #endif