1 #ifndef __ASM_ALPHA_ELF_H
2 #define __ASM_ALPHA_ELF_H
5 * Alpha ELF relocation types
7 #define R_ALPHA_NONE 0 /* No reloc */
8 #define R_ALPHA_REFLONG 1 /* Direct 32 bit */
9 #define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
10 #define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
11 #define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
12 #define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
13 #define R_ALPHA_GPDISP 6 /* Add displacement to GP */
14 #define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
15 #define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
16 #define R_ALPHA_SREL16 9 /* PC relative 16 bit */
17 #define R_ALPHA_SREL32 10 /* PC relative 32 bit */
18 #define R_ALPHA_SREL64 11 /* PC relative 64 bit */
19 #define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */
20 #define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */
21 #define R_ALPHA_GPREL16 19 /* GP relative 16 bit */
22 #define R_ALPHA_COPY 24 /* Copy symbol at runtime */
23 #define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
24 #define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
25 #define R_ALPHA_RELATIVE 27 /* Adjust by program base */
26 #define R_ALPHA_BRSGP 28
27 #define R_ALPHA_TLSGD 29
28 #define R_ALPHA_TLS_LDM 30
29 #define R_ALPHA_DTPMOD64 31
30 #define R_ALPHA_GOTDTPREL 32
31 #define R_ALPHA_DTPREL64 33
32 #define R_ALPHA_DTPRELHI 34
33 #define R_ALPHA_DTPRELLO 35
34 #define R_ALPHA_DTPREL16 36
35 #define R_ALPHA_GOTTPREL 37
36 #define R_ALPHA_TPREL64 38
37 #define R_ALPHA_TPRELHI 39
38 #define R_ALPHA_TPRELLO 40
39 #define R_ALPHA_TPREL16 41
41 #define SHF_ALPHA_GPREL 0x10000000
43 /* Legal values for e_flags field of Elf64_Ehdr. */
45 #define EF_ALPHA_32BIT 1 /* All addresses are below 2GB */
48 * ELF register definitions..
52 * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
53 * I have no idea why that is so. For now, we just leave it at 33
54 * (32 general regs + processor status word).
59 typedef unsigned long elf_greg_t;
60 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
62 typedef double elf_fpreg_t;
63 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
66 * This is used to ensure we don't load something for the wrong architecture.
68 #define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
71 * These are used to set parameters in the core dumps.
73 #define ELF_CLASS ELFCLASS64
74 #define ELF_DATA ELFDATA2LSB
75 #define ELF_ARCH EM_ALPHA
77 #define USE_ELF_CORE_DUMP
78 #define ELF_EXEC_PAGESIZE 8192
80 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
81 use of this is to invoke "./ld.so someprog" to test out a new version of
82 the loader. We need to make sure that it is out of the way of the program
83 that it will "exec", and that there is sufficient room for the brk. */
85 #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
87 /* $0 is set by ld.so to a pointer to a function which might be
88 registered using atexit. This provides a mean for the dynamic
89 linker to call DT_FINI functions for shared libraries that have
90 been loaded before the code runs.
92 So that we can use the same startup file with static executables,
93 we start programs with a value of 0 to indicate that there is no
96 #define ELF_PLAT_INIT(_r, load_addr) _r->r0 = 0
98 /* The registers are layed out in pt_regs for PAL and syscall
99 convenience. Re-order them for the linear elf_gregset_t. */
104 extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt,
105 struct thread_info *ti);
106 #define ELF_CORE_COPY_REGS(DEST, REGS) \
107 dump_elf_thread(DEST, REGS, current_thread_info());
109 /* Similar, but for a thread other than current. */
111 extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
112 #define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \
113 dump_elf_task(*(DEST), TASK)
115 /* Similar, but for the FP registers. */
117 extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
118 #define ELF_CORE_COPY_FPREGS(TASK, DEST) \
119 dump_elf_task_fp(*(DEST), TASK)
121 /* This yields a mask that user programs can use to figure out what
122 instruction set this CPU supports. This is trivial on Alpha,
123 but not so on other machines. */
125 #define ELF_HWCAP (~amask(-1))
127 /* This yields a string that ld.so will use to load implementation
128 specific libraries for optimization. This is more specific in
129 intent than poking at uname or /proc/cpuinfo. */
131 #define ELF_PLATFORM \
133 enum implver_enum i_ = implver(); \
134 ( i_ == IMPLVER_EV4 ? "ev4" \
135 : i_ == IMPLVER_EV5 \
136 ? (amask(AMASK_BWX) ? "ev5" : "ev56") \
137 : amask (AMASK_CIX) ? "ev6" : "ev67"); \
140 /* Reserve these numbers for any future use of a VDSO. */
142 #define AT_SYSINFO 32
143 #define AT_SYSINFO_EHDR 33
146 /* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
147 value is -1, then the cache doesn't exist. Otherwise:
149 bit 0-3: Cache set-associativity; 0 means fully associative.
150 bit 4-7: Log2 of cacheline size.
151 bit 8-31: Size of the entire cache >> 8.
155 #define AT_L1I_CACHESHAPE 34
156 #define AT_L1D_CACHESHAPE 35
157 #define AT_L2_CACHESHAPE 36
158 #define AT_L3_CACHESHAPE 37
162 #define SET_PERSONALITY(EX, IBCS2) \
163 set_personality(((EX).e_flags & EF_ALPHA_32BIT) \
164 ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX)
166 extern int alpha_l1i_cacheshape;
167 extern int alpha_l1d_cacheshape;
168 extern int alpha_l2_cacheshape;
169 extern int alpha_l3_cacheshape;
171 #define ARCH_DLINFO \
173 NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape); \
174 NEW_AUX_ENT(AT_L1D_CACHESHAPE, alpha_l1d_cacheshape); \
175 NEW_AUX_ENT(AT_L2_CACHESHAPE, alpha_l2_cacheshape); \
176 NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape); \
179 #endif /* __KERNEL__ */
180 #endif /* __ASM_ALPHA_ELF_H */