[CRIU] [PATCH 03/22] parasite-syscall.c: moved the syscall instructions into the file arch/x86/include/asm/parasite-syscall.h
Pavel Emelyanov
xemul at parallels.com
Fri Dec 28 03:45:06 EST 2012
On 12/27/2012 10:50 AM, Alexander Kartashov wrote:
>
> Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
> ---
> arch/x86/include/asm/parasite-syscall.h | 13 +++++++++++++
> parasite-syscall.c | 7 +------
> 2 files changed, 14 insertions(+), 6 deletions(-)
> create mode 100644 arch/x86/include/asm/parasite-syscall.h
>
> diff --git a/arch/x86/include/asm/parasite-syscall.h b/arch/x86/include/asm/parasite-syscall.h
> new file mode 100644
> index 0000000..6e4996c
> --- /dev/null
> +++ b/arch/x86/include/asm/parasite-syscall.h
> @@ -0,0 +1,13 @@
> +#ifndef __CR_ASM_PARASITE_SYSCALL_H__
> +#define __CR_ASM_PARASITE_SYSCALL_H__
> +
> +/*
> + * Injected syscall instruction
> + */
> +
> +static const char code_syscall[] = {
> + 0x0f, 0x05, /* syscall */
> + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
> +};
NAK. Placing variables into headers is bad.
Your idea (as I see it) is make $ARCH_DIR/crtools.o be linked into crtools
binary, $ARCH_DIR/restorer.o -- to restorer blob and $ARCH_DIR/parasite-head.o
to parasite blob. This is OK. Let's introduce the $ARCH_DIR/parasite.o that
will be linked to parasite blob and put this one there. This will affect the
patch #2.
> +
> +#endif
> diff --git a/parasite-syscall.c b/parasite-syscall.c
> index 26de3ad..66031da 100644
> --- a/parasite-syscall.c
> +++ b/parasite-syscall.c
> @@ -22,9 +22,7 @@
> #include <string.h>
> #include <stdlib.h>
>
> -#ifdef CONFIG_X86_64
> -static const char code_syscall[] = {0x0f, 0x05, 0xcc, 0xcc,
> - 0xcc, 0xcc, 0xcc, 0xcc};
> +#include "asm/parasite-syscall.h"
>
> #define code_syscall_size (round_up(sizeof(code_syscall), sizeof(long)))
> #define parasite_size (round_up(sizeof(parasite_blob), sizeof(long)))
> @@ -896,6 +894,3 @@ err_restore:
> return NULL;
> }
>
> -#else /* CONFIG_X86_64 */
> -# error x86-32 is not yet implemented
> -#endif /* CONFIG_X86_64 */
>
More information about the CRIU
mailing list