Commit f3e909c2 authored by Michael Neuling's avatar Michael Neuling Committed by Paul Mackerras

powerpc: Update for VSX core file and ptrace

This correctly hooks the VSX dump into Roland McGrath core file
infrastructure.  It adds the VSX dump information as an additional elf
note in the core file (after talking more to the tool chain/gdb guys).
This also ensures the formats are consistent between signals, ptrace
and core files.
Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 436db693
...@@ -162,7 +162,7 @@ void flush_altivec_to_thread(struct task_struct *tsk) ...@@ -162,7 +162,7 @@ void flush_altivec_to_thread(struct task_struct *tsk)
} }
} }
int dump_task_altivec(struct task_struct *tsk, elf_vrreg_t *vrregs) int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
{ {
/* ELF_NVRREG includes the VSCR and VRSAVE which we need to save /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
* separately, see below */ * separately, see below */
...@@ -249,23 +249,6 @@ int dump_task_vsx(struct task_struct *tsk, elf_vrreg_t *vrregs) ...@@ -249,23 +249,6 @@ int dump_task_vsx(struct task_struct *tsk, elf_vrreg_t *vrregs)
} }
#endif /* CONFIG_VSX */ #endif /* CONFIG_VSX */
int dump_task_vector(struct task_struct *tsk, elf_vrregset_t *vrregs)
{
int rc = 0;
elf_vrreg_t *regs = (elf_vrreg_t *)vrregs;
#ifdef CONFIG_ALTIVEC
rc = dump_task_altivec(tsk, regs);
if (rc)
return rc;
regs += ELF_NVRREG;
#endif
#ifdef CONFIG_VSX
rc = dump_task_vsx(tsk, regs);
#endif
return rc;
}
#ifdef CONFIG_SPE #ifdef CONFIG_SPE
void enable_kernel_spe(void) void enable_kernel_spe(void)
......
...@@ -368,13 +368,15 @@ static int vsr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -368,13 +368,15 @@ static int vsr_get(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf) void *kbuf, void __user *ubuf)
{ {
int ret; double buf[32];
int ret, i;
flush_vsx_to_thread(target); flush_vsx_to_thread(target);
for (i = 0; i < 32 ; i++)
buf[i] = current->thread.fpr[i][TS_VSRLOWOFFSET];
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
target->thread.fpr, 0, buf, 0, 32 * sizeof(double));
32 * sizeof(vector128));
return ret; return ret;
} }
...@@ -383,13 +385,16 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -383,13 +385,16 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf) const void *kbuf, const void __user *ubuf)
{ {
int ret; double buf[32];
int ret,i;
flush_vsx_to_thread(target); flush_vsx_to_thread(target);
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
target->thread.fpr, 0, buf, 0, 32 * sizeof(double));
32 * sizeof(vector128)); for (i = 0; i < 32 ; i++)
current->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i];
return ret; return ret;
} }
...@@ -499,8 +504,8 @@ static const struct user_regset native_regsets[] = { ...@@ -499,8 +504,8 @@ static const struct user_regset native_regsets[] = {
#endif #endif
#ifdef CONFIG_VSX #ifdef CONFIG_VSX
[REGSET_VSX] = { [REGSET_VSX] = {
.n = 32, .core_note_type = NT_PPC_VSX, .n = 32,
.size = sizeof(vector128), .align = sizeof(vector128), .size = sizeof(double), .align = sizeof(double),
.active = vsr_active, .get = vsr_get, .set = vsr_set .active = vsr_active, .get = vsr_get, .set = vsr_set
}, },
#endif #endif
......
...@@ -221,8 +221,8 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); ...@@ -221,8 +221,8 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
typedef elf_vrregset_t elf_fpxregset_t; typedef elf_vrregset_t elf_fpxregset_t;
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
extern int dump_task_vector(struct task_struct *, elf_vrregset_t *vrregs); extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_vector(tsk, regs) #define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX #define ELF_CORE_XFPREG_TYPE NT_PPC_VMX
#endif #endif
......
...@@ -358,6 +358,7 @@ typedef struct elf64_shdr { ...@@ -358,6 +358,7 @@ typedef struct elf64_shdr {
#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 */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
......
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