[CRIU] [PATCH 5/7] arm: don't copy the FPU frame to/from CoreEntry with a single memcpy()
Pavel Emelyanov
xemul at parallels.com
Thu Oct 10 01:44:56 PDT 2013
On 10/09/2013 09:23 PM, Alexander Kartashov wrote:
What's the justification for this?
> Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
> ---
> arch/arm/crtools.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/crtools.c b/arch/arm/crtools.c
> index db02fce..cf9b016 100644
> --- a/arch/arm/crtools.c
> +++ b/arch/arm/crtools.c
> @@ -86,6 +86,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
> {
> struct user_vfp vfp;
> int ret = -1;
> + int i;
>
> pr_info("Dumping GP/FPU registers for %d\n", pid);
>
> @@ -136,7 +137,8 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
>
> // Save the VFP state
>
> - memcpy(CORE_THREAD_ARCH_INFO(core)->fpstate->vfp_regs, &vfp.fpregs, sizeof(vfp.fpregs));
> + for (i = 0; i < ARRAY_SIZE(vfp.fpregs); ++i)
> + CORE_THREAD_ARCH_INFO(core)->fpstate->vfp_regs[i] = vfp.fpregs[i];
> CORE_THREAD_ARCH_INFO(core)->fpstate->fpscr = vfp.fpscr;
>
> ret = 0;
> @@ -192,11 +194,12 @@ void arch_free_thread_info(CoreEntry *core)
> int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
> {
> struct aux_sigframe *aux = (struct aux_sigframe *)&sigframe->sig.uc.uc_regspace;
> - fpu_state_t *fpu_state = &sigframe->fpu_state;
> -
> - memcpy(&aux->vfp.ufp, CORE_THREAD_ARCH_INFO(core)->fpstate->vfp_regs, sizeof(aux->vfp.ufp));
> - fpu_state->ufp.fpscr = CORE_THREAD_ARCH_INFO(core)->fpstate->fpscr;
> + struct vfp_sigframe *vfp = &aux->vfp;
> + int i;
>
> + for (i = 0; i < ARRAY_SIZE(vfp->ufp.fpregs); ++i)
> + vfp->ufp.fpregs[i] = CORE_THREAD_ARCH_INFO(core)->fpstate->vfp_regs[i];
> + vfp->ufp.fpscr = CORE_THREAD_ARCH_INFO(core)->fpstate->fpscr;
> return 0;
> }
>
>
More information about the CRIU
mailing list