From 3b4aa70aefc7a69ce1a28e70be6e9a2bc9792d7c Mon Sep 17 00:00:00 2001 From: Alexander Kartashov Date: Wed, 9 Jan 2013 17:26:41 +0400 Subject: [PATCH] parasite-syscall.c: moved the routine parasite_setup_regs() to the file arch/x86/crtools.c. Signed-off-by: Alexander Kartashov Signed-off-by: Pavel Emelyanov --- arch/x86/crtools.c | 26 +++++++++++++++++++++++++ arch/x86/include/asm/parasite-syscall.h | 2 ++ parasite-syscall.c | 12 ------------ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c index 3a8d28ba7..20c55197b 100644 --- a/arch/x86/crtools.c +++ b/arch/x86/crtools.c @@ -1,5 +1,20 @@ +#include +#include + #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" /* @@ -17,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 df7f6ef53..dd5622a92 100644 --- a/arch/x86/include/asm/parasite-syscall.h +++ b/arch/x86/include/asm/parasite-syscall.h @@ -4,4 +4,6 @@ extern const char code_syscall[]; extern const int code_syscall_size; +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 e5d132656..e792ad0a5 100644 --- a/parasite-syscall.c +++ b/parasite-syscall.c @@ -55,18 +55,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) {