Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_MODULE_H
0003 #define _ASM_MODULE_H
0004 
0005 #include <linux/list.h>
0006 #include <linux/elf.h>
0007 #include <asm/extable.h>
0008 
0009 struct mod_arch_specific {
0010     /* Data Bus Error exception tables */
0011     struct list_head dbe_list;
0012     const struct exception_table_entry *dbe_start;
0013     const struct exception_table_entry *dbe_end;
0014     struct mips_hi16 *r_mips_hi16_list;
0015 };
0016 
0017 typedef uint8_t Elf64_Byte;     /* Type for a 8-bit quantity.  */
0018 
0019 typedef struct {
0020     Elf64_Addr r_offset;            /* Address of relocation.  */
0021     Elf64_Word r_sym;           /* Symbol index.  */
0022     Elf64_Byte r_ssym;          /* Special symbol.  */
0023     Elf64_Byte r_type3;         /* Third relocation.  */
0024     Elf64_Byte r_type2;         /* Second relocation.  */
0025     Elf64_Byte r_type;          /* First relocation.  */
0026 } Elf64_Mips_Rel;
0027 
0028 typedef struct {
0029     Elf64_Addr r_offset;            /* Address of relocation.  */
0030     Elf64_Word r_sym;           /* Symbol index.  */
0031     Elf64_Byte r_ssym;          /* Special symbol.  */
0032     Elf64_Byte r_type3;         /* Third relocation.  */
0033     Elf64_Byte r_type2;         /* Second relocation.  */
0034     Elf64_Byte r_type;          /* First relocation.  */
0035     Elf64_Sxword r_addend;          /* Addend.  */
0036 } Elf64_Mips_Rela;
0037 
0038 #ifdef CONFIG_32BIT
0039 #define Elf_Shdr    Elf32_Shdr
0040 #define Elf_Sym     Elf32_Sym
0041 #define Elf_Ehdr    Elf32_Ehdr
0042 #define Elf_Addr    Elf32_Addr
0043 #define Elf_Rel     Elf32_Rel
0044 #define Elf_Rela    Elf32_Rela
0045 #define ELF_R_TYPE(X)   ELF32_R_TYPE(X)
0046 #define ELF_R_SYM(X)    ELF32_R_SYM(X)
0047 
0048 #define Elf_Mips_Rel    Elf32_Rel
0049 #define Elf_Mips_Rela   Elf32_Rela
0050 
0051 #define ELF_MIPS_R_SYM(rel) ELF32_R_SYM((rel).r_info)
0052 #define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE((rel).r_info)
0053 
0054 #endif
0055 
0056 #ifdef CONFIG_64BIT
0057 #define Elf_Shdr    Elf64_Shdr
0058 #define Elf_Sym     Elf64_Sym
0059 #define Elf_Ehdr    Elf64_Ehdr
0060 #define Elf_Addr    Elf64_Addr
0061 #define Elf_Rel     Elf64_Rel
0062 #define Elf_Rela    Elf64_Rela
0063 #define ELF_R_TYPE(X)   ELF64_R_TYPE(X)
0064 #define ELF_R_SYM(X)    ELF64_R_SYM(X)
0065 
0066 #define Elf_Mips_Rel    Elf64_Mips_Rel
0067 #define Elf_Mips_Rela   Elf64_Mips_Rela
0068 
0069 #define ELF_MIPS_R_SYM(rel) ((rel).r_sym)
0070 #define ELF_MIPS_R_TYPE(rel) ((rel).r_type)
0071 
0072 #endif
0073 
0074 #ifdef CONFIG_MODULES
0075 /* Given an address, look for it in the exception tables. */
0076 const struct exception_table_entry*search_module_dbetables(unsigned long addr);
0077 #else
0078 /* Given an address, look for it in the exception tables. */
0079 static inline const struct exception_table_entry *
0080 search_module_dbetables(unsigned long addr)
0081 {
0082     return NULL;
0083 }
0084 #endif
0085 
0086 #endif /* _ASM_MODULE_H */