moduleloader.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _LINUX_MODULELOADER_H
  2. #define _LINUX_MODULELOADER_H
  3. /* The stuff needed for archs to support modules. */
  4. #include <linux/module.h>
  5. #include <linux/elf.h>
  6. /* These must be implemented by the specific architecture */
  7. /* Adjust arch-specific sections. Return 0 on success. */
  8. int module_frob_arch_sections(Elf_Ehdr *hdr,
  9. Elf_Shdr *sechdrs,
  10. char *secstrings,
  11. struct module *mod);
  12. /* Allocator used for allocating struct module, core sections and init
  13. sections. Returns NULL on failure. */
  14. void *module_alloc(unsigned long size);
  15. /* Free memory returned from module_alloc. */
  16. void module_free(struct module *mod, void *module_region);
  17. /* Apply the given relocation to the (simplified) ELF. Return -error
  18. or 0. */
  19. int apply_relocate(Elf_Shdr *sechdrs,
  20. const char *strtab,
  21. unsigned int symindex,
  22. unsigned int relsec,
  23. struct module *mod);
  24. /* Apply the given add relocation to the (simplified) ELF. Return
  25. -error or 0 */
  26. int apply_relocate_add(Elf_Shdr *sechdrs,
  27. const char *strtab,
  28. unsigned int symindex,
  29. unsigned int relsec,
  30. struct module *mod);
  31. /* Any final processing of module before access. Return -error or 0. */
  32. int module_finalize(const Elf_Ehdr *hdr,
  33. const Elf_Shdr *sechdrs,
  34. struct module *mod);
  35. /* Any cleanup needed when module leaves. */
  36. void module_arch_cleanup(struct module *mod);
  37. #endif