Commit 7dce5025 authored by Laurent Dufour's avatar Laurent Dufour Committed by Pavel Emelyanov

ppc64: introduces NVSXREG constant

The new constant NVSXREG is defining the number of double word needed
to be save to get the remaining part of the VSX registers to be save.

A major part of the VSX registers is saved when saving FPU and Altivec
registers.
Signed-off-by: 's avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Reviewed-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent a64319bf
...@@ -116,7 +116,13 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret, ...@@ -116,7 +116,13 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
* *
* PTRACE_GETVSRREGS and PTRACE_GETFPREGS are required since we need * PTRACE_GETVSRREGS and PTRACE_GETFPREGS are required since we need
* to save FPSCR too. * to save FPSCR too.
*
* There 32 VSX double word registers to save since the 32 first VSX double
* word registers are saved through FPR[0..32] and the remaining registers
* are saved when saving the Altivec registers VR[0..32].
*/ */
#define NVSXREG 32
static int get_fpu_regs(pid_t pid, CoreEntry *core) static int get_fpu_regs(pid_t pid, CoreEntry *core)
{ {
uint64_t fpregs[NFPREG]; uint64_t fpregs[NFPREG];
...@@ -260,7 +266,7 @@ static int put_altivec_regs(mcontext_t *mc, UserPpc64VrstateEntry *vse) ...@@ -260,7 +266,7 @@ static int put_altivec_regs(mcontext_t *mc, UserPpc64VrstateEntry *vse)
static int get_vsx_regs(pid_t pid, CoreEntry *core) static int get_vsx_regs(pid_t pid, CoreEntry *core)
{ {
UserPpc64VsxstateEntry *vse; UserPpc64VsxstateEntry *vse;
uint64_t vsregs[32]; uint64_t vsregs[NVSXREG];
int i; int i;
if (ptrace(PTRACE_GETVSRREGS, pid, 0, (void*)&vsregs) < 0) { if (ptrace(PTRACE_GETVSRREGS, pid, 0, (void*)&vsregs) < 0) {
...@@ -283,7 +289,7 @@ static int get_vsx_regs(pid_t pid, CoreEntry *core) ...@@ -283,7 +289,7 @@ static int get_vsx_regs(pid_t pid, CoreEntry *core)
return -1; return -1;
user_ppc64_vsxstate_entry__init(vse); user_ppc64_vsxstate_entry__init(vse);
vse->n_vsxregs = 32; vse->n_vsxregs = NVSXREG;
vse->vsxregs = xmalloc(vse->n_vsxregs * sizeof(vse->vsxregs[0])); vse->vsxregs = xmalloc(vse->n_vsxregs * sizeof(vse->vsxregs[0]));
if (!vse->vsxregs) { if (!vse->vsxregs) {
xfree(vse); xfree(vse);
...@@ -319,7 +325,7 @@ static int put_vsx_regs(mcontext_t *mc, UserPpc64VsxstateEntry *vse) ...@@ -319,7 +325,7 @@ static int put_vsx_regs(mcontext_t *mc, UserPpc64VsxstateEntry *vse)
buf = (uint64_t*) (mc->v_regs + 1); buf = (uint64_t*) (mc->v_regs + 1);
/* Copy the value saved by get_vsx_regs in the sigframe */ /* Copy the value saved by get_vsx_regs in the sigframe */
for (i=0; i<vse->n_vsxregs; i++) for (i=0; i < vse->n_vsxregs; i++)
buf[i] = vse->vsxregs[i]; buf[i] = vse->vsxregs[i];
return 0; return 0;
......
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