module.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #ifndef _ASM_MODULE_H
  2. #define _ASM_MODULE_H
  3. #include <linux/config.h>
  4. #include <linux/list.h>
  5. #include <asm/uaccess.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. };
  12. typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
  13. typedef struct {
  14. Elf64_Addr r_offset; /* Address of relocation. */
  15. Elf64_Word r_sym; /* Symbol index. */
  16. Elf64_Byte r_ssym; /* Special symbol. */
  17. Elf64_Byte r_type3; /* Third relocation. */
  18. Elf64_Byte r_type2; /* Second relocation. */
  19. Elf64_Byte r_type; /* First relocation. */
  20. } Elf64_Mips_Rel;
  21. typedef struct {
  22. Elf64_Addr r_offset; /* Address of relocation. */
  23. Elf64_Word r_sym; /* Symbol index. */
  24. Elf64_Byte r_ssym; /* Special symbol. */
  25. Elf64_Byte r_type3; /* Third relocation. */
  26. Elf64_Byte r_type2; /* Second relocation. */
  27. Elf64_Byte r_type; /* First relocation. */
  28. Elf64_Sxword r_addend; /* Addend. */
  29. } Elf64_Mips_Rela;
  30. #ifdef CONFIG_32BIT
  31. #define Elf_Shdr Elf32_Shdr
  32. #define Elf_Sym Elf32_Sym
  33. #define Elf_Ehdr Elf32_Ehdr
  34. #define Elf_Addr Elf32_Addr
  35. #define Elf_Mips_Rel Elf32_Rel
  36. #define Elf_Mips_Rela Elf32_Rela
  37. #define ELF_MIPS_R_SYM(rel) ELF32_R_SYM(rel.r_info)
  38. #define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE(rel.r_info)
  39. #endif
  40. #ifdef CONFIG_64BIT
  41. #define Elf_Shdr Elf64_Shdr
  42. #define Elf_Sym Elf64_Sym
  43. #define Elf_Ehdr Elf64_Ehdr
  44. #define Elf_Addr Elf64_Addr
  45. #define Elf_Mips_Rel Elf64_Mips_Rel
  46. #define Elf_Mips_Rela Elf64_Mips_Rela
  47. #define ELF_MIPS_R_SYM(rel) (rel.r_sym)
  48. #define ELF_MIPS_R_TYPE(rel) (rel.r_type)
  49. #endif
  50. #ifdef CONFIG_MODULES
  51. /* Given an address, look for it in the exception tables. */
  52. const struct exception_table_entry*search_module_dbetables(unsigned long addr);
  53. #else
  54. /* Given an address, look for it in the exception tables. */
  55. static inline const struct exception_table_entry *
  56. search_module_dbetables(unsigned long addr)
  57. {
  58. return NULL;
  59. }
  60. #endif
  61. #ifdef CONFIG_CPU_MIPS32_R1
  62. #define MODULE_PROC_FAMILY "MIPS32_R1 "
  63. #elif defined CONFIG_CPU_MIPS32_R2
  64. #define MODULE_PROC_FAMILY "MIPS32_R2 "
  65. #elif defined CONFIG_CPU_MIPS64_R1
  66. #define MODULE_PROC_FAMILY "MIPS64_R1 "
  67. #elif defined CONFIG_CPU_MIPS64_R2
  68. #define MODULE_PROC_FAMILY "MIPS64_R2 "
  69. #elif defined CONFIG_CPU_R3000
  70. #define MODULE_PROC_FAMILY "R3000 "
  71. #elif defined CONFIG_CPU_TX39XX
  72. #define MODULE_PROC_FAMILY "TX39XX "
  73. #elif defined CONFIG_CPU_VR41XX
  74. #define MODULE_PROC_FAMILY "VR41XX "
  75. #elif defined CONFIG_CPU_R4300
  76. #define MODULE_PROC_FAMILY "R4300 "
  77. #elif defined CONFIG_CPU_R4X00
  78. #define MODULE_PROC_FAMILY "R4X00 "
  79. #elif defined CONFIG_CPU_TX49XX
  80. #define MODULE_PROC_FAMILY "TX49XX "
  81. #elif defined CONFIG_CPU_R5000
  82. #define MODULE_PROC_FAMILY "R5000 "
  83. #elif defined CONFIG_CPU_R5432
  84. #define MODULE_PROC_FAMILY "R5432 "
  85. #elif defined CONFIG_CPU_R6000
  86. #define MODULE_PROC_FAMILY "R6000 "
  87. #elif defined CONFIG_CPU_NEVADA
  88. #define MODULE_PROC_FAMILY "NEVADA "
  89. #elif defined CONFIG_CPU_R8000
  90. #define MODULE_PROC_FAMILY "R8000 "
  91. #elif defined CONFIG_CPU_R10000
  92. #define MODULE_PROC_FAMILY "R10000 "
  93. #elif defined CONFIG_CPU_RM7000
  94. #define MODULE_PROC_FAMILY "RM7000 "
  95. #elif defined CONFIG_CPU_RM9000
  96. #define MODULE_PROC_FAMILY "RM9000 "
  97. #elif defined CONFIG_CPU_SB1
  98. #define MODULE_PROC_FAMILY "SB1 "
  99. #else
  100. #error MODULE_PROC_FAMILY undefined for your processor configuration
  101. #endif
  102. #ifdef CONFIG_32BIT
  103. #define MODULE_KERNEL_TYPE "32BIT "
  104. #elif defined CONFIG_64BIT
  105. #define MODULE_KERNEL_TYPE "64BIT "
  106. #endif
  107. #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_KERNEL_TYPE
  108. #endif /* _ASM_MODULE_H */