Commit f032e67a authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

parasite-syscall.c: moved the routine syscall_seized() into the file arch/x86/crtools.c.

Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3b4aa70a
...@@ -43,3 +43,31 @@ void parasite_setup_regs(unsigned long new_ip, user_regs_struct_t *regs) ...@@ -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, &regs);
err = __parasite_execute(ctl, ctl->pid, &regs);
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, ...@@ -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 ...@@ -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) ...@@ -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, &regs);
err = __parasite_execute(ctl, ctl->pid, &regs);
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment