blob: eb1033957486670348f892b4d93117958af76c0a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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. */
11int module_frob_arch_sections(Elf_Ehdr *hdr,
12 Elf_Shdr *sechdrs,
13 char *secstrings,
14 struct module *mod);
15
16/* Allocator used for allocating struct module, core sections and init
17 sections. Returns NULL on failure. */
18void *module_alloc(unsigned long size);
19
20/* Free memory returned from module_alloc. */
21void module_free(struct module *mod, void *module_region);
22
23/* Apply the given relocation to the (simplified) ELF. Return -error
24 or 0. */
25int apply_relocate(Elf_Shdr *sechdrs,
26 const char *strtab,
27 unsigned int symindex,
28 unsigned int relsec,
29 struct module *mod);
30
31/* Apply the given add relocation to the (simplified) ELF. Return
32 -error or 0 */
33int apply_relocate_add(Elf_Shdr *sechdrs,
34 const char *strtab,
35 unsigned int symindex,
36 unsigned int relsec,
37 struct module *mod);
38
39/* Any final processing of module before access. Return -error or 0. */
40int module_finalize(const Elf_Ehdr *hdr,
41 const Elf_Shdr *sechdrs,
42 struct module *mod);
43
44/* Any cleanup needed when module leaves. */
45void module_arch_cleanup(struct module *mod);
46
47#endif