| 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify |
| 3 | * it under the terms of the GNU General Public License version 2 as |
| 4 | * published by the Free Software Foundation, or (at your option) any |
| 5 | * later version. See the COPYING file in the top-level directory. |
| 6 | */ |
| 7 | |
| 8 | #ifndef PPC_TARGET_ELF_H |
| 9 | #define PPC_TARGET_ELF_H |
| 10 | |
| 11 | #include "target_ptrace.h" |
| 12 | |
| 13 | #define ELF_MACHINE PPC_ELF_MACHINE |
| 14 | |
| 15 | #ifdef TARGET_PPC64 |
| 16 | # define ELF_CLASS ELFCLASS64 |
| 17 | #else |
| 18 | # define ELF_CLASS ELFCLASS32 |
| 19 | # define EXSTACK_DEFAULT true |
| 20 | #endif |
| 21 | |
| 22 | #define HAVE_ELF_HWCAP 1 |
| 23 | #define HAVE_ELF_HWCAP2 1 |
| 24 | #define HAVE_ELF_CORE_DUMP 1 |
| 25 | |
| 26 | /* |
| 27 | * The size of 48 words is set in arch/powerpc/include/uapi/asm/elf.h. |
| 28 | * However PPC_ELF_CORE_COPY_REGS in arch/powerpc/include/asm/elf.h |
| 29 | * open-codes a memcpy from struct pt_regs, then zeros the rest. |
| 30 | */ |
| 31 | typedef struct target_elf_gregset_t { |
| 32 | union { |
| 33 | struct target_pt_regs pt; |
| 34 | abi_ulong reserved[48]; |
| 35 | }; |
| 36 | } target_elf_gregset_t; |
| 37 | |
| 38 | #ifndef TARGET_PPC64 |
| 39 | # define VDSO_HEADER "vdso-32.c.inc" |
| 40 | #elif TARGET_BIG_ENDIAN |
| 41 | # define VDSO_HEADER "vdso-64.c.inc" |
| 42 | #else |
| 43 | # define VDSO_HEADER "vdso-64le.c.inc" |
| 44 | #endif |
| 45 | |
| 46 | /* |
| 47 | * The requirements here are: |
| 48 | * - keep the final alignment of sp (sp & 0xf) |
| 49 | * - make sure the 32-bit value at the first 16 byte aligned position of |
| 50 | * AUXV is greater than 16 for glibc compatibility. |
| 51 | * AT_IGNOREPPC is used for that. |
| 52 | * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC, |
| 53 | * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. |
| 54 | */ |
| 55 | #define DLINFO_ARCH_ITEMS 5 |
| 56 | #define ARCH_DLINFO \ |
| 57 | do { \ |
| 58 | PowerPCCPU *cpu = POWERPC_CPU(thread_cpu); \ |
| 59 | /* \ |
| 60 | * Handle glibc compatibility: these magic entries must \ |
| 61 | * be at the lowest addresses in the final auxv. \ |
| 62 | */ \ |
| 63 | NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ |
| 64 | NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ |
| 65 | NEW_AUX_ENT(AT_DCACHEBSIZE, cpu->env.dcache_line_size); \ |
| 66 | NEW_AUX_ENT(AT_ICACHEBSIZE, cpu->env.icache_line_size); \ |
| 67 | NEW_AUX_ENT(AT_UCACHEBSIZE, 0); \ |
| 68 | } while (0) |
| 69 | |
| 70 | #endif |