1
2
3
4
5
6
7
8 #ifndef __ASM_ELF_H
9 #define __ASM_ELF_H
10
11 #include <asm/ptrace.h>
12 #include <asm/user.h>
13 #include <linux/elf-em.h>
14
15 struct elf32_hdr;
16
17
18
19
20
21
22
23
24
25 #define R_HEXAGON_NONE 0
26 #define R_HEXAGON_B22_PCREL 1
27 #define R_HEXAGON_B15_PCREL 2
28 #define R_HEXAGON_B7_PCREL 3
29 #define R_HEXAGON_LO16 4
30 #define R_HEXAGON_HI16 5
31 #define R_HEXAGON_32 6
32 #define R_HEXAGON_16 7
33 #define R_HEXAGON_8 8
34 #define R_HEXAGON_GPREL16_0 9
35 #define R_HEXAGON_GPREL16_1 10
36 #define R_HEXAGON_GPREL16_2 11
37 #define R_HEXAGON_GPREL16_3 12
38 #define R_HEXAGON_HL16 13
39
40 #define R_HEXAGON_B13_PCREL 14
41
42 #define R_HEXAGON_B9_PCREL 15
43
44 #define R_HEXAGON_B32_PCREL_X 16
45 #define R_HEXAGON_32_6_X 17
46
47 #define R_HEXAGON_B22_PCREL_X 18
48 #define R_HEXAGON_B15_PCREL_X 19
49 #define R_HEXAGON_B13_PCREL_X 20
50 #define R_HEXAGON_B9_PCREL_X 21
51 #define R_HEXAGON_B7_PCREL_X 22
52 #define R_HEXAGON_16_X 23
53 #define R_HEXAGON_12_X 24
54 #define R_HEXAGON_11_X 25
55 #define R_HEXAGON_10_X 26
56 #define R_HEXAGON_9_X 27
57 #define R_HEXAGON_8_X 28
58 #define R_HEXAGON_7_X 29
59 #define R_HEXAGON_6_X 30
60
61 #define R_HEXAGON_32_PCREL 31
62 #define R_HEXAGON_COPY 32
63 #define R_HEXAGON_GLOB_DAT 33
64 #define R_HEXAGON_JMP_SLOT 34
65 #define R_HEXAGON_RELATIVE 35
66 #define R_HEXAGON_PLT_B22_PCREL 36
67 #define R_HEXAGON_GOTOFF_LO16 37
68 #define R_HEXAGON_GOTOFF_HI16 38
69 #define R_HEXAGON_GOTOFF_32 39
70 #define R_HEXAGON_GOT_LO16 40
71 #define R_HEXAGON_GOT_HI16 41
72 #define R_HEXAGON_GOT_32 42
73 #define R_HEXAGON_GOT_16 43
74
75
76
77
78 typedef unsigned long elf_greg_t;
79
80 typedef struct user_regs_struct elf_gregset_t;
81 #define ELF_NGREG (sizeof(elf_gregset_t)/sizeof(unsigned long))
82
83
84 typedef unsigned long elf_fpregset_t;
85
86
87
88
89
90 #if CONFIG_HEXAGON_ARCH_VERSION >= 4
91 #define CS_COPYREGS(DEST,REGS) \
92 do {\
93 DEST.cs0 = REGS->cs0;\
94 DEST.cs1 = REGS->cs1;\
95 } while (0)
96 #else
97 #define CS_COPYREGS(DEST,REGS)
98 #endif
99
100 #define ELF_CORE_COPY_REGS(DEST, REGS) \
101 do { \
102 DEST.r0 = REGS->r00; \
103 DEST.r1 = REGS->r01; \
104 DEST.r2 = REGS->r02; \
105 DEST.r3 = REGS->r03; \
106 DEST.r4 = REGS->r04; \
107 DEST.r5 = REGS->r05; \
108 DEST.r6 = REGS->r06; \
109 DEST.r7 = REGS->r07; \
110 DEST.r8 = REGS->r08; \
111 DEST.r9 = REGS->r09; \
112 DEST.r10 = REGS->r10; \
113 DEST.r11 = REGS->r11; \
114 DEST.r12 = REGS->r12; \
115 DEST.r13 = REGS->r13; \
116 DEST.r14 = REGS->r14; \
117 DEST.r15 = REGS->r15; \
118 DEST.r16 = REGS->r16; \
119 DEST.r17 = REGS->r17; \
120 DEST.r18 = REGS->r18; \
121 DEST.r19 = REGS->r19; \
122 DEST.r20 = REGS->r20; \
123 DEST.r21 = REGS->r21; \
124 DEST.r22 = REGS->r22; \
125 DEST.r23 = REGS->r23; \
126 DEST.r24 = REGS->r24; \
127 DEST.r25 = REGS->r25; \
128 DEST.r26 = REGS->r26; \
129 DEST.r27 = REGS->r27; \
130 DEST.r28 = REGS->r28; \
131 DEST.r29 = pt_psp(REGS); \
132 DEST.r30 = REGS->r30; \
133 DEST.r31 = REGS->r31; \
134 DEST.sa0 = REGS->sa0; \
135 DEST.lc0 = REGS->lc0; \
136 DEST.sa1 = REGS->sa1; \
137 DEST.lc1 = REGS->lc1; \
138 DEST.m0 = REGS->m0; \
139 DEST.m1 = REGS->m1; \
140 DEST.usr = REGS->usr; \
141 DEST.p3_0 = REGS->preds; \
142 DEST.gp = REGS->gp; \
143 DEST.ugp = REGS->ugp; \
144 CS_COPYREGS(DEST,REGS); \
145 DEST.pc = pt_elr(REGS); \
146 DEST.cause = pt_cause(REGS); \
147 DEST.badva = pt_badva(REGS); \
148 } while (0);
149
150
151
152
153
154 #define elf_check_arch(hdr) ((hdr)->e_machine == EM_HEXAGON)
155
156
157
158
159 #define ELF_CLASS ELFCLASS32
160 #define ELF_DATA ELFDATA2LSB
161 #define ELF_ARCH EM_HEXAGON
162
163 #if CONFIG_HEXAGON_ARCH_VERSION == 2
164 #define ELF_CORE_EFLAGS 0x1
165 #endif
166
167 #if CONFIG_HEXAGON_ARCH_VERSION == 3
168 #define ELF_CORE_EFLAGS 0x2
169 #endif
170
171 #if CONFIG_HEXAGON_ARCH_VERSION == 4
172 #define ELF_CORE_EFLAGS 0x3
173 #endif
174
175
176
177
178
179
180
181
182 #define ELF_PLAT_INIT(regs, load_addr) do { } while (0)
183
184 #define USE_ELF_CORE_DUMP
185 #define CORE_DUMP_USE_REGSET
186
187
188 #define ELF_EXEC_PAGESIZE PAGE_SIZE
189
190
191
192
193
194
195
196 #define ELF_ET_DYN_BASE 0x08000000UL
197
198
199
200
201
202 #define ELF_HWCAP (0)
203
204
205
206
207
208
209 #define ELF_PLATFORM (NULL)
210
211 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
212 struct linux_binprm;
213 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
214 int uses_interp);
215
216
217 #endif