moduleloader.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /* Additional bytes needed by arch in front of individual sections */
  13. unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
  14. /* Allocator used for allocating struct module, core sections and init
  15. sections. Returns NULL on failure. */
  16. void *module_alloc(unsigned long size);
  17. /* Free memory returned from module_alloc. */
  18. void module_free(struct module *mod, void *module_region);
  19. /* Apply the given relocation to the (simplified) ELF. Return -error
  20. or 0. */
  21. int apply_relocate(Elf_Shdr *sechdrs,
  22. const char *strtab,
  23. unsigned int symindex,
  24. unsigned int relsec,
  25. struct module *mod);
  26. /* Apply the given add relocation to the (simplified) ELF. Return
  27. -error or 0 */
  28. int apply_relocate_add(Elf_Shdr *sechdrs,
  29. const char *strtab,
  30. unsigned int symindex,
  31. unsigned int relsec,
  32. struct module *mod);
  33. /* Any final processing of module before access. Return -error or 0. */
  34. int module_finalize(const Elf_Ehdr *hdr,
  35. const Elf_Shdr *sechdrs,
  36. struct module *mod);
  37. /* Any cleanup needed when module leaves. */
  38. void module_arch_cleanup(struct module *mod);
  39. #endif