aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/process.c19
-rw-r--r--arch/powerpc/kernel/ptrace.c21
-rw-r--r--include/asm-powerpc/elf.h4
-rw-r--r--include/linux/elf.h1
4 files changed, 17 insertions, 28 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index d52ded366f14..1924b57bd241 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -162,7 +162,7 @@ void flush_altivec_to_thread(struct task_struct *tsk)
162 } 162 }
163} 163}
164 164
165int dump_task_altivec(struct task_struct *tsk, elf_vrreg_t *vrregs) 165int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
166{ 166{
167 /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save 167 /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
168 * separately, see below */ 168 * separately, see below */
@@ -249,23 +249,6 @@ int dump_task_vsx(struct task_struct *tsk, elf_vrreg_t *vrregs)
249} 249}
250#endif /* CONFIG_VSX */ 250#endif /* CONFIG_VSX */
251 251
252int dump_task_vector(struct task_struct *tsk, elf_vrregset_t *vrregs)
253{
254 int rc = 0;
255 elf_vrreg_t *regs = (elf_vrreg_t *)vrregs;
256#ifdef CONFIG_ALTIVEC
257 rc = dump_task_altivec(tsk, regs);
258 if (rc)
259 return rc;
260 regs += ELF_NVRREG;
261#endif
262
263#ifdef CONFIG_VSX
264 rc = dump_task_vsx(tsk, regs);
265#endif
266 return rc;
267}
268
269#ifdef CONFIG_SPE 252#ifdef CONFIG_SPE
270 253
271void enable_kernel_spe(void) 254void enable_kernel_spe(void)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 4e203a89e189..8feb93e7890c 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -368,13 +368,15 @@ static int vsr_get(struct task_struct *target, const struct user_regset *regset,
368 unsigned int pos, unsigned int count, 368 unsigned int pos, unsigned int count,
369 void *kbuf, void __user *ubuf) 369 void *kbuf, void __user *ubuf)
370{ 370{
371 int ret; 371 double buf[32];
372 int ret, i;
372 373
373 flush_vsx_to_thread(target); 374 flush_vsx_to_thread(target);
374 375
376 for (i = 0; i < 32 ; i++)
377 buf[i] = current->thread.fpr[i][TS_VSRLOWOFFSET];
375 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 378 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
376 target->thread.fpr, 0, 379 buf, 0, 32 * sizeof(double));
377 32 * sizeof(vector128));
378 380
379 return ret; 381 return ret;
380} 382}
@@ -383,13 +385,16 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset,
383 unsigned int pos, unsigned int count, 385 unsigned int pos, unsigned int count,
384 const void *kbuf, const void __user *ubuf) 386 const void *kbuf, const void __user *ubuf)
385{ 387{
386 int ret; 388 double buf[32];
389 int ret,i;
387 390
388 flush_vsx_to_thread(target); 391 flush_vsx_to_thread(target);
389 392
390 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 393 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
391 target->thread.fpr, 0, 394 buf, 0, 32 * sizeof(double));
392 32 * sizeof(vector128)); 395 for (i = 0; i < 32 ; i++)
396 current->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i];
397
393 398
394 return ret; 399 return ret;
395} 400}
@@ -499,8 +504,8 @@ static const struct user_regset native_regsets[] = {
499#endif 504#endif
500#ifdef CONFIG_VSX 505#ifdef CONFIG_VSX
501 [REGSET_VSX] = { 506 [REGSET_VSX] = {
502 .n = 32, 507 .core_note_type = NT_PPC_VSX, .n = 32,
503 .size = sizeof(vector128), .align = sizeof(vector128), 508 .size = sizeof(double), .align = sizeof(double),
504 .active = vsr_active, .get = vsr_get, .set = vsr_set 509 .active = vsr_active, .get = vsr_get, .set = vsr_set
505 }, 510 },
506#endif 511#endif
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index b6a874db801d..38a51728406f 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -221,8 +221,8 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
221typedef elf_vrregset_t elf_fpxregset_t; 221typedef elf_vrregset_t elf_fpxregset_t;
222 222
223#ifdef CONFIG_ALTIVEC 223#ifdef CONFIG_ALTIVEC
224extern int dump_task_vector(struct task_struct *, elf_vrregset_t *vrregs); 224extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
225#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_vector(tsk, regs) 225#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
226#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX 226#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX
227#endif 227#endif
228 228
diff --git a/include/linux/elf.h b/include/linux/elf.h
index ff9fbed90123..edc3dac3f02f 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -358,6 +358,7 @@ typedef struct elf64_shdr {
358#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 358#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
359#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 359#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
361#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
362 363
363 364