[CRIU] [PATCH 3/4] cr: introduced the macro REG_SYSCALL_NR

Andrew Vagin avagin at parallels.com
Fri May 31 06:48:24 EDT 2013


Acked-by: Andrew Vagin <avagin at parallels.com>

On Fri, May 31, 2013 at 09:20:47AM +0400, Alexander Kartashov wrote:
> The macro REG_SYSCALL_NR is designated to get the value of the CPU register
> storing syscall number in a machine-independent way.
> 
> Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
> Cc: Andrey Vagin <avagin at openvz.org>
> ---
>  arch/arm/include/asm/types.h |    1 +
>  arch/x86/include/asm/types.h |    1 +
>  parasite-syscall.c           |    4 ++--
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
> index 2e5fa9c..3d917f8 100644
> --- a/arch/arm/include/asm/types.h
> +++ b/arch/arm/include/asm/types.h
> @@ -209,6 +209,7 @@ typedef struct {
>  
>  #define REG_RES(regs) ((regs).ARM_r0)
>  #define REG_IP(regs)  ((regs).ARM_pc)
> +#define REG_SYSCALL_NR(regs) ((regs).ARM_r7)
>  
>  #define TASK_SIZE 0xbf000000
>  
> diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
> index e7b0e2d..5bf0fa5 100644
> --- a/arch/x86/include/asm/types.h
> +++ b/arch/x86/include/asm/types.h
> @@ -237,6 +237,7 @@ typedef uint64_t auxv_t;
>  
>  #define REG_RES(regs) ((regs).ax)
>  #define REG_IP(regs)  ((regs).ip)
> +#define REG_SYSCALL_NR(regs)	((regs).orig_ax)
>  
>  #define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__X86_64
>  
> diff --git a/parasite-syscall.c b/parasite-syscall.c
> index ff9436c..e41096a 100644
> --- a/parasite-syscall.c
> +++ b/parasite-syscall.c
> @@ -864,8 +864,8 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)
>  			return -1;
>  		}
>  
> -		pr_debug("%d is going to execute the syscall %lx\n", pid, regs.orig_ax);
> -		if (regs.orig_ax == __NR_rt_sigreturn) {
> +		pr_debug("%d is going to execute the syscall %lx\n", pid, REG_SYSCALL_NR(regs));
> +		if (REG_SYSCALL_NR(regs) == __NR_rt_sigreturn) {
>  			pr_debug("%d was stopped\n", pid);
>  			break;
>  		}
> -- 
> 1.7.10.4
> 


More information about the CRIU mailing list