[CRIU] [PATCH 01/20] x86: moved x86-specific files into the directory arch/x86.

Stanislav Kinsbursky skinsbursky at parallels.com
Thu Dec 13 07:32:02 EST 2012


12.12.2012 17:34, alekskartashov at parallels.com пишет:

>
> diff --git a/arch/x86/Makefile.inc b/arch/x86/Makefile.inc
> new file mode 100644
> index 0000000..b63bd25
> --- /dev/null
> +++ b/arch/x86/Makefile.inc
> @@ -0,0 +1,7 @@
> +DEFINES   += -DCONFIG_X86_64
> +ARCH_BITS := 64
> +
> +CC 	 := gcc
> +LD 	 := ld
> +OBJCOPY	 := objcopy
> +LDARCH	 := i386:x86-64

Why do you need this file?
All these defines should be exported from global Makefile.

> diff --git a/arch/x86/arch_parasite.h b/arch/x86/arch_parasite.h
> new file mode 100644
> index 0000000..c45b185
> --- /dev/null
> +++ b/arch/x86/arch_parasite.h
> @@ -0,0 +1,6 @@
> +#ifndef X86_64_PARASITE_H__
> +#define X86_64_PARASITE_H__
> +
> +/* No x86_64 specific parasite code yet */
> +
> +#endif

Why this empty file is required?

> diff --git a/arch/x86/memcpy_64.h b/arch/x86/memcpy_64.h
> new file mode 100644
> index 0000000..531b68f
> --- /dev/null
> +++ b/arch/x86/memcpy_64.h
> @@ -0,0 +1,22 @@
> +#ifndef __MEMCPY_64_H__
> +#define __MEMCPY_64_H__
> +
> +#include "compiler.h"
> +#include "types.h"
> +
> +static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n)
> +{
> +	int d0, d1, d2;
> +	asm volatile("rep ; movsl		\n"
> +		     "movl %4,%%ecx		\n"
> +		     "andl $3,%%ecx		\n"
> +		     "jz 1f			\n"
> +		     "rep ; movsb		\n"
> +		     "1:"
> +		     : "=&c" (d0), "=&D" (d1), "=&S" (d2)
> +		     : "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from)
> +		     : "memory");
> +	return to;
> +}
> +

I think, it's better to introduce one per-arch library file and move all this arch-specific code there instead of adding one file per function.


-- 
Best regards,
Stanislav Kinsbursky



More information about the CRIU mailing list