|
@@ -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);
|
|
|
|
- memcpy(vrregs, ¤t->thread.vr[0], sizeof(*vrregs));
|
|
|
|
|
|
+ /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
|
|
|
|
+ * 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 */
|