module.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #ifndef _ASM_MODULE_H
  2. #define _ASM_MODULE_H
  3. #include <linux/list.h>
  4. #include <linux/elf.h>
  5. #include <asm/extable.h>
  6. struct mod_arch_specific {
  7. /* Data Bus Error exception tables */
  8. struct list_head dbe_list;
  9. const struct exception_table_entry *dbe_start;
  10. const struct exception_table_entry *dbe_end;
  11. struct mips_hi16 *r_mips_hi16_list;
  12. };
  13. typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
  14. typedef struct {
  15. Elf64_Addr r_offset; /* Address of relocation. */
  16. Elf64_Word r_sym; /* Symbol index. */
  17. Elf64_Byte r_ssym; /* Special symbol. */
  18. Elf64_Byte r_type3; /* Third relocation. */
  19. Elf64_Byte r_type2; /* Second relocation. */
  20. Elf64_Byte r_type; /* First relocation. */
  21. } Elf64_Mips_Rel;
  22. typedef struct {
  23. Elf64_Addr r_offset; /* Address of relocation. */
  24. Elf64_Word r_sym; /* Symbol index. */
  25. Elf64_Byte r_ssym; /* Special symbol. */
  26. Elf64_Byte r_type3; /* Third relocation. */
  27. Elf64_Byte r_type2; /* Second relocation. */
  28. Elf64_Byte r_type; /* First relocation. */
  29. Elf64_Sxword r_addend; /* Addend. */
  30. } Elf64_Mips_Rela;
  31. #ifdef CONFIG_32BIT
  32. #define Elf_Shdr Elf32_Shdr
  33. #define Elf_Sym Elf32_Sym
  34. #define Elf_Ehdr Elf32_Ehdr
  35. #define Elf_Addr Elf32_Addr
  36. #define Elf_Rel Elf32_Rel
  37. #define Elf_Rela Elf32_Rela
  38. #define ELF_R_TYPE(X) ELF32_R_TYPE(X)
  39. #define ELF_R_SYM(X) ELF32_R_SYM(X)
  40. #define Elf_Mips_Rel Elf32_Rel
  41. #define Elf_Mips_Rela Elf32_Rela
  42. #define ELF_MIPS_R_SYM(rel) ELF32_R_SYM(rel.r_info)
  43. #define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE(rel.r_info)
  44. #endif
  45. #ifdef CONFIG_64BIT
  46. #define Elf_Shdr Elf64_Shdr
  47. #define Elf_Sym Elf64_Sym
  48. #define Elf_Ehdr Elf64_Ehdr
  49. #define Elf_Addr Elf64_Addr
  50. #define Elf_Rel Elf64_Rel
  51. #define Elf_Rela Elf64_Rela
  52. #define ELF_R_TYPE(X) ELF64_R_TYPE(X)
  53. #define ELF_R_SYM(X) ELF64_R_SYM(X)
  54. #define Elf_Mips_Rel Elf64_Mips_Rel
  55. #define Elf_Mips_Rela Elf64_Mips_Rela
  56. #define ELF_MIPS_R_SYM(rel) (rel.r_sym)
  57. #define ELF_MIPS_R_TYPE(rel) (rel.r_type)
  58. #endif
  59. #ifdef CONFIG_MODULES
  60. /* Given an address, look for it in the exception tables. */
  61. const struct exception_table_entry*search_module_dbetables(unsigned long addr);
  62. #else
  63. /* Given an address, look for it in the exception tables. */
  64. static inline const struct exception_table_entry *
  65. search_module_dbetables(unsigned long addr)
  66. {
  67. return NULL;
  68. }
  69. #endif
  70. #ifdef CONFIG_CPU_BMIPS
  71. #define MODULE_PROC_FAMILY "BMIPS "
  72. #elif defined CONFIG_CPU_MIPS32_R1
  73. #define MODULE_PROC_FAMILY "MIPS32_R1 "
  74. #elif defined CONFIG_CPU_MIPS32_R2
  75. #define MODULE_PROC_FAMILY "MIPS32_R2 "
  76. #elif defined CONFIG_CPU_MIPS32_R6
  77. #define MODULE_PROC_FAMILY "MIPS32_R6 "
  78. #elif defined CONFIG_CPU_MIPS64_R1
  79. #define MODULE_PROC_FAMILY "MIPS64_R1 "
  80. #elif defined CONFIG_CPU_MIPS64_R2
  81. #define MODULE_PROC_FAMILY "MIPS64_R2 "
  82. #elif defined CONFIG_CPU_MIPS64_R6
  83. #define MODULE_PROC_FAMILY "MIPS64_R6 "
  84. #elif defined CONFIG_CPU_R3000
  85. #define MODULE_PROC_FAMILY "R3000 "
  86. #elif defined CONFIG_CPU_TX39XX
  87. #define MODULE_PROC_FAMILY "TX39XX "
  88. #elif defined CONFIG_CPU_VR41XX
  89. #define MODULE_PROC_FAMILY "VR41XX "
  90. #elif defined CONFIG_CPU_R4300
  91. #define MODULE_PROC_FAMILY "R4300 "
  92. #elif defined CONFIG_CPU_R4X00
  93. #define MODULE_PROC_FAMILY "R4X00 "
  94. #elif defined CONFIG_CPU_TX49XX
  95. #define MODULE_PROC_FAMILY "TX49XX "
  96. #elif defined CONFIG_CPU_R5000
  97. #define MODULE_PROC_FAMILY "R5000 "
  98. #elif defined CONFIG_CPU_R5432
  99. #define MODULE_PROC_FAMILY "R5432 "
  100. #elif defined CONFIG_CPU_R5500
  101. #define MODULE_PROC_FAMILY "R5500 "
  102. #elif defined CONFIG_CPU_R6000
  103. #define MODULE_PROC_FAMILY "R6000 "
  104. #elif defined CONFIG_CPU_NEVADA
  105. #define MODULE_PROC_FAMILY "NEVADA "
  106. #elif defined CONFIG_CPU_R8000
  107. #define MODULE_PROC_FAMILY "R8000 "
  108. #elif defined CONFIG_CPU_R10000
  109. #define MODULE_PROC_FAMILY "R10000 "
  110. #elif defined CONFIG_CPU_RM7000
  111. #define MODULE_PROC_FAMILY "RM7000 "
  112. #elif defined CONFIG_CPU_SB1
  113. #define MODULE_PROC_FAMILY "SB1 "
  114. #elif defined CONFIG_CPU_LOONGSON1
  115. #define MODULE_PROC_FAMILY "LOONGSON1 "
  116. #elif defined CONFIG_CPU_LOONGSON2
  117. #define MODULE_PROC_FAMILY "LOONGSON2 "
  118. #elif defined CONFIG_CPU_LOONGSON3
  119. #define MODULE_PROC_FAMILY "LOONGSON3 "
  120. #elif defined CONFIG_CPU_CAVIUM_OCTEON
  121. #define MODULE_PROC_FAMILY "OCTEON "
  122. #elif defined CONFIG_CPU_XLR
  123. #define MODULE_PROC_FAMILY "XLR "
  124. #elif defined CONFIG_CPU_XLP
  125. #define MODULE_PROC_FAMILY "XLP "
  126. #else
  127. #error MODULE_PROC_FAMILY undefined for your processor configuration
  128. #endif
  129. #ifdef CONFIG_32BIT
  130. #define MODULE_KERNEL_TYPE "32BIT "
  131. #elif defined CONFIG_64BIT
  132. #define MODULE_KERNEL_TYPE "64BIT "
  133. #endif
  134. #define MODULE_ARCH_VERMAGIC \
  135. MODULE_PROC_FAMILY MODULE_KERNEL_TYPE
  136. #endif /* _ASM_MODULE_H */