[CRIU] [PATCH 07/44] parasite-syscall.c: moved the routine syscall_seized() into the file arch/x86/crtools.c.
Alexander Kartashov
alekskartashov at parallels.com
Mon Jan 7 10:04:36 EST 2013
Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
arch/x86/crtools.c | 30 ++++++++++++++++++++++++++++++
include/parasite-syscall.h | 2 ++
parasite-syscall.c | 30 +-----------------------------
3 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
index 323cf49..c630ac3 100644
--- a/arch/x86/crtools.c
+++ b/arch/x86/crtools.c
@@ -33,6 +33,7 @@ static inline void __check_code_syscall(void) {
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;
@@ -43,3 +44,32 @@ 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/include/parasite-syscall.h b/include/parasite-syscall.h
index 6b0d659..cccd678 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -69,4 +69,6 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
unsigned long arg5,
unsigned long arg6);
+extern int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs);
+
#endif /* __CR_PARASITE_SYSCALL_H__ */
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 9d30f89..cb8581d 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -55,7 +55,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;
@@ -229,34 +229,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