[CRIU] [PATCH 3/6] arm: don't copy the FPU frame to/from CoreEntry with a single memcpy()

Alexander Kartashov alekskartashov at parallels.com
Tue Oct 8 00:45:35 PDT 2013


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..e10f70b 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 < 32; ++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 < 32; ++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;
 }
 
-- 
1.7.9.5



More information about the CRIU mailing list