module.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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
  35. /* Indices of PLT sections within module. */
  36. unsigned int core_plt_section;
  37. unsigned int init_plt_section;
  38. #endif
  39. /* List of BUG addresses, source line numbers and filenames */
  40. struct list_head bug_list;
  41. struct bug_entry *bug_table;
  42. unsigned int num_bugs;
  43. };
  44. /*
  45. * Select ELF headers.
  46. * Make empty section for module_frob_arch_sections to expand.
  47. */
  48. #ifdef __powerpc64__
  49. # define Elf_Shdr Elf64_Shdr
  50. # define Elf_Sym Elf64_Sym
  51. # define Elf_Ehdr Elf64_Ehdr
  52. # ifdef MODULE
  53. asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
  54. # endif
  55. #else
  56. # define Elf_Shdr Elf32_Shdr
  57. # define Elf_Sym Elf32_Sym
  58. # define Elf_Ehdr Elf32_Ehdr
  59. # ifdef MODULE
  60. asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
  61. asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
  62. # endif /* MODULE */
  63. #endif
  64. #ifdef CONFIG_DYNAMIC_FTRACE
  65. # ifdef MODULE
  66. asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
  67. # endif /* MODULE */
  68. #endif
  69. struct exception_table_entry;
  70. void sort_ex_table(struct exception_table_entry *start,
  71. struct exception_table_entry *finish);
  72. #endif /* __KERNEL__ */
  73. #endif /* _ASM_POWERPC_MODULE_H */