elf.h (056f280f3b63f68073dd8d332bf2a0132deccd82) elf.h (0bb87f051e4282afb5f472807c7244b21cf515c7)
1/*
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
4 * for more details.
5 *
6 * Much of this is taken from binutils and GNU libc ...
7 */
8#ifndef _ASM_ELF_H

--- 187 unchanged lines hidden (view full) ---

196 uint8_t cpr2_size; /* The size of co-processor 2 registers */
197 uint8_t fp_abi; /* The floating-point ABI */
198 uint32_t isa_ext; /* Mask of processor-specific extensions */
199 uint32_t ases; /* Mask of ASEs used */
200 uint32_t flags1; /* Mask of general flags */
201 uint32_t flags2;
202};
203
1/*
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
4 * for more details.
5 *
6 * Much of this is taken from binutils and GNU libc ...
7 */
8#ifndef _ASM_ELF_H

--- 187 unchanged lines hidden (view full) ---

196 uint8_t cpr2_size; /* The size of co-processor 2 registers */
197 uint8_t fp_abi; /* The floating-point ABI */
198 uint32_t isa_ext; /* Mask of processor-specific extensions */
199 uint32_t ases; /* Mask of ASEs used */
200 uint32_t flags1; /* Mask of general flags */
201 uint32_t flags2;
202};
203
204#ifndef ELF_ARCH
205/* ELF register definitions */
206#define ELF_NGREG 45
207#define ELF_NFPREG 33
208
209typedef unsigned long elf_greg_t;
210typedef elf_greg_t elf_gregset_t[ELF_NGREG];
211
212typedef double elf_fpreg_t;
213typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
214
215void mips_dump_regs32(u32 *uregs, const struct pt_regs *regs);
216void mips_dump_regs64(u64 *uregs, const struct pt_regs *regs);
217
218#ifdef CONFIG_32BIT
219/*
220 * This is used to ensure we don't load something for the wrong architecture.
221 */
204/* ELF register definitions */
205#define ELF_NGREG 45
206#define ELF_NFPREG 33
207
208typedef unsigned long elf_greg_t;
209typedef elf_greg_t elf_gregset_t[ELF_NGREG];
210
211typedef double elf_fpreg_t;
212typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
213
214void mips_dump_regs32(u32 *uregs, const struct pt_regs *regs);
215void mips_dump_regs64(u64 *uregs, const struct pt_regs *regs);
216
217#ifdef CONFIG_32BIT
218/*
219 * This is used to ensure we don't load something for the wrong architecture.
220 */
222#define elf_check_arch elfo32_check_arch
221#define elf_check_arch elf32_check_arch
223
224/*
225 * These are used to set parameters in the core dumps.
226 */
227#define ELF_CLASS ELFCLASS32
228
229#define ELF_CORE_COPY_REGS(dest, regs) \
230 mips_dump_regs32((u32 *)&(dest), (regs));
231
232#endif /* CONFIG_32BIT */
233
234#ifdef CONFIG_64BIT
235/*
236 * This is used to ensure we don't load something for the wrong architecture.
237 */
222
223/*
224 * These are used to set parameters in the core dumps.
225 */
226#define ELF_CLASS ELFCLASS32
227
228#define ELF_CORE_COPY_REGS(dest, regs) \
229 mips_dump_regs32((u32 *)&(dest), (regs));
230
231#endif /* CONFIG_32BIT */
232
233#ifdef CONFIG_64BIT
234/*
235 * This is used to ensure we don't load something for the wrong architecture.
236 */
238#define elf_check_arch elfn64_check_arch
237#define elf_check_arch elf64_check_arch
238#define compat_elf_check_arch elf32_check_arch
239
240/*
241 * These are used to set parameters in the core dumps.
242 */
243#define ELF_CLASS ELFCLASS64
244
245#define ELF_CORE_COPY_REGS(dest, regs) \
246 mips_dump_regs64((u64 *)&(dest), (regs));

--- 5 unchanged lines hidden (view full) ---

252 */
253#ifdef __MIPSEB__
254#define ELF_DATA ELFDATA2MSB
255#elif defined(__MIPSEL__)
256#define ELF_DATA ELFDATA2LSB
257#endif
258#define ELF_ARCH EM_MIPS
259
239
240/*
241 * These are used to set parameters in the core dumps.
242 */
243#define ELF_CLASS ELFCLASS64
244
245#define ELF_CORE_COPY_REGS(dest, regs) \
246 mips_dump_regs64((u64 *)&(dest), (regs));

--- 5 unchanged lines hidden (view full) ---

252 */
253#ifdef __MIPSEB__
254#define ELF_DATA ELFDATA2MSB
255#elif defined(__MIPSEL__)
256#define ELF_DATA ELFDATA2LSB
257#endif
258#define ELF_ARCH EM_MIPS
259
260#endif /* !defined(ELF_ARCH) */
261
262/*
263 * In order to be sure that we don't attempt to execute an O32 binary which
264 * requires 64 bit FP (FR=1) on a system which does not support it we refuse
265 * to execute any binary which has bits specified by the following macro set
266 * in its ELF header flags.
267 */
268#ifdef CONFIG_MIPS_O32_FP64_SUPPORT
269# define __MIPS_O32_FP64_MUST_BE_ZERO 0
270#else
271# define __MIPS_O32_FP64_MUST_BE_ZERO EF_MIPS_FP64
272#endif
273
274#define mips_elf_check_machine(x) ((x)->e_machine == EM_MIPS)
275
276#define vmcore_elf32_check_arch mips_elf_check_machine
277#define vmcore_elf64_check_arch mips_elf_check_machine
278
279/*
260/*
261 * In order to be sure that we don't attempt to execute an O32 binary which
262 * requires 64 bit FP (FR=1) on a system which does not support it we refuse
263 * to execute any binary which has bits specified by the following macro set
264 * in its ELF header flags.
265 */
266#ifdef CONFIG_MIPS_O32_FP64_SUPPORT
267# define __MIPS_O32_FP64_MUST_BE_ZERO 0
268#else
269# define __MIPS_O32_FP64_MUST_BE_ZERO EF_MIPS_FP64
270#endif
271
272#define mips_elf_check_machine(x) ((x)->e_machine == EM_MIPS)
273
274#define vmcore_elf32_check_arch mips_elf_check_machine
275#define vmcore_elf64_check_arch mips_elf_check_machine
276
277/*
280 * Return non-zero if HDR identifies an o32 ELF binary.
278 * Return non-zero if HDR identifies an o32 or n32 ELF binary.
281 */
279 */
282#define elfo32_check_arch(hdr) \
280#define elf32_check_arch(hdr) \
283({ \
284 int __res = 1; \
285 struct elfhdr *__h = (hdr); \
286 \
287 if (!mips_elf_check_machine(__h)) \
288 __res = 0; \
289 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
290 __res = 0; \
281({ \
282 int __res = 1; \
283 struct elfhdr *__h = (hdr); \
284 \
285 if (!mips_elf_check_machine(__h)) \
286 __res = 0; \
287 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
288 __res = 0; \
291 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
292 __res = 0; \
293 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
294 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
295 __res = 0; \
296 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
297 __res = 0; \
298 \
289 if ((__h->e_flags & EF_MIPS_ABI2) != 0) { \
290 if (!IS_ENABLED(CONFIG_MIPS32_N32) || \
291 (__h->e_flags & EF_MIPS_ABI)) \
292 __res = 0; \
293 } else { \
294 if (IS_ENABLED(CONFIG_64BIT) && !IS_ENABLED(CONFIG_MIPS32_O32)) \
295 __res = 0; \
296 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
297 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
298 __res = 0; \
299 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
300 __res = 0; \
301 } \
299 __res; \
300})
301
302/*
303 * Return non-zero if HDR identifies an n64 ELF binary.
304 */
302 __res; \
303})
304
305/*
306 * Return non-zero if HDR identifies an n64 ELF binary.
307 */
305#define elfn64_check_arch(hdr) \
308#define elf64_check_arch(hdr) \
306({ \
307 int __res = 1; \
308 struct elfhdr *__h = (hdr); \
309 \
310 if (!mips_elf_check_machine(__h)) \
311 __res = 0; \
312 if (__h->e_ident[EI_CLASS] != ELFCLASS64) \
313 __res = 0; \
314 \
315 __res; \
316})
317
309({ \
310 int __res = 1; \
311 struct elfhdr *__h = (hdr); \
312 \
313 if (!mips_elf_check_machine(__h)) \
314 __res = 0; \
315 if (__h->e_ident[EI_CLASS] != ELFCLASS64) \
316 __res = 0; \
317 \
318 __res; \
319})
320
318/*
319 * Return non-zero if HDR identifies an n32 ELF binary.
320 */
321#define elfn32_check_arch(hdr) \
322({ \
323 int __res = 1; \
324 struct elfhdr *__h = (hdr); \
325 \
326 if (!mips_elf_check_machine(__h)) \
327 __res = 0; \
328 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
329 __res = 0; \
330 if (((__h->e_flags & EF_MIPS_ABI2) == 0) || \
331 ((__h->e_flags & EF_MIPS_ABI) != 0)) \
332 __res = 0; \
333 \
334 __res; \
335})
336
337struct mips_abi;
338
339extern struct mips_abi mips_abi;
340extern struct mips_abi mips_abi_32;
341extern struct mips_abi mips_abi_n32;
342
343#ifdef CONFIG_32BIT
344

--- 192 unchanged lines hidden ---
321struct mips_abi;
322
323extern struct mips_abi mips_abi;
324extern struct mips_abi mips_abi_32;
325extern struct mips_abi mips_abi_n32;
326
327#ifdef CONFIG_32BIT
328

--- 192 unchanged lines hidden ---