Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_ALPHA_ELF_H
0003 #define __ASM_ALPHA_ELF_H
0004 
0005 #include <asm/auxvec.h>
0006 #include <asm/special_insns.h>
0007 
0008 /* Special values for the st_other field in the symbol table.  */
0009 
0010 #define STO_ALPHA_NOPV      0x80
0011 #define STO_ALPHA_STD_GPLOAD    0x88
0012 
0013 /*
0014  * Alpha ELF relocation types
0015  */
0016 #define R_ALPHA_NONE            0       /* No reloc */
0017 #define R_ALPHA_REFLONG         1       /* Direct 32 bit */
0018 #define R_ALPHA_REFQUAD         2       /* Direct 64 bit */
0019 #define R_ALPHA_GPREL32         3       /* GP relative 32 bit */
0020 #define R_ALPHA_LITERAL         4       /* GP relative 16 bit w/optimization */
0021 #define R_ALPHA_LITUSE          5       /* Optimization hint for LITERAL */
0022 #define R_ALPHA_GPDISP          6       /* Add displacement to GP */
0023 #define R_ALPHA_BRADDR          7       /* PC+4 relative 23 bit shifted */
0024 #define R_ALPHA_HINT            8       /* PC+4 relative 16 bit shifted */
0025 #define R_ALPHA_SREL16          9       /* PC relative 16 bit */
0026 #define R_ALPHA_SREL32          10      /* PC relative 32 bit */
0027 #define R_ALPHA_SREL64          11      /* PC relative 64 bit */
0028 #define R_ALPHA_GPRELHIGH       17      /* GP relative 32 bit, high 16 bits */
0029 #define R_ALPHA_GPRELLOW        18      /* GP relative 32 bit, low 16 bits */
0030 #define R_ALPHA_GPREL16         19      /* GP relative 16 bit */
0031 #define R_ALPHA_COPY            24      /* Copy symbol at runtime */
0032 #define R_ALPHA_GLOB_DAT        25      /* Create GOT entry */
0033 #define R_ALPHA_JMP_SLOT        26      /* Create PLT entry */
0034 #define R_ALPHA_RELATIVE        27      /* Adjust by program base */
0035 #define R_ALPHA_BRSGP       28
0036 #define R_ALPHA_TLSGD           29
0037 #define R_ALPHA_TLS_LDM         30
0038 #define R_ALPHA_DTPMOD64        31
0039 #define R_ALPHA_GOTDTPREL       32
0040 #define R_ALPHA_DTPREL64        33
0041 #define R_ALPHA_DTPRELHI        34
0042 #define R_ALPHA_DTPRELLO        35
0043 #define R_ALPHA_DTPREL16        36
0044 #define R_ALPHA_GOTTPREL        37
0045 #define R_ALPHA_TPREL64         38
0046 #define R_ALPHA_TPRELHI         39
0047 #define R_ALPHA_TPRELLO         40
0048 #define R_ALPHA_TPREL16         41
0049 
0050 #define SHF_ALPHA_GPREL     0x10000000
0051 
0052 /* Legal values for e_flags field of Elf64_Ehdr.  */
0053 
0054 #define EF_ALPHA_32BIT      1   /* All addresses are below 2GB */
0055 
0056 /*
0057  * ELF register definitions..
0058  */
0059 
0060 /*
0061  * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
0062  * I have no idea why that is so.  For now, we just leave it at 33
0063  * (32 general regs + processor status word). 
0064  */
0065 #define ELF_NGREG   33
0066 #define ELF_NFPREG  32
0067 
0068 typedef unsigned long elf_greg_t;
0069 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
0070 
0071 typedef double elf_fpreg_t;
0072 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
0073 
0074 /*
0075  * This is used to ensure we don't load something for the wrong architecture.
0076  */
0077 #define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
0078 
0079 /*
0080  * These are used to set parameters in the core dumps.
0081  */
0082 #define ELF_CLASS   ELFCLASS64
0083 #define ELF_DATA    ELFDATA2LSB
0084 #define ELF_ARCH    EM_ALPHA
0085 
0086 #define ELF_EXEC_PAGESIZE   8192
0087 
0088 /* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
0089    use of this is to invoke "./ld.so someprog" to test out a new version of
0090    the loader.  We need to make sure that it is out of the way of the program
0091    that it will "exec", and that there is sufficient room for the brk.  */
0092 
0093 #define ELF_ET_DYN_BASE     (TASK_UNMAPPED_BASE + 0x1000000)
0094 
0095 /* $0 is set by ld.so to a pointer to a function which might be 
0096    registered using atexit.  This provides a mean for the dynamic
0097    linker to call DT_FINI functions for shared libraries that have
0098    been loaded before the code runs.
0099 
0100    So that we can use the same startup file with static executables,
0101    we start programs with a value of 0 to indicate that there is no
0102    such function.  */
0103 
0104 #define ELF_PLAT_INIT(_r, load_addr)    _r->r0 = 0
0105 
0106 /* The registers are laid out in pt_regs for PAL and syscall
0107    convenience.  Re-order them for the linear elf_gregset_t.  */
0108 
0109 struct pt_regs;
0110 struct thread_info;
0111 struct task_struct;
0112 extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt,
0113                 struct thread_info *ti);
0114 #define ELF_CORE_COPY_REGS(DEST, REGS) \
0115     dump_elf_thread(DEST, REGS, current_thread_info());
0116 
0117 /* Similar, but for a thread other than current.  */
0118 
0119 extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
0120 #define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \
0121     dump_elf_task(*(DEST), TASK)
0122 
0123 /* Similar, but for the FP registers.  */
0124 
0125 extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
0126 #define ELF_CORE_COPY_FPREGS(TASK, DEST) \
0127     dump_elf_task_fp(*(DEST), TASK)
0128 
0129 /* This yields a mask that user programs can use to figure out what
0130    instruction set this CPU supports.  This is trivial on Alpha, 
0131    but not so on other machines. */
0132 
0133 #define ELF_HWCAP  (~amask(-1))
0134 
0135 /* This yields a string that ld.so will use to load implementation
0136    specific libraries for optimization.  This is more specific in
0137    intent than poking at uname or /proc/cpuinfo.  */
0138 
0139 #define ELF_PLATFORM                \
0140 ({                      \
0141     enum implver_enum i_ = implver();   \
0142     ( i_ == IMPLVER_EV4 ? "ev4"     \
0143     : i_ == IMPLVER_EV5         \
0144       ? (amask(AMASK_BWX) ? "ev5" : "ev56") \
0145     : amask (AMASK_CIX) ? "ev6" : "ev67");  \
0146 })
0147 
0148 #define SET_PERSONALITY(EX)                 \
0149     set_personality(((EX).e_flags & EF_ALPHA_32BIT)     \
0150        ? PER_LINUX_32BIT : PER_LINUX)
0151 
0152 extern int alpha_l1i_cacheshape;
0153 extern int alpha_l1d_cacheshape;
0154 extern int alpha_l2_cacheshape;
0155 extern int alpha_l3_cacheshape;
0156 
0157 /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
0158 #define ARCH_DLINFO                     \
0159   do {                              \
0160     NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape);   \
0161     NEW_AUX_ENT(AT_L1D_CACHESHAPE, alpha_l1d_cacheshape);   \
0162     NEW_AUX_ENT(AT_L2_CACHESHAPE, alpha_l2_cacheshape);     \
0163     NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape);     \
0164   } while (0)
0165 
0166 #endif /* __ASM_ALPHA_ELF_H */