[CRIU] [PATCH 05/22] parasite-syscall.c: moved the routine syscall_seized() into the file arch/x86/crtools.c
Alexander Kartashov
alekskartashov at parallels.com
Thu Dec 27 01:50:56 EST 2012
Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
arch/x86/crtools.c | 30 ++++++++++++++++++++++++++++++
parasite-syscall.c | 30 +-----------------------------
2 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
index cb72a23..07615a8 100644
--- a/arch/x86/crtools.c
+++ b/arch/x86/crtools.c
@@ -15,6 +15,8 @@
#include "fpu.h"
#include "elf.h"
+extern int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs);
+
void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs)
{
regs->ip = new_ip;
@@ -25,3 +27,31 @@ void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs)
/* Make sure flags are in known state */
regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF);
}
+
+int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
+ unsigned long arg1,
+ unsigned long arg2,
+ unsigned long arg3,
+ unsigned long arg4,
+ unsigned long arg5,
+ unsigned long arg6)
+{
+ user_regs_struct_t regs = ctl->regs_orig;
+ int err;
+
+ regs.ax = (unsigned long)nr;
+ regs.di = arg1;
+ regs.si = arg2;
+ regs.dx = arg3;
+ regs.r10 = arg4;
+ regs.r8 = arg5;
+ regs.r9 = arg6;
+
+ parasite_setup_regs(ctl->syscall_ip, ®s);
+ err = __parasite_execute(ctl, ctl->pid, ®s);
+ if (err)
+ return err;
+
+ *ret = regs.ax;
+ return 0;
+}
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 3d39fb0..85b7db6 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -56,7 +56,7 @@ static struct vma_area *get_vma_by_ip(struct list_head *vma_area_list, unsigned
}
/* we run at @regs->ip */
-static int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs)
+int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs)
{
siginfo_t siginfo;
int status;
@@ -230,34 +230,6 @@ static int parasite_execute(unsigned int cmd, struct parasite_ctl *ctl)
return parasite_execute_by_pid(cmd, ctl, ctl->pid);
}
-int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
- unsigned long arg1,
- unsigned long arg2,
- unsigned long arg3,
- unsigned long arg4,
- unsigned long arg5,
- unsigned long arg6)
-{
- user_regs_struct_t regs = ctl->regs_orig;
- int err;
-
- regs.ax = (unsigned long)nr;
- regs.di = arg1;
- regs.si = arg2;
- regs.dx = arg3;
- regs.r10 = arg4;
- regs.r8 = arg5;
- regs.r9 = arg6;
-
- parasite_setup_regs(ctl->syscall_ip, ®s);
- err = __parasite_execute(ctl, ctl->pid, ®s);
- if (err)
- return err;
-
- *ret = regs.ax;
- return 0;
-}
-
static void *mmap_seized(struct parasite_ctl *ctl,
void *addr, size_t length, int prot,
int flags, int fd, off_t offset)
--
1.7.10.4
More information about the CRIU
mailing list