diff options
| author | Becky Bruce <bgill@freescale.com> | 2005-09-19 20:17:27 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2005-09-21 05:21:09 -0400 |
| commit | a99eb2ef452ce685e40a433ceb187276ba0871f4 (patch) | |
| tree | 7226783dea8be9aa14f6b8dde330ac0dc3ba7ab5 | |
| parent | 25433b123ce1a3da78ddd9b848484bca91cbb7a1 (diff) | |
[PATCH] powerpc: Merge elf.h
ppc/ppc64: Merge elf.h into include/asm-powerpc
Merge elf.h into a single include file for 32 and 64-bit ppc platforms. This
patch has been tested on 32-bit and built on 64-bit platforms.
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Becky Bruce <Becky.Bruce@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
| -rw-r--r-- | include/asm-powerpc/elf.h (renamed from include/asm-ppc64/elf.h) | 97 | ||||
| -rw-r--r-- | include/asm-ppc/elf.h | 151 |
2 files changed, 62 insertions, 186 deletions
diff --git a/include/asm-ppc64/elf.h b/include/asm-powerpc/elf.h index e27c2942953c..36b9d5cec50c 100644 --- a/include/asm-ppc64/elf.h +++ b/include/asm-powerpc/elf.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef __PPC64_ELF_H | 1 | #ifndef _ASM_POWERPC_ELF_H |
| 2 | #define __PPC64_ELF_H | 2 | #define _ASM_POWERPC_ELF_H |
| 3 | 3 | ||
| 4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
| 5 | #include <asm/ptrace.h> | 5 | #include <asm/ptrace.h> |
| @@ -76,7 +76,7 @@ | |||
| 76 | #define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ | 76 | #define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ |
| 77 | #define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ | 77 | #define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ |
| 78 | 78 | ||
| 79 | /* Keep this the last entry. */ | 79 | /* keep this the last entry. */ |
| 80 | #define R_PPC_NUM 95 | 80 | #define R_PPC_NUM 95 |
| 81 | 81 | ||
| 82 | /* | 82 | /* |
| @@ -91,8 +91,6 @@ | |||
| 91 | 91 | ||
| 92 | #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ | 92 | #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ |
| 93 | #define ELF_NFPREG 33 /* includes fpscr */ | 93 | #define ELF_NFPREG 33 /* includes fpscr */ |
| 94 | #define ELF_NVRREG32 33 /* includes vscr & vrsave stuffed together */ | ||
| 95 | #define ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */ | ||
| 96 | 94 | ||
| 97 | typedef unsigned long elf_greg_t64; | 95 | typedef unsigned long elf_greg_t64; |
| 98 | typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG]; | 96 | typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG]; |
| @@ -101,8 +99,21 @@ typedef unsigned int elf_greg_t32; | |||
| 101 | typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG]; | 99 | typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG]; |
| 102 | 100 | ||
| 103 | /* | 101 | /* |
| 104 | * These are used to set parameters in the core dumps. | 102 | * ELF_ARCH, CLASS, and DATA are used to set parameters in the core dumps. |
| 105 | */ | 103 | */ |
| 104 | #ifdef __powerpc64__ | ||
| 105 | # define ELF_NVRREG32 33 /* includes vscr & vrsave stuffed together */ | ||
| 106 | # define ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */ | ||
| 107 | # define ELF_GREG_TYPE elf_greg_t64 | ||
| 108 | #else | ||
| 109 | # define ELF_NEVRREG 34 /* includes acc (as 2) */ | ||
| 110 | # define ELF_NVRREG 33 /* includes vscr */ | ||
| 111 | # define ELF_GREG_TYPE elf_greg_t32 | ||
| 112 | # define ELF_ARCH EM_PPC | ||
| 113 | # define ELF_CLASS ELFCLASS32 | ||
| 114 | # define ELF_DATA ELFDATA2MSB | ||
| 115 | #endif /* __powerpc64__ */ | ||
| 116 | |||
| 106 | #ifndef ELF_ARCH | 117 | #ifndef ELF_ARCH |
| 107 | # define ELF_ARCH EM_PPC64 | 118 | # define ELF_ARCH EM_PPC64 |
| 108 | # define ELF_CLASS ELFCLASS64 | 119 | # define ELF_CLASS ELFCLASS64 |
| @@ -115,8 +126,9 @@ typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG]; | |||
| 115 | typedef elf_greg_t32 elf_greg_t; | 126 | typedef elf_greg_t32 elf_greg_t; |
| 116 | typedef elf_gregset_t32 elf_gregset_t; | 127 | typedef elf_gregset_t32 elf_gregset_t; |
| 117 | # define elf_addr_t u32 | 128 | # define elf_addr_t u32 |
| 118 | #endif | 129 | #endif /* ELF_ARCH */ |
| 119 | 130 | ||
| 131 | /* Floating point registers */ | ||
| 120 | typedef double elf_fpreg_t; | 132 | typedef double elf_fpreg_t; |
| 121 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | 133 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; |
| 122 | 134 | ||
| @@ -126,7 +138,9 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
| 126 | * The entry with index 32 contains the vscr as the last word (offset 12) | 138 | * The entry with index 32 contains the vscr as the last word (offset 12) |
| 127 | * within the quadword. This allows the vscr to be stored as either a | 139 | * within the quadword. This allows the vscr to be stored as either a |
| 128 | * quadword (since it must be copied via a vector register to/from storage) | 140 | * quadword (since it must be copied via a vector register to/from storage) |
| 129 | * or as a word. The entry with index 33 contains the vrsave as the first | 141 | * or as a word. |
| 142 | * | ||
| 143 | * 64-bit kernel notes: The entry at index 33 contains the vrsave as the first | ||
| 130 | * word (offset 0) within the quadword. | 144 | * word (offset 0) within the quadword. |
| 131 | * | 145 | * |
| 132 | * This definition of the VMX state is compatible with the current PPC32 | 146 | * This definition of the VMX state is compatible with the current PPC32 |
| @@ -139,7 +153,9 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
| 139 | */ | 153 | */ |
| 140 | typedef __vector128 elf_vrreg_t; | 154 | typedef __vector128 elf_vrreg_t; |
| 141 | typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; | 155 | typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; |
| 156 | #ifdef __powerpc64__ | ||
| 142 | typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; | 157 | typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; |
| 158 | #endif | ||
| 143 | 159 | ||
| 144 | /* | 160 | /* |
| 145 | * This is used to ensure we don't load something for the wrong architecture. | 161 | * This is used to ensure we don't load something for the wrong architecture. |
| @@ -159,26 +175,30 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; | |||
| 159 | #ifdef __KERNEL__ | 175 | #ifdef __KERNEL__ |
| 160 | 176 | ||
| 161 | /* Common routine for both 32-bit and 64-bit processes */ | 177 | /* Common routine for both 32-bit and 64-bit processes */ |
| 162 | static inline void ppc64_elf_core_copy_regs(elf_gregset_t elf_regs, | 178 | static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs, |
| 163 | struct pt_regs *regs) | 179 | struct pt_regs *regs) |
| 164 | { | 180 | { |
| 165 | int i; | 181 | int i; |
| 166 | int gprs = sizeof(struct pt_regs)/sizeof(elf_greg_t64); | 182 | int gprs = sizeof(struct pt_regs)/sizeof(ELF_GREG_TYPE); |
| 167 | 183 | ||
| 168 | if (gprs > ELF_NGREG) | 184 | if (gprs > ELF_NGREG) |
| 169 | gprs = ELF_NGREG; | 185 | gprs = ELF_NGREG; |
| 170 | 186 | ||
| 171 | for (i=0; i < gprs; i++) | 187 | for (i=0; i < gprs; i++) |
| 172 | elf_regs[i] = (elf_greg_t)((elf_greg_t64 *)regs)[i]; | 188 | elf_regs[i] = (elf_greg_t)((ELF_GREG_TYPE *)regs)[i]; |
| 189 | |||
| 190 | memset((char *)(elf_regs) + sizeof(struct pt_regs), 0, \ | ||
| 191 | sizeof(elf_gregset_t) - sizeof(struct pt_regs)); | ||
| 192 | |||
| 173 | } | 193 | } |
| 174 | #define ELF_CORE_COPY_REGS(gregs, regs) ppc64_elf_core_copy_regs(gregs, regs); | 194 | #define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs); |
| 175 | 195 | ||
| 176 | static inline int dump_task_regs(struct task_struct *tsk, | 196 | static inline int dump_task_regs(struct task_struct *tsk, |
| 177 | elf_gregset_t *elf_regs) | 197 | elf_gregset_t *elf_regs) |
| 178 | { | 198 | { |
| 179 | struct pt_regs *regs = tsk->thread.regs; | 199 | struct pt_regs *regs = tsk->thread.regs; |
| 180 | if (regs) | 200 | if (regs) |
| 181 | ppc64_elf_core_copy_regs(*elf_regs, regs); | 201 | ppc_elf_core_copy_regs(*elf_regs, regs); |
| 182 | 202 | ||
| 183 | return 1; | 203 | return 1; |
| 184 | } | 204 | } |
| @@ -187,15 +207,21 @@ static inline int dump_task_regs(struct task_struct *tsk, | |||
| 187 | extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); | 207 | extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); |
| 188 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) | 208 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) |
| 189 | 209 | ||
| 190 | /* XXX Should we define the XFPREGS using altivec ??? */ | 210 | #endif /* __KERNEL__ */ |
| 191 | |||
| 192 | #endif | ||
| 193 | 211 | ||
| 194 | /* This yields a mask that user programs can use to figure out what | 212 | /* ELF_HWCAP yields a mask that user programs can use to figure out what |
| 195 | instruction set this cpu supports. This could be done in userspace, | 213 | instruction set this cpu supports. This could be done in userspace, |
| 196 | but it's not easy, and we've already done it here. */ | 214 | but it's not easy, and we've already done it here. */ |
| 197 | 215 | #ifdef __powerpc64__ | |
| 198 | #define ELF_HWCAP (cur_cpu_spec->cpu_user_features) | 216 | # define ELF_HWCAP (cur_cpu_spec->cpu_user_features) |
| 217 | # define ELF_PLAT_INIT(_r, load_addr) do { \ | ||
| 218 | memset(_r->gpr, 0, sizeof(_r->gpr)); \ | ||
| 219 | _r->ctr = _r->link = _r->xer = _r->ccr = 0; \ | ||
| 220 | _r->gpr[2] = load_addr; \ | ||
| 221 | } while (0) | ||
| 222 | #else | ||
| 223 | # define ELF_HWCAP (cur_cpu_spec[0]->cpu_user_features) | ||
| 224 | #endif /* __powerpc64__ */ | ||
| 199 | 225 | ||
| 200 | /* This yields a string that ld.so will use to load implementation | 226 | /* This yields a string that ld.so will use to load implementation |
| 201 | specific libraries for optimization. This is more specific in | 227 | specific libraries for optimization. This is more specific in |
| @@ -206,14 +232,10 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); | |||
| 206 | 232 | ||
| 207 | #define ELF_PLATFORM (NULL) | 233 | #define ELF_PLATFORM (NULL) |
| 208 | 234 | ||
| 209 | #define ELF_PLAT_INIT(_r, load_addr) do { \ | ||
| 210 | memset(_r->gpr, 0, sizeof(_r->gpr)); \ | ||
| 211 | _r->ctr = _r->link = _r->xer = _r->ccr = 0; \ | ||
| 212 | _r->gpr[2] = load_addr; \ | ||
| 213 | } while (0) | ||
| 214 | |||
| 215 | #ifdef __KERNEL__ | 235 | #ifdef __KERNEL__ |
| 216 | #define SET_PERSONALITY(ex, ibcs2) \ | 236 | |
| 237 | #ifdef __powerpc64__ | ||
| 238 | # define SET_PERSONALITY(ex, ibcs2) \ | ||
| 217 | do { \ | 239 | do { \ |
| 218 | unsigned long new_flags = 0; \ | ||
