module.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #else /* powerpc64 */
  40. /* Indices of PLT sections within module. */
  41. unsigned int core_plt_section;
  42. unsigned int init_plt_section;
  43. #ifdef CONFIG_DYNAMIC_FTRACE
  44. unsigned long tramp;
  45. #endif
  46. #endif /* powerpc64 */
  47. /* List of BUG addresses, source line numbers and filenames */
  48. struct list_head bug_list;
  49. struct bug_entry *bug_table;
  50. unsigned int num_bugs;
  51. };
  52. /*
  53. * Select ELF headers.
  54. * Make empty section for module_frob_arch_sections to expand.
  55. */
  56. #ifdef __powerpc64__
  57. # ifdef MODULE
  58. asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
  59. # endif
  60. #else
  61. # ifdef MODULE
  62. asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
  63. asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
  64. # endif /* MODULE */
  65. #endif
  66. #ifdef CONFIG_DYNAMIC_FTRACE
  67. # ifdef MODULE
  68. asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
  69. # endif /* MODULE */
  70. #endif
  71. int module_trampoline_target(struct module *mod, unsigned long trampoline,
  72. unsigned long *target);
  73. #ifdef CONFIG_DYNAMIC_FTRACE
  74. int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs);
  75. #else
  76. static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs)
  77. {
  78. return 0;
  79. }
  80. #endif
  81. struct exception_table_entry;
  82. void sort_ex_table(struct exception_table_entry *start,
  83. struct exception_table_entry *finish);
  84. #if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64)
  85. #define ARCH_RELOCATES_KCRCTAB
  86. #define reloc_start PHYSICAL_START
  87. #endif
  88. #endif /* __KERNEL__ */
  89. #endif /* _ASM_POWERPC_MODULE_H */