[CRIU] [PATCH 06/44] parasite-syscall.c: moved the routine parasite_setup_regs() to the file arch/x86/crtools.c.
Alexander Kartashov
alekskartashov at parallels.com
Mon Jan 7 10:04:35 EST 2013
Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
arch/x86/crtools.c | 27 +++++++++++++++++++++++++++
arch/x86/include/asm/parasite-syscall.h | 6 ++++++
parasite-syscall.c | 12 ------------
3 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
index 1f6fd14..323cf49 100644
--- a/arch/x86/crtools.c
+++ b/arch/x86/crtools.c
@@ -1,7 +1,23 @@
+#include <string.h>
+#include <unistd.h>
+
#include "asm/types.h"
#include "compiler.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"
#include "parasite-syscall.h"
+
/*
* Injected syscall instruction
*/
@@ -16,3 +32,14 @@ static inline void __check_code_syscall(void) {
BUILD_BUG_ON(sizeof(code_syscall) != BUILTIN_SYSCALL_SIZE);
BUILD_BUG_ON(!is_log2(sizeof(code_syscall)));
}
+
+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 df7f6ef..d517a42 100644
--- a/arch/x86/include/asm/parasite-syscall.h
+++ b/arch/x86/include/asm/parasite-syscall.h
@@ -4,4 +4,10 @@
extern const char code_syscall[];
extern const int code_syscall_size;
+
+/*
+ * 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 88e2ce7..9d30f89 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -54,18 +54,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