module.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef _ASM_POWERPC_MODULE_H
  2. #define _ASM_POWERPC_MODULE_H
  3. /*
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <linux/list.h>
  10. #include <asm/bug.h>
  11. #ifndef __powerpc64__
  12. /*
  13. * Thanks to Paul M for explaining this.
  14. *
  15. * PPC can only do rel jumps += 32MB, and often the kernel and other
  16. * modules are furthur away than this. So, we jump to a table of
  17. * trampolines attached to the module (the Procedure Linkage Table)
  18. * whenever that happens.
  19. */
  20. struct ppc_plt_entry {
  21. /* 16 byte jump instruction sequence (4 instructions) */
  22. unsigned int jump[4];
  23. };
  24. #endif /* __powerpc64__ */
  25. struct mod_arch_specific {
  26. #ifdef __powerpc64__
  27. unsigned int stubs_section; /* Index of stubs section in module */
  28. unsigned int toc_section; /* What section is the TOC? */
  29. #else
  30. /* Indices of PLT sections within module. */
  31. unsigned int core_plt_section;
  32. unsigned int init_plt_section;
  33. #endif
  34. /* List of BUG addresses, source line numbers and filenames */
  35. struct list_head bug_list;
  36. struct bug_entry *bug_table;
  37. unsigned int num_bugs;
  38. };
  39. extern struct bug_entry *module_find_bug(unsigned long bugaddr);
  40. /*
  41. * Select ELF headers.
  42. * Make empty section for module_frob_arch_sections to expand.
  43. */
  44. #ifdef __powerpc64__
  45. # define Elf_Shdr Elf64_Shdr
  46. # define Elf_Sym Elf64_Sym
  47. # define Elf_Ehdr Elf64_Ehdr
  48. # ifdef MODULE
  49. asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
  50. # endif
  51. #else
  52. # define Elf_Shdr Elf32_Shdr
  53. # define Elf_Sym Elf32_Sym
  54. # define Elf_Ehdr Elf32_Ehdr
  55. # ifdef MODULE
  56. asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
  57. asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
  58. # endif /* MODULE */
  59. #endif
  60. struct exception_table_entry;
  61. void sort_ex_table(struct exception_table_entry *start,
  62. struct exception_table_entry *finish);
  63. #endif /* _ASM_POWERPC_MODULE_H */