[CRIU] [PATCH 04/22] parasite-syscall.c: moved the routine parasite_setup_regs() to the file arch/x86/crtools.c

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


Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/x86/crtools.c                      |   27 +++++++++++++++++++++++++++
 arch/x86/include/asm/parasite-syscall.h |    7 +++++++
 parasite-syscall.c                      |   12 ------------
 3 files changed, 34 insertions(+), 12 deletions(-)
 create mode 100644 arch/x86/crtools.c

diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
new file mode 100644
index 0000000..cb72a23
--- /dev/null
+++ b/arch/x86/crtools.c
@@ -0,0 +1,27 @@
+#include <string.h>
+#include <unistd.h>
+
+#include "asm/types.h"
+#include "ptrace.h"
+#include "asm/processor-flags.h"
+#include "protobuf.h"
+#include "../protobuf/core.pb-c.h"
+#include "../protobuf/creds.pb-c.h"
+#include "parasite-syscall.h"
+#include "syscall.h"
+#include "log.h"
+#include "util.h"
+#include "cpu.h"
+#include "fpu.h"
+#include "elf.h"
+
+void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs)
+{
+	regs->ip = new_ip;
+
+	/* Avoid end of syscall processing */
+	regs->orig_ax = -1;
+
+	/* Make sure flags are in known state */
+	regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF);
+}
diff --git a/arch/x86/include/asm/parasite-syscall.h b/arch/x86/include/asm/parasite-syscall.h
index 6e4996c..f3bd363 100644
--- a/arch/x86/include/asm/parasite-syscall.h
+++ b/arch/x86/include/asm/parasite-syscall.h
@@ -10,4 +10,11 @@ static const char code_syscall[] = {
         0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc   /* int 3, ... */
 };
 
+
+/*
+ * The x86-64-specific parasite setup
+ */
+
+void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs);
+
 #endif
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 66031da..3d39fb0 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -55,18 +55,6 @@ static struct vma_area *get_vma_by_ip(struct list_head *vma_area_list, unsigned
 	return NULL;
 }
 
-/* Note it's destructive on @regs */
-static void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs)
-{
-	regs->ip = new_ip;
-
-	/* Avoid end of syscall processing */
-	regs->orig_ax = -1;
-
-	/* Make sure flags are in known state */
-	regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF);
-}
-
 /* we run at @regs->ip */
 static int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs)
 {
-- 
1.7.10.4



More information about the CRIU mailing list