Commit f50e0a6e authored by Laurent Dufour's avatar Laurent Dufour Committed by Pavel Emelyanov

ppc64: Fix buggy floating point register handling

The checkpoint and restore of the Power PC floating point registers is
buggy.

The issue is that the signal frame context is defined to store double value
while the protocol buffer is handling unsigned 64bits integer value. A
silent cast done by the compiler was modifying the restored value in our
back.

This fix changes the type used when manipulating the FP registers value to
be consistent between checkpoint and restart.
Signed-off-by: 's avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a26f1cd3
......@@ -118,7 +118,7 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
*/
static int get_fpu_regs(pid_t pid, CoreEntry *core)
{
elf_fpregset_t fpregs;
uint64_t fpregs[NFPREG];
UserPpc64FpstateEntry *fpe;
int i;
......@@ -140,7 +140,7 @@ static int get_fpu_regs(pid_t pid, CoreEntry *core)
}
/* FPSRC is the last (33th) register in the set */
for (i=0; i<NFPREG; i++)
for (i = 0; i < NFPREG; i++)
fpe->fpregs[i] = fpregs[i];
core->ti_ppc64->fpstate = fpe;
......@@ -150,9 +150,10 @@ static int get_fpu_regs(pid_t pid, CoreEntry *core)
static void put_fpu_regs(mcontext_t *mc, UserPpc64FpstateEntry *fpe)
{
int i;
uint64_t *mcfp = (uint64_t *)mc->fp_regs;
for (i=0; i<fpe->n_fpregs; i++)
mc->fp_regs[i] = (double)(fpe->fpregs[i]);
for (i = 0; i < fpe->n_fpregs; i++)
mcfp[i] = fpe->fpregs[i];
}
int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
......
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