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