module.h 2.1 KB

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