Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 must be implemented by the specific architecture */ |
| 9 | |
| 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); |
| 15 | |
Helge Deller | 088af9a | 2008-12-31 12:31:18 +0100 | [diff] [blame] | 16 | /* Additional bytes needed by arch in front of individual sections */ |
| 17 | unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section); |
| 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | /* Allocator used for allocating struct module, core sections and init |
| 20 | sections. Returns NULL on failure. */ |
| 21 | void *module_alloc(unsigned long size); |
| 22 | |
| 23 | /* Free memory returned from module_alloc. */ |
| 24 | void module_free(struct module *mod, void *module_region); |
| 25 | |
| 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); |
| 33 | |
| 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); |
| 41 | |
| 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); |
| 46 | |
| 47 | /* Any cleanup needed when module leaves. */ |
| 48 | void module_arch_cleanup(struct module *mod); |
| 49 | |
| 50 | #endif |