mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +00:00
parasite-syscall.c: moved the routine syscall_seized() into the file arch/x86/crtools.c.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
3b4aa70aef
commit
f032e67ae3
@@ -43,3 +43,31 @@ void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs)
|
|||||||
/* Make sure flags are in known state */
|
/* Make sure flags are in known state */
|
||||||
regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF | X86_EFLAGS_IF);
|
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;
|
||||||
|
}
|
||||||
|
@@ -69,4 +69,6 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
|
|||||||
unsigned long arg5,
|
unsigned long arg5,
|
||||||
unsigned long arg6);
|
unsigned long arg6);
|
||||||
|
|
||||||
|
extern int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *regs);
|
||||||
|
|
||||||
#endif /* __CR_PARASITE_SYSCALL_H__ */
|
#endif /* __CR_PARASITE_SYSCALL_H__ */
|
||||||
|
@@ -56,7 +56,7 @@ static struct vma_area *get_vma_by_ip(struct list_head *vma_area_list, unsigned
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* we run at @regs->ip */
|
/* 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;
|
siginfo_t siginfo;
|
||||||
int status;
|
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);
|
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,
|
static void *mmap_seized(struct parasite_ctl *ctl,
|
||||||
void *addr, size_t length, int prot,
|
void *addr, size_t length, int prot,
|
||||||
int flags, int fd, off_t offset)
|
int flags, int fd, off_t offset)
|
||||||
|
Reference in New Issue
Block a user