[CRIU] [PATCH v2] parasite-syscall: make code_syscall local

Dmitry Safonov dsafonov at virtuozzo.com
Wed Mar 16 08:05:52 PDT 2016


I think, we may safetly remove this export, as code_syscall
is used only in one function, which now will have it as a parameter.

This will reduce arch-depended code coupling a little.

(and I also interested in this because of I need __parasite_execute_syscall
to execute 32-bit syscall code on x86_64, which I prefer to leave without
some CONFIG_X86_64 as it's generic code)

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
v2: left code_syscall_size global

 criu/arch/aarch64/crtools.c                      | 2 +-
 criu/arch/aarch64/include/asm/parasite-syscall.h | 1 -
 criu/arch/arm/crtools.c                          | 2 +-
 criu/arch/arm/include/asm/parasite-syscall.h     | 1 -
 criu/arch/ppc64/crtools.c                        | 2 +-
 criu/arch/ppc64/include/asm/parasite-syscall.h   | 1 -
 criu/arch/x86/crtools.c                          | 2 +-
 criu/arch/x86/include/asm/parasite-syscall.h     | 1 -
 criu/include/parasite-syscall.h                  | 2 +-
 criu/parasite-syscall.c                          | 3 ++-
 10 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/criu/arch/aarch64/crtools.c b/criu/arch/aarch64/crtools.c
index 7a25106..f56b864 100644
--- a/criu/arch/aarch64/crtools.c
+++ b/criu/arch/aarch64/crtools.c
@@ -71,7 +71,7 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
 	regs.regs[6] = 0;
 	regs.regs[7] = 0;
 
-	err = __parasite_execute_syscall(ctl, &regs);
+	err = __parasite_execute_syscall(ctl, &regs, code_syscall);
 
 	*ret = regs.regs[0];
 	return err;
diff --git a/criu/arch/aarch64/include/asm/parasite-syscall.h b/criu/arch/aarch64/include/asm/parasite-syscall.h
index 0c07121..60bd6e2 100644
--- a/criu/arch/aarch64/include/asm/parasite-syscall.h
+++ b/criu/arch/aarch64/include/asm/parasite-syscall.h
@@ -6,7 +6,6 @@ struct parasite_ctl;
 #define ARCH_SI_TRAP TRAP_BRKPT
 
 
-extern const char code_syscall[];
 extern const int code_syscall_size;
 
 void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);
diff --git a/criu/arch/arm/crtools.c b/criu/arch/arm/crtools.c
index 9588990..a82e9ef 100644
--- a/criu/arch/arm/crtools.c
+++ b/criu/arch/arm/crtools.c
@@ -73,7 +73,7 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
 	regs.ARM_r4 = arg5;
 	regs.ARM_r5 = arg6;
 
-	err = __parasite_execute_syscall(ctl, &regs);
+	err = __parasite_execute_syscall(ctl, &regs, code_syscall);
 
 	*ret = regs.ARM_r0;
 	return err;
diff --git a/criu/arch/arm/include/asm/parasite-syscall.h b/criu/arch/arm/include/asm/parasite-syscall.h
index 0c66bf9..0dd6efa 100644
--- a/criu/arch/arm/include/asm/parasite-syscall.h
+++ b/criu/arch/arm/include/asm/parasite-syscall.h
@@ -5,7 +5,6 @@
 #define ARCH_SI_TRAP TRAP_BRKPT
 
 
-extern const char code_syscall[];
 extern const int code_syscall_size;
 
 
diff --git a/criu/arch/ppc64/crtools.c b/criu/arch/ppc64/crtools.c
index 14b1e7c..9ed377e 100644
--- a/criu/arch/ppc64/crtools.c
+++ b/criu/arch/ppc64/crtools.c
@@ -80,7 +80,7 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
 	regs.gpr[7] = arg5;
 	regs.gpr[8] = arg6;
 
-	err = __parasite_execute_syscall(ctl, &regs);
+	err = __parasite_execute_syscall(ctl, &regs, code_syscall);
 
 	*ret = regs.gpr[3];
 	return err;
diff --git a/criu/arch/ppc64/include/asm/parasite-syscall.h b/criu/arch/ppc64/include/asm/parasite-syscall.h
index 7665e20..676749d 100644
--- a/criu/arch/ppc64/include/asm/parasite-syscall.h
+++ b/criu/arch/ppc64/include/asm/parasite-syscall.h
@@ -5,7 +5,6 @@ struct parasite_ctl;
 
 #define ARCH_SI_TRAP TRAP_BRKPT
 
-extern const char code_syscall[];
 extern const int code_syscall_size;
 
 void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);
diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
index 1c43ab1..83d3c8e 100644
--- a/criu/arch/x86/crtools.c
+++ b/criu/arch/x86/crtools.c
@@ -103,7 +103,7 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
 	regs.r8  = arg5;
 	regs.r9  = arg6;
 
-	err = __parasite_execute_syscall(ctl, &regs);
+	err = __parasite_execute_syscall(ctl, &regs, code_syscall);
 
 	*ret = regs.ax;
 	return err;
diff --git a/criu/arch/x86/include/asm/parasite-syscall.h b/criu/arch/x86/include/asm/parasite-syscall.h
index 4d56cb0..9cd698c 100644
--- a/criu/arch/x86/include/asm/parasite-syscall.h
+++ b/criu/arch/x86/include/asm/parasite-syscall.h
@@ -8,7 +8,6 @@ struct parasite_ctl;
 #define ARCH_SI_TRAP SI_KERNEL
 
 
-extern const char code_syscall[];
 extern const int code_syscall_size;
 
 void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);
diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index 5ed8e35..04d2602 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -119,7 +119,7 @@ extern int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
 			  unsigned long arg5, unsigned long arg6);
 
 extern int __parasite_execute_syscall(struct parasite_ctl *ctl,
-				user_regs_struct_t *regs);
+		user_regs_struct_t *regs, const char *code_syscall);
 extern bool arch_can_dump_task(pid_t pid);
 
 /*
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index bcdadcb..4bcccb1 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -210,7 +210,8 @@ err:
 	return ret;
 }
 
-int __parasite_execute_syscall(struct parasite_ctl *ctl, user_regs_struct_t *regs)
+int __parasite_execute_syscall(struct parasite_ctl *ctl,
+		user_regs_struct_t *regs, const char *code_syscall)
 {
 	pid_t pid = ctl->pid.real;
 	int err;
-- 
2.7.2



More information about the CRIU mailing list