Commit 1f7d6668 authored by Mark Nelson's avatar Mark Nelson Committed by Linus Torvalds

powerpc: add Altivec/VMX state to coredumps

Update dump_task_altivec() (which has so far never been put to use) so that
it dumps the Altivec/VMX registers (VR[0] - VR[31], VSCR and VRSAVE) in the
same format as the ptrace get_vrregs(), and add the appropriate glue
typedef and #defines to make it work.

A new note type of NT_PPC_VMX was chosen to be 0x100 (arbitrarily) because
it allows the low range values to be used for more generic purposes and
0x100 seems an adequate starting point for PowerPC extensions.
Signed-off-by: default avatarMark Nelson <markn@au1.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <ak@suse.de>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5b20cd80
...@@ -149,10 +149,32 @@ void flush_altivec_to_thread(struct task_struct *tsk) ...@@ -149,10 +149,32 @@ void flush_altivec_to_thread(struct task_struct *tsk)
} }
} }
int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
{ {
flush_altivec_to_thread(current); /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs)); * separately, see below */
const int nregs = ELF_NVRREG - 2;
elf_vrreg_t *reg;
u32 *dest;
if (tsk == current)
flush_altivec_to_thread(tsk);
reg = (elf_vrreg_t *)vrregs;
/* copy the 32 vr registers */
memcpy(reg, &tsk->thread.vr[0], nregs * sizeof(*reg));
reg += nregs;
/* copy the vscr */
memcpy(reg, &tsk->thread.vscr, sizeof(*reg));
reg++;
/* vrsave is stored in the high 32bit slot of the final 128bits */
memset(reg, 0, sizeof(*reg));
dest = (u32 *)reg;
*dest = tsk->thread.vrsave;
return 1; return 1;
} }
#endif /* CONFIG_ALTIVEC */ #endif /* CONFIG_ALTIVEC */
......
...@@ -212,6 +212,14 @@ static inline int dump_task_regs(struct task_struct *tsk, ...@@ -212,6 +212,14 @@ static inline int dump_task_regs(struct task_struct *tsk,
extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
typedef elf_vrregset_t elf_fpxregset_t;
#ifdef CONFIG_ALTIVEC
extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX
#endif
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* ELF_HWCAP yields a mask that user programs can use to figure out what /* ELF_HWCAP yields a mask that user programs can use to figure out what
......
...@@ -355,6 +355,7 @@ typedef struct elf64_shdr { ...@@ -355,6 +355,7 @@ typedef struct elf64_shdr {
#define NT_TASKSTRUCT 4 #define NT_TASKSTRUCT 4
#define NT_AUXV 6 #define NT_AUXV 6
#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
/* Note header in a PT_NOTE section */ /* Note header in a PT_NOTE section */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment