[CRIU] [PATCH 10/22] restorer: moved the routine restore_fpu() to the file arch/x86/crtools.c

Alexander Kartashov alekskartashov at parallels.com
Thu Dec 27 01:51:01 EST 2012


Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/x86/include/asm/restorer.h |    2 ++
 arch/x86/restorer.c             |   18 ++++++++++++++++++
 pie/restorer.c                  |   16 ----------------
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/include/asm/restorer.h b/arch/x86/include/asm/restorer.h
index a4e8366..edbcae2 100644
--- a/arch/x86/include/asm/restorer.h
+++ b/arch/x86/include/asm/restorer.h
@@ -73,4 +73,6 @@ struct rt_sigframe {
 
 int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r);
 
+int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args);
+
 #endif
diff --git a/arch/x86/restorer.c b/arch/x86/restorer.c
index 599ab8c..df42c27 100644
--- a/arch/x86/restorer.c
+++ b/arch/x86/restorer.c
@@ -5,6 +5,8 @@
 
 #include "syscall.h"
 #include "log.h"
+#include "fpu.h"
+#include "cpu.h"
 
 int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
 {
@@ -52,3 +54,19 @@ int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
 
 	return 0;
 }
+
+int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args)
+{
+	if (args->has_fpu) {
+		unsigned long addr = (unsigned long)(void *)&args->xsave;
+
+		if ((addr % 64ul) == 0ul) {
+			sigframe->uc.uc_mcontext.fpstate = &args->xsave;
+		} else {
+			pr_err("Unaligned address passed: %lx\n", addr);
+			return -1;
+		}
+	}
+
+	return 0;
+}
diff --git a/pie/restorer.c b/pie/restorer.c
index 299657a..dab1450 100644
--- a/pie/restorer.c
+++ b/pie/restorer.c
@@ -143,22 +143,6 @@ static void restore_sched_info(struct rst_sched_param *p)
 	sys_sched_setscheduler(0, p->policy, &parm);
 }
 
-static int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args)
-{
-	if (args->has_fpu) {
-		unsigned long addr = (unsigned long)(void *)&args->xsave;
-
-		if ((addr % 64ul) == 0ul) {
-			sigframe->uc.uc_mcontext.fpstate = &args->xsave;
-		} else {
-			pr_err("Unaligned address passed: %lx\n", addr);
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
 static int restore_thread_common(struct rt_sigframe *sigframe,
 		struct thread_restore_args *args)
 {
-- 
1.7.10.4



More information about the CRIU mailing list