module.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_MODULE_H
  3. #define _ASM_MODULE_H
  4. #include <linux/list.h>
  5. #include <linux/elf.h>
  6. #include <asm/extable.h>
  7. struct mod_arch_specific {
  8. /* Data Bus Error exception tables */
  9. struct list_head dbe_list;
  10. const struct exception_table_entry *dbe_start;
  11. const struct exception_table_entry *dbe_end;
  12. struct mips_hi16 *r_mips_hi16_list;
  13. };
  14. typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
  15. typedef struct {
  16. Elf64_Addr r_offset; /* Address of relocation. */
  17. Elf64_Word r_sym; /* Symbol index. */
  18. Elf64_Byte r_ssym; /* Special symbol. */
  19. Elf64_Byte r_type3; /* Third relocation. */
  20. Elf64_Byte r_type2; /* Second relocation. */
  21. Elf64_Byte r_type; /* First relocation. */
  22. } Elf64_Mips_Rel;
  23. typedef struct {
  24. Elf64_Addr r_offset; /* Address of relocation. */
  25. Elf64_Word r_sym; /* Symbol index. */
  26. Elf64_Byte r_ssym; /* Special symbol. */
  27. Elf64_Byte r_type3; /* Third relocation. */
  28. Elf64_Byte r_type2; /* Second relocation. */
  29. Elf64_Byte r_type; /* First relocation. */
  30. Elf64_Sxword r_addend; /* Addend. */
  31. } Elf64_Mips_Rela;
  32. #ifdef CONFIG_32BIT
  33. #define Elf_Shdr Elf32_Shdr
  34. #define Elf_Sym Elf32_Sym
  35. #define Elf_Ehdr Elf32_Ehdr
  36. #define Elf_Addr Elf32_Addr
  37. #define Elf_Rel Elf32_Rel
  38. #define Elf_Rela Elf32_Rela
  39. #define ELF_R_TYPE(X) ELF32_R_TYPE(X)
  40. #define ELF_R_SYM(X) ELF32_R_SYM(X)
  41. #define Elf_Mips_Rel Elf32_Rel
  42. #define Elf_Mips_Rela Elf32_Rela
  43. #define ELF_MIPS_R_SYM(rel) ELF32_R_SYM((rel).r_info)
  44. #define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE((rel).r_info)
  45. #endif
  46. #ifdef CONFIG_64BIT
  47. #define Elf_Shdr Elf64_Shdr
  48. #define Elf_Sym Elf64_Sym
  49. #define Elf_Ehdr Elf64_Ehdr
  50. #define Elf_Addr Elf64_Addr
  51. #define Elf_Rel Elf64_Rel
  52. #define Elf_Rela Elf64_Rela
  53. #define ELF_R_TYPE(X) ELF64_R_TYPE(X)
  54. #define ELF_R_SYM(X) ELF64_R_SYM(X)
  55. #define Elf_Mips_Rel Elf64_Mips_Rel
  56. #define Elf_Mips_Rela Elf64_Mips_Rela
  57. #define ELF_MIPS_R_SYM(rel) ((rel).r_sym)
  58. #define ELF_MIPS_R_TYPE(rel) ((rel).r_type)
  59. #endif
  60. #ifdef CONFIG_MODULES
  61. /* Given an address, look for it in the exception tables. */
  62. const struct exception_table_entry*search_module_dbetables(unsigned long addr);
  63. #else
  64. /* Given an address, look for it in the exception tables. */
  65. static inline const struct exception_table_entry *
  66. search_module_dbetables(unsigned long addr)
  67. {
  68. return NULL;
  69. }
  70. #endif
  71. #endif /* _ASM_MODULE_H */