module.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef _ASM_POWERPC_MODULE_H
  2. #define _ASM_POWERPC_MODULE_H
  3. #ifdef __KERNEL__
  4. /*
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. */
  10. #include <linux/list.h>
  11. #include <asm/bug.h>
  12. #include <asm-generic/module.h>
  13. #ifdef CC_USING_MPROFILE_KERNEL
  14. #define MODULE_ARCH_VERMAGIC "mprofile-kernel"
  15. #endif
  16. #ifndef __powerpc64__
  17. /*
  18. * Thanks to Paul M for explaining this.
  19. *
  20. * PPC can only do rel jumps += 32MB, and often the kernel and other
  21. * modules are further away than this. So, we jump to a table of
  22. * trampolines attached to the module (the Procedure Linkage Table)
  23. * whenever that happens.
  24. */
  25. struct ppc_plt_entry {
  26. /* 16 byte jump instruction sequence (4 instructions) */
  27. unsigned int jump[4];
  28. };
  29. #endif /* __powerpc64__ */
  30. struct mod_arch_specific {
  31. #ifdef __powerpc64__
  32. unsigned int stubs_section; /* Index of stubs section in module */
  33. unsigned int toc_section; /* What section is the TOC? */
  34. bool toc_fixed; /* Have we fixed up .TOC.? */
  35. #ifdef CONFIG_DYNAMIC_FTRACE
  36. unsigned long toc;
  37. unsigned long tramp;
  38. #endif
  39. /* For module function descriptor dereference */
  40. unsigned long start_opd;
  41. unsigned long end_opd;
  42. #else /* powerpc64 */
  43. /* Indices of PLT sections within module. */
  44. unsigned int core_plt_section;
  45. unsigned int init_plt_section;
  46. #ifdef CONFIG_DYNAMIC_FTRACE
  47. unsigned long tramp;
  48. #endif
  49. #endif /* powerpc64 */
  50. /* List of BUG addresses, source line numbers and filenames */
  51. struct list_head bug_list;
  52. struct bug_entry *bug_table;
  53. unsigned int num_bugs;
  54. };
  55. /*
  56. * Select ELF headers.
  57. * Make empty section for module_frob_arch_sections to expand.
  58. */
  59. #ifdef __powerpc64__
  60. # ifdef MODULE
  61. asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
  62. # endif
  63. #else
  64. # ifdef MODULE
  65. asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
  66. asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
  67. # endif /* MODULE */
  68. #endif
  69. #ifdef CONFIG_DYNAMIC_FTRACE
  70. # ifdef MODULE
  71. asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
  72. # endif /* MODULE */
  73. #endif
  74. int module_trampoline_target(struct module *mod, unsigned long trampoline,
  75. unsigned long *target);
  76. #ifdef CONFIG_DYNAMIC_FTRACE
  77. int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs);
  78. #else
  79. static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs)
  80. {
  81. return 0;
  82. }
  83. #endif
  84. #endif /* __KERNEL__ */
  85. #endif /* _ASM_POWERPC_MODULE_H */