[CRIU] [PATCH 15/21] restore: split restore_gpregs on two parts

Andrey Vagin avagin at openvz.org
Fri May 24 08:20:18 EDT 2013


The first one fills sigframe and the second one restores another
registers.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 arch/arm/include/asm/restorer.h |  1 +
 arch/arm/restorer.c             |  5 +++++
 arch/x86/include/asm/restorer.h |  1 +
 arch/x86/restorer.c             | 11 ++++++++---
 pie/restorer.c                  |  3 +++
 5 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/restorer.h b/arch/arm/include/asm/restorer.h
index 56ea27d..11377e0 100644
--- a/arch/arm/include/asm/restorer.h
+++ b/arch/arm/include/asm/restorer.h
@@ -129,6 +129,7 @@ struct rt_sigframe {
 
 
 int restore_gpregs(struct rt_sigframe *f, UserArmRegsEntry *r);
+int restore_nonsigframe_gpregs(UserArmRegsEntry *r);
 
 int restore_fpu(struct rt_sigframe *sigframe, fpu_state_t *fpu_state);
 
diff --git a/arch/arm/restorer.c b/arch/arm/restorer.c
index cb7dc16..c5d603d 100644
--- a/arch/arm/restorer.c
+++ b/arch/arm/restorer.c
@@ -38,6 +38,11 @@ int restore_gpregs(struct rt_sigframe *f, UserArmRegsEntry *r)
 	return 0;
 }
 
+int restore_nonsigframe_gpregs(UserArmRegsEntry *r)
+{
+	return 0;
+}
+
 int restore_fpu(struct rt_sigframe *sigframe, fpu_state_t *fpu_state)
 {
 	struct aux_sigframe *aux = (struct aux_sigframe *)&sigframe->sig.uc.uc_regspace;
diff --git a/arch/x86/include/asm/restorer.h b/arch/x86/include/asm/restorer.h
index b70df0a..0558c41 100644
--- a/arch/x86/include/asm/restorer.h
+++ b/arch/x86/include/asm/restorer.h
@@ -135,6 +135,7 @@ struct rt_sigframe {
 
 
 int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r);
+int restore_nonsigframe_gpregs(UserX86RegsEntry *r);
 
 int restore_fpu(struct rt_sigframe *sigframe, fpu_state_t *fpu_state);
 
diff --git a/arch/x86/restorer.c b/arch/x86/restorer.c
index ef4a4c8..7c1c1e7 100644
--- a/arch/x86/restorer.c
+++ b/arch/x86/restorer.c
@@ -10,9 +10,6 @@
 
 int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
 {
-	long ret;
-	unsigned long fsgs_base;
-
 #define CPREG1(d)	f->uc.uc_mcontext.d = r->d
 #define CPREG2(d, s)	f->uc.uc_mcontext.d = r->s
 
@@ -38,6 +35,14 @@ int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
 	CPREG1(gs);
 	CPREG1(fs);
 
+	return 0;
+}
+
+int restore_nonsigframe_gpregs(UserX86RegsEntry *r)
+{
+	long ret;
+	unsigned long fsgs_base;
+
 	fsgs_base = r->fs_base;
 	ret = sys_arch_prctl(ARCH_SET_FS, fsgs_base);
 	if (ret) {
diff --git a/pie/restorer.c b/pie/restorer.c
index 0c80619..d7e00ec 100644
--- a/pie/restorer.c
+++ b/pie/restorer.c
@@ -269,6 +269,9 @@ static int restore_thread_common(struct rt_sigframe *sigframe,
 	if (restore_gpregs(sigframe, &args->gpregs))
 		return -1;
 
+	if (restore_nonsigframe_gpregs(&args->gpregs))
+		return -1;
+
 	restore_tls(args->tls);
 
 	return 0;
-- 
1.8.2



More information about the CRIU mailing list