Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #ifndef __ASM_CSKY_ELF_H
0004 #define __ASM_CSKY_ELF_H
0005 
0006 #include <asm/ptrace.h>
0007 #include <abi/regdef.h>
0008 
0009 #define ELF_ARCH EM_CSKY
0010 #define EM_CSKY_OLD 39
0011 
0012 /* CSKY Relocations */
0013 #define R_CSKY_NONE               0
0014 #define R_CSKY_32                 1
0015 #define R_CSKY_PCIMM8BY4          2
0016 #define R_CSKY_PCIMM11BY2         3
0017 #define R_CSKY_PCIMM4BY2          4
0018 #define R_CSKY_PC32               5
0019 #define R_CSKY_PCRELJSR_IMM11BY2  6
0020 #define R_CSKY_GNU_VTINHERIT      7
0021 #define R_CSKY_GNU_VTENTRY        8
0022 #define R_CSKY_RELATIVE           9
0023 #define R_CSKY_COPY               10
0024 #define R_CSKY_GLOB_DAT           11
0025 #define R_CSKY_JUMP_SLOT          12
0026 #define R_CSKY_ADDR_HI16          24
0027 #define R_CSKY_ADDR_LO16          25
0028 #define R_CSKY_PCRELJSR_IMM26BY2  40
0029 
0030 typedef unsigned long elf_greg_t;
0031 
0032 typedef struct user_fp elf_fpregset_t;
0033 
0034 /*
0035  * In gdb/bfd elf32-csky.c, csky_elf_grok_prstatus() use fixed size of
0036  * elf_prstatus. It's 148 for abiv1 and 220 for abiv2, the size is enough
0037  * for coredump and no need full sizeof(struct pt_regs).
0038  */
0039 #define ELF_NGREG ((sizeof(struct pt_regs) / sizeof(elf_greg_t)) - 2)
0040 
0041 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
0042 
0043 /*
0044  * This is used to ensure we don't load something for the wrong architecture.
0045  */
0046 #define elf_check_arch(x) (((x)->e_machine == ELF_ARCH) || \
0047                ((x)->e_machine == EM_CSKY_OLD))
0048 
0049 /*
0050  * These are used to set parameters in the core dumps.
0051  */
0052 #define ELF_EXEC_PAGESIZE       4096
0053 #define ELF_CLASS           ELFCLASS32
0054 #define ELF_PLAT_INIT(_r, load_addr)    { _r->a0 = 0; }
0055 
0056 #ifdef __cskyBE__
0057 #define ELF_DATA    ELFDATA2MSB
0058 #else
0059 #define ELF_DATA    ELFDATA2LSB
0060 #endif
0061 
0062 /*
0063  * This is the location that an ET_DYN program is loaded if exec'ed. Typical
0064  * use of this is to invoke "./ld.so someprog" to test out a new version of
0065  * the loader.  We need to make sure that it is out of the way of the program
0066  * that it will "exec", and that there is sufficient room for the brk.
0067  */
0068 #define ELF_ET_DYN_BASE 0x0UL
0069 #include <abi/elf.h>
0070 
0071 /* Similar, but for a thread other than current. */
0072 struct task_struct;
0073 extern int dump_task_regs(struct task_struct *tsk, elf_gregset_t *elf_regs);
0074 #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
0075 
0076 #define ELF_HWCAP   (0)
0077 
0078 /*
0079  * This yields a string that ld.so will use to load implementation specific
0080  * libraries for optimization. This is more specific in intent than poking
0081  * at uname or /proc/cpuinfo.
0082  */
0083 #define ELF_PLATFORM        (NULL)
0084 #define SET_PERSONALITY(ex) set_personality(PER_LINUX)
0085 
0086 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
0087 struct linux_binprm;
0088 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
0089                        int uses_interp);
0090 #endif /* __ASM_CSKY_ELF_H */