module.h 2.3 KB

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