diff options
Diffstat (limited to 'include/asm-mips/elf.h')
-rw-r--r-- | include/asm-mips/elf.h | 96 |
1 files changed, 73 insertions, 23 deletions
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index e48811440015..7420f12742bb 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h | |||
@@ -2,6 +2,8 @@ | |||
2 | * This file is subject to the terms and conditions of the GNU General Public | 2 | * This file is subject to the terms and conditions of the GNU General Public |
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | ||
6 | * Much of this is taken from binutils and GNU libc ... | ||
5 | */ | 7 | */ |
6 | #ifndef _ASM_ELF_H | 8 | #ifndef _ASM_ELF_H |
7 | #define _ASM_ELF_H | 9 | #define _ASM_ELF_H |
@@ -17,6 +19,8 @@ | |||
17 | #define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ | 19 | #define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ |
18 | #define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */ | 20 | #define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */ |
19 | #define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */ | 21 | #define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */ |
22 | #define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32 R2 code. */ | ||
23 | #define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64 R2 code. */ | ||
20 | 24 | ||
21 | /* The ABI of a file. */ | 25 | /* The ABI of a file. */ |
22 | #define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */ | 26 | #define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */ |
@@ -105,7 +109,11 @@ | |||
105 | #define R_MIPS_LOVENDOR 100 | 109 | #define R_MIPS_LOVENDOR 100 |
106 | #define R_MIPS_HIVENDOR 127 | 110 | #define R_MIPS_HIVENDOR 127 |
107 | 111 | ||
108 | #define SHN_MIPS_ACCOMON 0xff00 | 112 | #define SHN_MIPS_ACCOMON 0xff00 /* Allocated common symbols */ |
113 | #define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ | ||
114 | #define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ | ||
115 | #define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ | ||
116 | #define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ | ||
109 | 117 | ||
110 | #define SHT_MIPS_LIST 0x70000000 | 118 | #define SHT_MIPS_LIST 0x70000000 |
111 | #define SHT_MIPS_CONFLICT 0x70000002 | 119 | #define SHT_MIPS_CONFLICT 0x70000002 |
@@ -193,50 +201,92 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
193 | 201 | ||
194 | #ifdef __KERNEL__ | 202 | #ifdef __KERNEL__ |
195 | 203 | ||
204 | struct mips_abi; | ||
205 | |||
206 | extern struct mips_abi mips_abi; | ||
207 | extern struct mips_abi mips_abi_32; | ||
208 | extern struct mips_abi mips_abi_n32; | ||
209 | |||
196 | #ifdef CONFIG_32BIT | 210 | #ifdef CONFIG_32BIT |
197 | 211 | ||
198 | #define SET_PERSONALITY(ex, ibcs2) \ | 212 | #define SET_PERSONALITY(ex, ibcs2) \ |
199 | do { \ | 213 | do { \ |
200 | if (ibcs2) \ | 214 | if (ibcs2) \ |
201 | set_personality(PER_SVR4); \ | 215 | set_personality(PER_SVR4); \ |
202 | set_personality(PER_LINUX); \ | 216 | set_personality(PER_LINUX); \ |
217 | \ | ||
218 | current->thread.abi = &mips_abi; \ | ||
203 | } while (0) | 219 | } while (0) |
204 | 220 | ||
205 | #endif /* CONFIG_32BIT */ | 221 | #endif /* CONFIG_32BIT */ |
206 | 222 | ||
207 | #ifdef CONFIG_64BIT | 223 | #ifdef CONFIG_64BIT |
208 | 224 | ||
209 | #define SET_PERSONALITY(ex, ibcs2) \ | 225 | #ifdef CONFIG_MIPS32_N32 |
210 | do { current->thread.mflags &= ~MF_ABI_MASK; \ | 226 | #define __SET_PERSONALITY32_N32() \ |
211 | if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \ | 227 | do { \ |
212 | if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \ | 228 | current->thread.mflags |= MF_N32; \ |
213 | ((ex).e_flags & EF_MIPS_ABI) == 0) \ | 229 | current->thread.abi = &mips_abi_n32; \ |
214 | current->thread.mflags |= MF_N32; \ | 230 | } while (0) |
215 | else \ | 231 | #else |
216 | current->thread.mflags |= MF_O32; \ | 232 | #define __SET_PERSONALITY32_N32() \ |
217 | } else \ | 233 | do { } while (0) |
218 | current->thread.mflags |= MF_N64; \ | 234 | #endif |
219 | if (ibcs2) \ | 235 | |
220 | set_personality(PER_SVR4); \ | 236 | #ifdef CONFIG_MIPS32_O32 |
221 | else if (current->personality != PER_LINUX32) \ | 237 | #define __SET_PERSONALITY32_O32() \ |
222 | set_personality(PER_LINUX); \ | 238 | do { \ |
239 | current->thread.mflags |= MF_O32; \ | ||
240 | current->thread.abi = &mips_abi_32; \ | ||
241 | } while (0) | ||
242 | #else | ||
243 | #define __SET_PERSONALITY32_O32() \ | ||
244 | do { } while (0) | ||
245 | #endif | ||
246 | |||
247 | #ifdef CONFIG_MIPS32_COMPAT | ||
248 | #define __SET_PERSONALITY32(ex) \ | ||
249 | do { \ | ||
250 | if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \ | ||
251 | ((ex).e_flags & EF_MIPS_ABI) == 0) \ | ||
252 | __SET_PERSONALITY32_N32(); \ | ||
253 | else \ | ||
254 | __SET_PERSONALITY32_O32(); \ | ||
255 | } while (0) | ||
256 | #else | ||
257 | #define __SET_PERSONALITY32(ex) do { } while (0) | ||
258 | #endif | ||
259 | |||
260 | #define SET_PERSONALITY(ex, ibcs2) \ | ||
261 | do { \ | ||
262 | current->thread.mflags &= ~MF_ABI_MASK; \ | ||
263 | if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ | ||
264 | __SET_PERSONALITY32(ex); \ | ||
265 | else { \ | ||
266 | current->thread.mflags |= MF_N64; \ | ||
267 | current->thread.abi = &mips_abi; \ | ||
268 | } \ | ||
269 | \ | ||
270 | if (ibcs2) \ | ||
271 | set_personality(PER_SVR4); \ | ||
272 | else if (current->personality != PER_LINUX32) \ | ||
273 | set_personality(PER_LINUX); \ | ||
223 | } while (0) | 274 | } while (0) |
224 | 275 | ||
225 | #endif /* CONFIG_64BIT */ | 276 | #endif /* CONFIG_64BIT */ |
226 | 277 | ||
227 | extern void dump_regs(elf_greg_t *, struct pt_regs *regs); | 278 | extern void dump_regs(elf_greg_t *, struct pt_regs *regs); |
279 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); | ||
228 | extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); | 280 | extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); |
229 | 281 | ||
230 | #define ELF_CORE_COPY_REGS(elf_regs, regs) \ | 282 | #define ELF_CORE_COPY_REGS(elf_regs, regs) \ |
231 | dump_regs((elf_greg_t *)&(elf_regs), regs); | 283 | dump_regs((elf_greg_t *)&(elf_regs), regs); |
284 | #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) | ||
232 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \ | 285 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \ |
233 | dump_task_fpu(tsk, elf_fpregs) | 286 | dump_task_fpu(tsk, elf_fpregs) |
234 | 287 | ||
235 | #endif /* __KERNEL__ */ | 288 | #endif /* __KERNEL__ */ |
236 | 289 | ||
237 | /* This one accepts IRIX binaries. */ | ||
238 | #define irix_elf_check_arch(hdr) ((hdr)->e_flags & RHF_SGI_ONLY) | ||
239 | |||
240 | #define USE_ELF_CORE_DUMP | 290 | #define USE_ELF_CORE_DUMP |
241 | #define ELF_EXEC_PAGESIZE PAGE_SIZE | 291 | #define ELF_EXEC_PAGESIZE PAGE_SIZE |
242 | 292 | ||