module.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #ifndef __powerpc64__
  14. /*
  15. * Thanks to Paul M for explaining this.
  16. *
  17. * PPC can only do rel jumps += 32MB, and often the kernel and other
  18. * modules are furthur away than this. So, we jump to a table of
  19. * trampolines attached to the module (the Procedure Linkage Table)
  20. * whenever that happens.
  21. */
  22. struct ppc_plt_entry {
  23. /* 16 byte jump instruction sequence (4 instructions) */
  24. unsigned int jump[4];
  25. };
  26. #endif /* __powerpc64__ */
  27. struct mod_arch_specific {
  28. #ifdef __powerpc64__
  29. unsigned int stubs_section; /* Index of stubs section in module */
  30. unsigned int toc_section; /* What section is the TOC? */
  31. bool toc_fixed; /* Have we fixed up .TOC.? */
  32. #ifdef CONFIG_DYNAMIC_FTRACE
  33. unsigned long toc;
  34. unsigned long tramp;
  35. #endif
  36. #else /* powerpc64 */
  37. /* Indices of PLT sections within module. */
  38. unsigned int core_plt_section;
  39. unsigned int init_plt_section;
  40. #ifdef CONFIG_DYNAMIC_FTRACE
  41. unsigned long tramp;
  42. #endif
  43. #endif /* powerpc64 */
  44. /* List of BUG addresses, source line numbers and filenames */
  45. struct list_head bug_list;
  46. struct bug_entry *bug_table;
  47. unsigned int num_bugs;
  48. };
  49. /*
  50. * Select ELF headers.
  51. * Make empty section for module_frob_arch_sections to expand.
  52. */
  53. #ifdef __powerpc64__
  54. # ifdef MODULE
  55. asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
  56. # endif
  57. #else
  58. # ifdef MODULE
  59. asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
  60. asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
  61. # endif /* MODULE */
  62. #endif
  63. #ifdef CONFIG_DYNAMIC_FTRACE
  64. # ifdef MODULE
  65. asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
  66. # endif /* MODULE */
  67. #endif
  68. bool is_module_trampoline(u32 *insns);
  69. int module_trampoline_target(struct module *mod, u32 *trampoline,
  70. unsigned long *target);
  71. struct exception_table_entry;
  72. void sort_ex_table(struct exception_table_entry *start,
  73. struct exception_table_entry *finish);
  74. #if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64)
  75. #define ARCH_RELOCATES_KCRCTAB
  76. #define reloc_start PHYSICAL_START
  77. #endif
  78. #endif /* __KERNEL__ */
  79. #endif /* _ASM_POWERPC_MODULE_H */