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

Pavel Emelyanov xemul at parallels.com
Wed Jan 9 06:15:43 EST 2013


On 01/07/2013 07:04 PM, Alexander Kartashov wrote:

You forgot to ask git preserve rename info.

> * The following files goes into the directory arch/x86/include/asm unmodified:
>   - include/atomic.h,
>   - include/linkage.h,
>   - include/memcpy_64.h,
>   - include/types.h,
>   - include/bitops.h,
>   - pie/parasite-head-x86-64.S,
>   - include/processor-flags.h,
>   - include/syscall-x86-64.def.
> 
> * Changed include directives in the source files that include the headers
>   listed above.
> 
> * Modified build scripts to reflect the source moves.
> 
> Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
> ---
>  Makefile                               |    5 +-
>  arch/x86/Makefile                      |    3 +-
>  arch/x86/include/asm/atomic.h          |   60 ++++++++
>  arch/x86/include/asm/bitops.h          |  118 +++++++++++++++
>  arch/x86/include/asm/linkage.h         |   24 ++++
>  arch/x86/include/asm/memcpy_64.h       |   22 +++
>  arch/x86/include/asm/processor-flags.h |   28 ++++
>  arch/x86/include/asm/types.h           |  248 ++++++++++++++++++++++++++++++++
>  arch/x86/parasite-head.S               |   24 ++++
>  arch/x86/syscall-common-x86-64.S       |    2 +-
>  arch/x86/syscall-x86-64.def            |   76 ++++++++++
>  cpu.c                                  |    4 +-
>  cr-dump.c                              |    2 +-
>  cr-restore.c                           |    2 +-
>  cr-show.c                              |    2 +-
>  crtools.c                              |    2 +-
>  eventfd.c                              |    2 +-
>  eventpoll.c                            |    2 +-
>  file-ids.c                             |    2 +-
>  files-reg.c                            |    2 +-
>  include/atomic.h                       |   60 --------
>  include/bitops.h                       |  118 ---------------
>  include/cpu.h                          |    2 +-
>  include/crtools.h                      |    2 +-
>  include/eventfd.h                      |    2 +-
>  include/eventpoll.h                    |    2 +-
>  include/file-ids.h                     |    2 +-
>  include/files-reg.h                    |    2 +-
>  include/files.h                        |    2 +-
>  include/fpu.h                          |    2 +-
>  include/image.h                        |    2 +-
>  include/inotify.h                      |    2 +-
>  include/linkage.h                      |   24 ----
>  include/lock.h                         |    4 +-
>  include/memcpy_64.h                    |   22 ---
>  include/proc_parse.h                   |    2 +-
>  include/processor-flags.h              |   28 ----
>  include/protobuf.h                     |    2 +-
>  include/rbtree.h                       |    2 +-
>  include/restorer.h                     |    2 +-
>  include/sk-queue.h                     |    2 +-
>  include/sockets.h                      |    2 +-
>  include/syscall-types.h                |    2 +-
>  include/syscall-x86-64.def             |   76 ----------
>  include/types.h                        |  248 --------------------------------
>  include/unix_diag.h                    |    2 +-
>  include/util.h                         |    2 +-
>  inotify.c                              |    2 +-
>  kcmp-ids.c                             |    2 +-
>  log.c                                  |    2 +-
>  mount.c                                |    2 +-
>  netfilter.c                            |    2 +-
>  parasite-syscall.c                     |    2 +-
>  pie/Makefile                           |    2 +-
>  pie/parasite-head-x86-64.S             |   24 ----
>  pie/restorer.c                         |    2 +-
>  proc_parse.c                           |    2 +-
>  protobuf.c                             |    2 +-
>  ptrace.c                               |    2 +-
>  signalfd.c                             |    2 +-
>  sk-inet.c                              |    2 +-
>  sk-packet.c                            |    2 +-
>  sk-queue.c                             |    2 +-
>  sk-tcp.c                               |    2 +-
>  sk-unix.c                              |    2 +-
>  sysctl.c                               |    2 +-
>  tty.c                                  |    2 +-
>  util-net.c                             |    4 +-
>  util.c                                 |    2 +-
>  69 files changed, 659 insertions(+), 657 deletions(-)
>  create mode 100644 arch/x86/include/asm/atomic.h
>  create mode 100644 arch/x86/include/asm/bitops.h
>  create mode 100644 arch/x86/include/asm/linkage.h
>  create mode 100644 arch/x86/include/asm/memcpy_64.h
>  create mode 100644 arch/x86/include/asm/processor-flags.h
>  create mode 100644 arch/x86/include/asm/types.h
>  create mode 100644 arch/x86/parasite-head.S
>  create mode 100644 arch/x86/syscall-x86-64.def
>  delete mode 100644 include/atomic.h
>  delete mode 100644 include/bitops.h
>  delete mode 100644 include/linkage.h
>  delete mode 100644 include/memcpy_64.h
>  delete mode 100644 include/processor-flags.h
>  delete mode 100644 include/syscall-x86-64.def
>  delete mode 100644 include/types.h
>  delete mode 100644 pie/parasite-head-x86-64.S
> 
> diff --git a/Makefile b/Makefile
> index 186c998..fff8738 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -41,8 +41,9 @@ ifeq ($(uname_M),x86_64)
>  endif
>  
>  SRC_DIR		?= $(shell pwd)
> +ARCH_DIR	:= $(SRC_DIR)/arch/$(ARCH)
>  
> -CFLAGS		= -I$(SRC_DIR)/include -I$(SRC_DIR)/pie -I$(SRC_DIR)/arch/$(ARCH)/ -fno-strict-aliasing
> +CFLAGS		+= -I$(SRC_DIR)/include -I$(SRC_DIR)/pie -I$(ARCH_DIR) -iquote $(ARCH_DIR)/include -fno-strict-aliasing
>  
>  LIBS		:= -lrt -lpthread -lprotobuf-c
>  
> @@ -70,7 +71,7 @@ CFLAGS		+= $(WARNINGS) $(DEFINES)
>  SYSCALL-LIB	= $(SRC_DIR)/arch/$(ARCH)/syscalls.o
>  PROTOBUF-LIB	= $(SRC_DIR)/protobuf/protobuf-lib.o
>  
> -export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS SRC_DIR SYSCALL-LIB SH
> +export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS SRC_DIR SYSCALL-LIB SH ARCH_DIR
>  
>  
>  PROGRAM		:= crtools
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index c0108a1..3e8df60 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -1,4 +1,4 @@
> -SYS-DEF		:= $(SRC_DIR)/include/syscall-x86-64.def
> +SYS-DEF		:= $(ARCH_DIR)/syscall-x86-64.def
>  SYS-ASM-COMMON	:= syscall-common-x86-64.S
>  SYS-TYPES	:= $(SRC_DIR)/include/syscall-types.h
>  
> @@ -47,5 +47,6 @@ clean:
>  	$(Q) $(RM) -f $(SYS-PROTO)
>  	$(Q) $(RM) -f $(SYS-OBJ)
>  	$(Q) $(RM) -f $(SYS-EXEC-TBL)
> +	$(Q) $(RM) -f *.o *.d
>  
>  .PHONY: clean x86
> diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
> new file mode 100644
> index 0000000..273d595
> --- /dev/null
> +++ b/arch/x86/include/asm/atomic.h
> @@ -0,0 +1,60 @@
> +#ifndef __CR_ATOMIC_H__
> +#define __CR_ATOMIC_H__
> +
> +#include "asm/types.h"
> +
> +typedef struct {
> +	u32 counter;
> +} atomic_t;
> +
> +#define atomic_set(mem, v)					\
> +	({							\
> +		u32 ret__ = v;					\
> +		asm volatile ("lock xchg %0, %1\n"		\
> +				: "+r" (ret__), "+m" ((mem)->counter)	\
> +				:				\
> +				: "cc", "memory");		\
> +	})
> +
> +#define atomic_get(mem)						\
> +	({							\
> +		u32 ret__ = 0;					\
> +		asm volatile ("lock xadd %0, %1\n"		\
> +				: "+r" (ret__),	"+m" ((mem)->counter)	\
> +				:				\
> +				: "cc", "memory");		\
> +		ret__;						\
> +	})
> +
> +#define atomic_inc(mem)						\
> +	({							\
> +		u32 ret__ = 1;					\
> +		asm volatile ("lock xadd %0, %1\n"		\
> +				: "+r" (ret__),	"+m" ((mem)->counter)	\
> +				:				\
> +				: "cc", "memory");		\
> +		ret__;						\
> +	})
> +
> +#define atomic_dec(mem)						\
> +	({							\
> +		u32 ret__ = -1;					\
> +		asm volatile ("lock xadd %0, %1\n"		\
> +				: "+r" (ret__),	"+m" ((mem)->counter)	\
> +				:				\
> +				: "cc", "memory");		\
> +		ret__;						\
> +	})
> +
> +/* true if the result is 0, or false for all other cases. */
> +#define atomic_dec_and_test(mem)				\
> +	({							\
> +		unsigned char ret__;				\
> +		asm volatile ("lock decl %0; sete %1\n"		\
> +				: "+m" ((mem)->counter), "=qm" (ret__)	\
> +				:				\
> +				: "cc", "memory");		\
> +		ret__ != 0;					\
> +	})
> +
> +#endif /* __CR_ATOMIC_H__ */
> diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
> new file mode 100644
> index 0000000..c65602b
> --- /dev/null
> +++ b/arch/x86/include/asm/bitops.h
> @@ -0,0 +1,118 @@
> +#ifndef __CR_BITOPS_H__
> +#define __CR_BITOPS_H__
> +
> +#ifdef CONFIG_X86_64
> +
> +#define DIV_ROUND_UP(n,d)	(((n) + (d) - 1) / (d))
> +#define BITS_PER_LONG		(8 * sizeof(long))
> +#define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_LONG)
> +
> +#define DECLARE_BITMAP(name, bits)		\
> +	unsigned long name[BITS_TO_LONGS(bits)]
> +
> +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
> +/* Technically wrong, but this avoids compilation errors on some gcc
> +   versions. */
> +#define BITOP_ADDR(x) "=m" (*(volatile long *) (x))
> +#else
> +#define BITOP_ADDR(x) "+m" (*(volatile long *) (x))
> +#endif
> +
> +#define ADDR				BITOP_ADDR(addr)
> +
> +static inline void set_bit(int nr, volatile unsigned long *addr)
> +{
> +	asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
> +}
> +
> +static inline void change_bit(int nr, volatile unsigned long *addr)
> +{
> +	asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
> +}
> +
> +static inline int test_bit(int nr, volatile const unsigned long *addr)
> +{
> +	int oldbit;
> +
> +	asm volatile("bt %2,%1\n\t"
> +		     "sbb %0,%0"
> +		     : "=r" (oldbit)
> +		     : "m" (*(unsigned long *)addr), "Ir" (nr));
> +
> +	return oldbit;
> +}
> +
> +static inline void clear_bit(int nr, volatile unsigned long *addr)
> +{
> +	asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
> +}
> +
> +/**
> + * __ffs - find first set bit in word
> + * @word: The word to search
> + *
> + * Undefined if no bit exists, so code should check against 0 first.
> + */
> +static inline unsigned long __ffs(unsigned long word)
> +{
> +	asm("bsf %1,%0"
> +		: "=r" (word)
> +		: "rm" (word));
> +	return word;
> +}
> +
> +#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
> +
> +/*
> + * Find the next set bit in a memory region.
> + */
> +static inline
> +unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
> +			    unsigned long offset)
> +{
> +	const unsigned long *p = addr + BITOP_WORD(offset);
> +	unsigned long result = offset & ~(BITS_PER_LONG-1);
> +	unsigned long tmp;
> +
> +	if (offset >= size)
> +		return size;
> +	size -= result;
> +	offset %= BITS_PER_LONG;
> +	if (offset) {
> +		tmp = *(p++);
> +		tmp &= (~0UL << offset);
> +		if (size < BITS_PER_LONG)
> +			goto found_first;
> +		if (tmp)
> +			goto found_middle;
> +		size -= BITS_PER_LONG;
> +		result += BITS_PER_LONG;
> +	}
> +	while (size & ~(BITS_PER_LONG-1)) {
> +		if ((tmp = *(p++)))
> +			goto found_middle;
> +		result += BITS_PER_LONG;
> +		size -= BITS_PER_LONG;
> +	}
> +	if (!size)
> +		return result;
> +	tmp = *p;
> +
> +found_first:
> +	tmp &= (~0UL >> (BITS_PER_LONG - size));
> +	if (tmp == 0UL)		/* Are any bits set? */
> +		return result + size;	/* Nope. */
> +found_middle:
> +	return result + __ffs(tmp);
> +}
> +
> +#define for_each_bit(i, bitmask)				\
> +	for (i = find_next_bit(bitmask, sizeof(bitmask), 0);	\
> +	     i < sizeof(bitmask);				\
> +	     i = find_next_bit(bitmask, sizeof(bitmask), i + 1))
> +
> +#else /* CONFIG_X86_64 */
> +# error x86-32 is not implemented yet
> +#endif /* CONFIG_X86_64 */
> +
> +#endif /* __CR_BITOPS_H__ */
> diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
> new file mode 100644
> index 0000000..5e0948f
> --- /dev/null
> +++ b/arch/x86/include/asm/linkage.h
> @@ -0,0 +1,24 @@
> +#ifndef __CR_LINKAGE_H__
> +#define __CR_LINKAGE_H__
> +
> +#ifdef __ASSEMBLY__
> +
> +#define __ALIGN		.align 4, 0x90
> +#define __ALIGN_STR	".align 4, 0x90"
> +
> +#define GLOBAL(name)		\
> +	.globl name;		\
> +	name:
> +
> +#define ENTRY(name)		\
> +	.globl name;		\
> +	.type name, @function;	\
> +	__ALIGN;		\
> +	name:
> +
> +#define END(sym)		\
> +	.size sym, . - sym
> +
> +#endif  /* __ASSEMBLY__ */
> +
> +#endif /* __CR_LINKAGE_H__ */
> diff --git a/arch/x86/include/asm/memcpy_64.h b/arch/x86/include/asm/memcpy_64.h
> new file mode 100644
> index 0000000..e7012c0
> --- /dev/null
> +++ b/arch/x86/include/asm/memcpy_64.h
> @@ -0,0 +1,22 @@
> +#ifndef __CR_MEMCPY_64_H__
> +#define __CR_MEMCPY_64_H__
> +
> +#include "compiler.h"
> +#include "asm/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;
> +}
> +
> +#endif /* __CR_MEMCPY_64_H__ */
> diff --git a/arch/x86/include/asm/processor-flags.h b/arch/x86/include/asm/processor-flags.h
> new file mode 100644
> index 0000000..9f1bccd
> --- /dev/null
> +++ b/arch/x86/include/asm/processor-flags.h
> @@ -0,0 +1,28 @@
> +#ifndef __CR_PROCESSOR_FLAGS_H__
> +#define __CR_PROCESSOR_FLAGS_H__
> +
> +/* Taken from linux kernel headers */
> +
> +/*
> + * EFLAGS bits
> + */
> +#define X86_EFLAGS_CF	0x00000001 /* Carry Flag */
> +#define X86_EFLAGS_BIT1	0x00000002 /* Bit 1 - always on */
> +#define X86_EFLAGS_PF	0x00000004 /* Parity Flag */
> +#define X86_EFLAGS_AF	0x00000010 /* Auxiliary carry Flag */
> +#define X86_EFLAGS_ZF	0x00000040 /* Zero Flag */
> +#define X86_EFLAGS_SF	0x00000080 /* Sign Flag */
> +#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
> +#define X86_EFLAGS_IF	0x00000200 /* Interrupt Flag */
> +#define X86_EFLAGS_DF	0x00000400 /* Direction Flag */
> +#define X86_EFLAGS_OF	0x00000800 /* Overflow Flag */
> +#define X86_EFLAGS_IOPL	0x00003000 /* IOPL mask */
> +#define X86_EFLAGS_NT	0x00004000 /* Nested Task */
> +#define X86_EFLAGS_RF	0x00010000 /* Resume Flag */
> +#define X86_EFLAGS_VM	0x00020000 /* Virtual Mode */
> +#define X86_EFLAGS_AC	0x00040000 /* Alignment Check */
> +#define X86_EFLAGS_VIF	0x00080000 /* Virtual Interrupt Flag */
> +#define X86_EFLAGS_VIP	0x00100000 /* Virtual Interrupt Pending */
> +#define X86_EFLAGS_ID	0x00200000 /* CPUID detection flag */
> +
> +#endif /* __CR_PROCESSOR_FLAGS_H__ */
> diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
> new file mode 100644
> index 0000000..bf33946
> --- /dev/null
> +++ b/arch/x86/include/asm/types.h
> @@ -0,0 +1,248 @@
> +#ifndef __CR_ASM_TYPES_H__
> +#define __CR_ASM_TYPES_H__
> +
> +#include <stdint.h>
> +#include <stdbool.h>
> +#include <signal.h>
> +
> +#include "asm/bitops.h"
> +
> +/* prctl */
> +#define ARCH_SET_GS 0x1001
> +#define ARCH_SET_FS 0x1002
> +#define ARCH_GET_FS 0x1003
> +#define ARCH_GET_GS 0x1004
> +
> +#define FS_TLS 0
> +#define GS_TLS 1
> +
> +/* prctl.h */
> +#define PR_SET_NAME		15
> +#define PR_GET_NAME		16
> +
> +#define PR_CAPBSET_DROP		24
> +#define PR_GET_SECUREBITS	27
> +#define PR_SET_SECUREBITS	28
> +
> +#define SECURE_NO_SETUID_FIXUP	2
> +
> +#define PR_SET_MM		35
> +# define PR_SET_MM_START_CODE		1
> +# define PR_SET_MM_END_CODE		2
> +# define PR_SET_MM_START_DATA		3
> +# define PR_SET_MM_END_DATA		4
> +# define PR_SET_MM_START_STACK		5
> +# define PR_SET_MM_START_BRK		6
> +# define PR_SET_MM_BRK			7
> +# define PR_SET_MM_ARG_START		8
> +# define PR_SET_MM_ARG_END		9
> +# define PR_SET_MM_ENV_START		10
> +# define PR_SET_MM_ENV_END		11
> +# define PR_SET_MM_AUXV			12
> +# define PR_SET_MM_EXE_FILE		13
> +
> +#define PR_GET_TID_ADDRESS     40
> +
> +/* fcntl */
> +#ifndef F_LINUX_SPECIFIC_BASE
> +#define F_LINUX_SPECIFIC_BASE	1024
> +#endif
> +#ifndef F_SETPIPE_SZ
> +# define F_SETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 7)
> +#endif
> +#ifndef F_GETPIPE_SZ
> +# define F_GETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 8)
> +#endif
> +
> +#ifndef F_GETOWNER_UIDS
> +#define F_GETOWNER_UIDS	17
> +#endif
> +
> +#define CLONE_CHILD_USEPID      0x02000000
> +#define CLONE_VFORK		0x00004000
> +
> +#define SIGMAX			64
> +#define SIGMAX_OLD		31
> +
> +#define ERESTARTSYS		512
> +#define ERESTARTNOINTR		513
> +#define ERESTARTNOHAND		514
> +#define ERESTART_RESTARTBLOCK	516
> +
> +typedef uint64_t		u64;
> +typedef int64_t			s64;
> +typedef unsigned int		u32;
> +typedef signed int		s32;
> +typedef unsigned short		u16;
> +typedef signed short		s16;
> +typedef unsigned char		u8;
> +typedef signed char		s8;
> +
> +#define MAJOR(dev)		((dev)>>8)
> +#define MINOR(dev)		((dev) & 0xff)
> +
> +#define _LINUX_CAPABILITY_VERSION_3	0x20080522
> +#define _LINUX_CAPABILITY_U32S_3	2
> +
> +#ifdef CONFIG_X86_64
> +
> +typedef struct {
> +	unsigned long sig[1];
> +} rt_sigset_t;
> +
> +typedef void rt_signalfn_t(int, siginfo_t *, void *);
> +typedef rt_signalfn_t *rt_sighandler_t;
> +
> +typedef void rt_restorefn_t(void);
> +typedef rt_restorefn_t *rt_sigrestore_t;
> +
> +typedef struct {
> +	rt_sighandler_t	rt_sa_handler;
> +	unsigned long	rt_sa_flags;
> +	rt_sigrestore_t	rt_sa_restorer;
> +	rt_sigset_t	rt_sa_mask;
> +} rt_sigaction_t;
> +
> +#define _KNSIG           64
> +# define _NSIG_BPW      64
> +
> +#define _KNSIG_WORDS     (_KNSIG / _NSIG_BPW)
> +
> +typedef struct {
> +	unsigned long sig[_KNSIG_WORDS];
> +} k_rtsigset_t;
> +
> +static inline void ksigfillset(k_rtsigset_t *set)
> +{
> +	int i;
> +	for (i = 0; i < _KNSIG_WORDS; i++)
> +		set->sig[i] = (unsigned long)-1;
> +}
> +
> +typedef struct {
> +	unsigned int	entry_number;
> +	unsigned int	base_addr;
> +	unsigned int	limit;
> +	unsigned int	seg_32bit:1;
> +	unsigned int	contents:2;
> +	unsigned int	read_exec_only:1;
> +	unsigned int	limit_in_pages:1;
> +	unsigned int	seg_not_present:1;
> +	unsigned int	useable:1;
> +	unsigned int	lm:1;
> +} user_desc_t;
> +
> +typedef struct {
> +	unsigned long	r15;
> +	unsigned long	r14;
> +	unsigned long	r13;
> +	unsigned long	r12;
> +	unsigned long	bp;
> +	unsigned long	bx;
> +	unsigned long	r11;
> +	unsigned long	r10;
> +	unsigned long	r9;
> +	unsigned long	r8;
> +	unsigned long	ax;
> +	unsigned long	cx;
> +	unsigned long	dx;
> +	unsigned long	si;
> +	unsigned long	di;
> +	unsigned long	orig_ax;
> +	unsigned long	ip;
> +	unsigned long	cs;
> +	unsigned long	flags;
> +	unsigned long	sp;
> +	unsigned long	ss;
> +	unsigned long	fs_base;
> +	unsigned long	gs_base;
> +	unsigned long	ds;
> +	unsigned long	es;
> +	unsigned long	fs;
> +	unsigned long	gs;
> +} user_regs_struct_t;
> +
> +typedef struct {
> +	unsigned short	cwd;
> +	unsigned short	swd;
> +	unsigned short	twd;	/* Note this is not the same as
> +				   the 32bit/x87/FSAVE twd */
> +	unsigned short	fop;
> +	u64		rip;
> +	u64		rdp;
> +	u32		mxcsr;
> +	u32		mxcsr_mask;
> +	u32		st_space[32];	/* 8*16 bytes for each FP-reg = 128 bytes */
> +	u32		xmm_space[64];	/* 16*16 bytes for each XMM-reg = 256 bytes */
> +	u32		padding[24];
> +} user_fpregs_struct_t;
> +
> +#else /* CONFIG_X86_64 */
> +# error x86-32 bit mode not yet implemented
> +#endif /* CONFIG_X86_64 */
> +
> +#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
> +#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
> +
> +#ifndef PAGE_SIZE
> +# define PAGE_SIZE	4096
> +#endif
> +
> +#ifndef PAGE_MASK
> +# define PAGE_MASK	(~(PAGE_SIZE - 1))
> +#endif
> +
> +/* For sys_kcmp */
> +enum kcmp_type {
> +	KCMP_FILE,
> +	KCMP_VM,
> +	KCMP_FILES,
> +	KCMP_FS,
> +	KCMP_SIGHAND,
> +	KCMP_IO,
> +	KCMP_SYSVSEM,
> +
> +	KCMP_TYPES,
> +};
> +
> +/* For UNIX sockets data */
> +#ifndef SCM_MAX_FD
> +# define SCM_MAX_FD	253
> +#endif
> +
> +#include <fcntl.h>
> +
> +#ifndef F_SETOWN_EX
> +#define F_SETOWN_EX	15
> +#define F_GETOWN_EX	16
> +
> +struct f_owner_ex {
> +	int	type;
> +	pid_t	pid;
> +};
> +#endif
> +
> +/* File handle */
> +typedef struct {
> +	u32 bytes;
> +	u32 type;
> +	u64 __handle[16];
> +} fh_t;
> +
> +#ifndef MAP_HUGETLB
> +# define MAP_HUGETLB 0x40000
> +#endif
> +
> +#ifndef MADV_HUGEPAGE
> +# define MADV_HUGEPAGE 14
> +#endif
> +
> +#ifndef MADV_NOHUGEPAGE
> +# define MADV_NOHUGEPAGE 15
> +#endif
> +
> +#ifndef MADV_DONTDUMP
> +# define MADV_DONTDUMP 16
> +#endif
> +
> +#endif /* __CR_ASM_TYPES_H__ */
> diff --git a/arch/x86/parasite-head.S b/arch/x86/parasite-head.S
> new file mode 100644
> index 0000000..289672c
> --- /dev/null
> +++ b/arch/x86/parasite-head.S
> @@ -0,0 +1,24 @@
> +#include "asm/linkage.h"
> +#include "parasite.h"
> +
> +	.section .head.text, "ax"
> +ENTRY(__export_parasite_head_start)
> +	leaq	__export_parasite_stack(%rip), %rsp
> +	subq	$16, %rsp
> +	andq	$~15, %rsp
> +	pushq	$0
> +	movq	%rsp, %rbp
> +	movl	__export_parasite_cmd(%rip), %edi
> +	leaq	__export_parasite_args(%rip), %rsi
> +	call	parasite_service
> +	int	$0x03
> +	.align 8
> +__export_parasite_cmd:
> +	.long 0
> +__export_parasite_args:
> +	.long 0
> +	.space PARASITE_ARG_SIZE,0
> +	.space PARASITE_STACK_SIZE,0
> +__export_parasite_stack:
> +	.long 0
> +END(__export_parasite_head_start)
> diff --git a/arch/x86/syscall-common-x86-64.S b/arch/x86/syscall-common-x86-64.S
> index 84bcd8b..a549207 100644
> --- a/arch/x86/syscall-common-x86-64.S
> +++ b/arch/x86/syscall-common-x86-64.S
> @@ -1,4 +1,4 @@
> -#include "linkage.h"
> +#include "asm/linkage.h"
>  
>  #define SYSCALL(name, opcode)		\
>  	ENTRY(name);			\
> diff --git a/arch/x86/syscall-x86-64.def b/arch/x86/syscall-x86-64.def
> new file mode 100644
> index 0000000..7121e60
> --- /dev/null
> +++ b/arch/x86/syscall-x86-64.def
> @@ -0,0 +1,76 @@
> +#
> +# System calls table, please make sure the table consist only the syscalls
> +# really used somewhere in project.
> +#
> +# The template is (name and srguments are optinal if you need only __NR_x
> +# defined, but no realy entry point in syscalls lib).
> +#
> +# name			code		name			arguments
> +# -----------------------------------------------------------------------
> +#
> +__NR_read		0		sys_read		(int fd, void *buf, unsigned long count)
> +__NR_write		1		sys_write		(int fd, const void *buf, unsigned long count)
> +__NR_open		2		sys_open		(const char *filename, unsigned long flags, unsigned long mode)
> +__NR_close		3		sys_close		(int fd)
> +__NR_lseek		8		sys_lseek		(int fd, unsigned long offset, unsigned long origin)
> +__NR_mmap		9		sys_mmap		(void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long offset)
> +__NR_mprotect		10		sys_mprotect		(const void *addr, unsigned long len, unsigned long prot)
> +__NR_munmap		11		sys_munmap		(void *addr, unsigned long len)
> +__NR_brk		12		sys_brk			(void *addr)
> +__NR_rt_sigaction	13		sys_sigaction		(int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
> +__NR_rt_sigprocmask	14		sys_sigprocmask		(int how, k_rtsigset_t *set, k_rtsigset_t *old, size_t sigsetsize)
> +__NR_rt_sigreturn	15		sys_rt_sigreturn	(void)
> +__NR_ioctl		16		sys_ioctl		(unsigned int fd, unsigned int cmd, unsigned long arg)
> +__NR_mremap		25		sys_mremap		(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, unsigned long new_addr)
> +__NR_mincore		27		sys_mincore		(void *addr, unsigned long size, unsigned char *vec)
> +__NR_madvise		28		sys_madvise		(unsigned long start, size_t len, int behavior)
> +__NR_shmat		30		sys_shmat		(int shmid, void *shmaddr, int shmflag)
> +__NR_pause		34		sys_pause		(void)
> +__NR_nanosleep		35		sys_nanosleep		(struct timespec *req, struct timespec *rem)
> +__NR_getitimer		36		sys_getitimer		(int which, const struct itimerval *val)
> +__NR_setitimer		38		sys_setitimer		(int which, const struct itimerval *val, struct itimerval *old)
> +__NR_getpid		39		sys_getpid		(void)
> +__NR_socket		41		sys_socket		(int domain, int type, int protocol)
> +__NR_connect		42		sys_connect		(int sockfd, struct sockaddr *addr, int addrlen)
> +__NR_sendmsg		46		sys_sendmsg		(int sockfd, const struct msghdr *msg, int flags)
> +__NR_recvmsg		47		sys_recvmsg		(int sockfd, struct msghdr *msg, int flags)
> +__NR_bind		49		sys_bind		(int sockfd, const struct sockaddr *addr, int addrlen)
> +__NR_setsockopt		54		sys_setsockopt		(int sockfd, int level, int optname, const void *optval, socklen_t optlen)
> +__NR_getsockopt		55		sys_getsockopt		(int sockfd, int level, int optname, const void *optval, socklen_t *optlen)
> +__NR_clone		56		sys_clone		(unsigned long flags, void *child_stack, void *parent_tid, void *child_tid)
> +__NR_exit		60		sys_exit		(unsigned long error_code)
> +__NR_wait4		61		sys_waitpid		(int pid, int *status, int options, struct rusage *ru)
> +__NR_kill		62		sys_kill		(long pid, int sig)
> +__NR_fcntl		72		sys_fcntl		(int fd, int type, long arg)
> +__NR_flock		73		sys_flock		(int fd, unsigned long cmd)
> +__NR_mkdir		83		sys_mkdir		(const char *name, int mode)
> +__NR_rmdir		84		sys_rmdir		(const char *name)
> +__NR_unlink		87		sys_unlink		(char *pathname)
> +__NR_readlink		89		sys_readlink		(const char *path, char *buf, int bufsize)
> +__NR_getgroups		115		sys_getgroups		(int gsize, unsigned int *groups)
> +__NR_setresuid		117		sys_setresuid		(int uid, int euid, int suid)
> +__NR_setresgid		119		sys_setresgid		(int gid, int egid, int sgid)
> +__NR_getpgid		121		sys_getpgid		(void)
> +__NR_setfsuid		122		sys_setfsuid		(int fsuid)
> +__NR_setfsgid		123		sys_setfsgid		(int fsgid)
> +__NR_getsid		124		sys_getsid		(void)
> +__NR_capset		126		sys_capset		(struct cap_header *h, struct cap_data *d)
> +__NR_personality	135		sys_personality		(unsigned int personality)
> +__NR_setpriority	141		sys_setpriority		(int which, int who, int nice)
> +__NR_sched_setscheduler	144		sys_sched_setscheduler	(int pid, int policy, struct sched_param *p)
> +__NR_prctl		157		sys_prctl		(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
> +__NR_arch_prctl		158		sys_arch_prctl		(int option, unsigned long addr)
> +__NR_mount		165		sys_mount		(char *dev_nmae, char *dir_name, char *type, unsigned long flags, void *data)
> +__NR_umount2		166		sys_umount2		(char *name, int flags)
> +__NR_gettid		186		sys_gettid		(void)
> +__NR_futex		202		sys_futex		(u32 *uaddr, int op, u32 val, struct timespec *utime, u32 *uaddr2, u32 val3)
> +__NR_set_thread_area	205		sys_set_thread_area	(user_desc_t *info)
> +__NR_get_thread_area	211		sys_get_thread_area	(user_desc_t *info)
> +__NR_set_tid_address	218		sys_set_tid_address	(int *tid_addr)
> +__NR_restart_syscall	219		sys_restart_syscall	(void)
> +__NR_exit_group		231		sys_exit_group		(int error_code)
> +__NR_set_robust_list	273		sys_set_robust_list	(struct robust_list_head *head, size_t len)
> +__NR_get_robust_list	274		sys_get_robust_list	(int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
> +__NR_open_by_handle_at	304		sys_open_by_handle_at	(int mountdirfd, struct file_handle *handle, int flags)
> +__NR_setns		308		sys_setns		(int fd, int nstype)
> +__NR_kcmp		312		sys_kcmp		(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2)
> diff --git a/cpu.c b/cpu.c
> index a29fe86..983ca50 100644
> --- a/cpu.c
> +++ b/cpu.c
> @@ -7,10 +7,10 @@
>  #include <sys/types.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "log.h"
>  #include "util.h"
> -#include "bitops.h"
> +#include "asm/bitops.h"
>  
>  #include "proc_parse.h"
>  
> diff --git a/cr-dump.c b/cr-dump.c
> index 00af534..a6693a8 100644
> --- a/cr-dump.c
> +++ b/cr-dump.c
> @@ -30,7 +30,7 @@
>  #include "protobuf/creds.pb-c.h"
>  #include "protobuf/core.pb-c.h"
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "list.h"
>  #include "file-ids.h"
>  #include "kcmp-ids.h"
> diff --git a/cr-restore.c b/cr-restore.c
> index 516ace6..ec5bd4c 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -25,7 +25,7 @@
>  #include <sys/sendfile.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  
>  #include "image.h"
>  #include "util.h"
> diff --git a/cr-show.c b/cr-show.c
> index 48031f8..61373be 100644
> --- a/cr-show.c
> +++ b/cr-show.c
> @@ -12,7 +12,7 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "list.h"
>  #include "namespaces.h"
>  #include "compiler.h"
> diff --git a/crtools.c b/crtools.c
> index b4f4b53..7cc7e63 100644
> --- a/crtools.c
> +++ b/crtools.c
> @@ -12,7 +12,7 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  
>  #include "compiler.h"
>  #include "crtools.h"
> diff --git a/eventfd.c b/eventfd.c
> index 75c8b84..1e48af2 100644
> --- a/eventfd.c
> +++ b/eventfd.c
> @@ -13,7 +13,7 @@
>  #include <sys/eventfd.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "eventfd.h"
>  #include "proc_parse.h"
>  #include "crtools.h"
> diff --git a/eventpoll.c b/eventpoll.c
> index c67bc07..ccce771 100644
> --- a/eventpoll.c
> +++ b/eventpoll.c
> @@ -13,7 +13,7 @@
>  #include <sys/epoll.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "eventpoll.h"
>  #include "proc_parse.h"
>  #include "crtools.h"
> diff --git a/file-ids.c b/file-ids.c
> index 690713e..22b3ac5 100644
> --- a/file-ids.c
> +++ b/file-ids.c
> @@ -9,7 +9,7 @@
>  
>  #include <sys/types.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "file-ids.h"
>  #include "rbtree.h"
>  #include "kcmp-ids.h"
> diff --git a/files-reg.c b/files-reg.c
> index c99c349..cf4fd71 100644
> --- a/files-reg.c
> +++ b/files-reg.c
> @@ -12,7 +12,7 @@
>  #include "image.h"
>  #include "list.h"
>  #include "util.h"
> -#include "atomic.h"
> +#include "asm/atomic.h"
>  
>  #include "protobuf.h"
>  #include "protobuf/regfile.pb-c.h"
> diff --git a/include/atomic.h b/include/atomic.h
> deleted file mode 100644
> index 8408386..0000000
> --- a/include/atomic.h
> +++ /dev/null
> @@ -1,60 +0,0 @@
> -#ifndef __CR_ATOMIC_H__
> -#define __CR_ATOMIC_H__
> -
> -#include "types.h"
> -
> -typedef struct {
> -	u32 counter;
> -} atomic_t;
> -
> -#define atomic_set(mem, v)					\
> -	({							\
> -		u32 ret__ = v;					\
> -		asm volatile ("lock xchg %0, %1\n"		\
> -				: "+r" (ret__), "+m" ((mem)->counter)	\
> -				:				\
> -				: "cc", "memory");		\
> -	})
> -
> -#define atomic_get(mem)						\
> -	({							\
> -		u32 ret__ = 0;					\
> -		asm volatile ("lock xadd %0, %1\n"		\
> -				: "+r" (ret__),	"+m" ((mem)->counter)	\
> -				:				\
> -				: "cc", "memory");		\
> -		ret__;						\
> -	})
> -
> -#define atomic_inc(mem)						\
> -	({							\
> -		u32 ret__ = 1;					\
> -		asm volatile ("lock xadd %0, %1\n"		\
> -				: "+r" (ret__),	"+m" ((mem)->counter)	\
> -				:				\
> -				: "cc", "memory");		\
> -		ret__;						\
> -	})
> -
> -#define atomic_dec(mem)						\
> -	({							\
> -		u32 ret__ = -1;					\
> -		asm volatile ("lock xadd %0, %1\n"		\
> -				: "+r" (ret__),	"+m" ((mem)->counter)	\
> -				:				\
> -				: "cc", "memory");		\
> -		ret__;						\
> -	})
> -
> -/* true if the result is 0, or false for all other cases. */
> -#define atomic_dec_and_test(mem)				\
> -	({							\
> -		unsigned char ret__;				\
> -		asm volatile ("lock decl %0; sete %1\n"		\
> -				: "+m" ((mem)->counter), "=qm" (ret__)	\
> -				:				\
> -				: "cc", "memory");		\
> -		ret__ != 0;					\
> -	})
> -
> -#endif /* __CR_ATOMIC_H__ */
> diff --git a/include/bitops.h b/include/bitops.h
> deleted file mode 100644
> index c65602b..0000000
> --- a/include/bitops.h
> +++ /dev/null
> @@ -1,118 +0,0 @@
> -#ifndef __CR_BITOPS_H__
> -#define __CR_BITOPS_H__
> -
> -#ifdef CONFIG_X86_64
> -
> -#define DIV_ROUND_UP(n,d)	(((n) + (d) - 1) / (d))
> -#define BITS_PER_LONG		(8 * sizeof(long))
> -#define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_LONG)
> -
> -#define DECLARE_BITMAP(name, bits)		\
> -	unsigned long name[BITS_TO_LONGS(bits)]
> -
> -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
> -/* Technically wrong, but this avoids compilation errors on some gcc
> -   versions. */
> -#define BITOP_ADDR(x) "=m" (*(volatile long *) (x))
> -#else
> -#define BITOP_ADDR(x) "+m" (*(volatile long *) (x))
> -#endif
> -
> -#define ADDR				BITOP_ADDR(addr)
> -
> -static inline void set_bit(int nr, volatile unsigned long *addr)
> -{
> -	asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
> -}
> -
> -static inline void change_bit(int nr, volatile unsigned long *addr)
> -{
> -	asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
> -}
> -
> -static inline int test_bit(int nr, volatile const unsigned long *addr)
> -{
> -	int oldbit;
> -
> -	asm volatile("bt %2,%1\n\t"
> -		     "sbb %0,%0"
> -		     : "=r" (oldbit)
> -		     : "m" (*(unsigned long *)addr), "Ir" (nr));
> -
> -	return oldbit;
> -}
> -
> -static inline void clear_bit(int nr, volatile unsigned long *addr)
> -{
> -	asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
> -}
> -
> -/**
> - * __ffs - find first set bit in word
> - * @word: The word to search
> - *
> - * Undefined if no bit exists, so code should check against 0 first.
> - */
> -static inline unsigned long __ffs(unsigned long word)
> -{
> -	asm("bsf %1,%0"
> -		: "=r" (word)
> -		: "rm" (word));
> -	return word;
> -}
> -
> -#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
> -
> -/*
> - * Find the next set bit in a memory region.
> - */
> -static inline
> -unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
> -			    unsigned long offset)
> -{
> -	const unsigned long *p = addr + BITOP_WORD(offset);
> -	unsigned long result = offset & ~(BITS_PER_LONG-1);
> -	unsigned long tmp;
> -
> -	if (offset >= size)
> -		return size;
> -	size -= result;
> -	offset %= BITS_PER_LONG;
> -	if (offset) {
> -		tmp = *(p++);
> -		tmp &= (~0UL << offset);
> -		if (size < BITS_PER_LONG)
> -			goto found_first;
> -		if (tmp)
> -			goto found_middle;
> -		size -= BITS_PER_LONG;
> -		result += BITS_PER_LONG;
> -	}
> -	while (size & ~(BITS_PER_LONG-1)) {
> -		if ((tmp = *(p++)))
> -			goto found_middle;
> -		result += BITS_PER_LONG;
> -		size -= BITS_PER_LONG;
> -	}
> -	if (!size)
> -		return result;
> -	tmp = *p;
> -
> -found_first:
> -	tmp &= (~0UL >> (BITS_PER_LONG - size));
> -	if (tmp == 0UL)		/* Are any bits set? */
> -		return result + size;	/* Nope. */
> -found_middle:
> -	return result + __ffs(tmp);
> -}
> -
> -#define for_each_bit(i, bitmask)				\
> -	for (i = find_next_bit(bitmask, sizeof(bitmask), 0);	\
> -	     i < sizeof(bitmask);				\
> -	     i = find_next_bit(bitmask, sizeof(bitmask), i + 1))
> -
> -#else /* CONFIG_X86_64 */
> -# error x86-32 is not implemented yet
> -#endif /* CONFIG_X86_64 */
> -
> -#endif /* __CR_BITOPS_H__ */
> diff --git a/include/cpu.h b/include/cpu.h
> index 63ebe4a..1502285 100644
> --- a/include/cpu.h
> +++ b/include/cpu.h
> @@ -1,7 +1,7 @@
>  #ifndef __CR_CPU_H__
>  #define __CR_CPU_H__
>  
> -#include "types.h"
> +#include "asm/types.h"
>  
>  /*
>   * Adopted from linux kernel.
> diff --git a/include/crtools.h b/include/crtools.h
> index 326f0df..08c9655 100644
> --- a/include/crtools.h
> +++ b/include/crtools.h
> @@ -4,7 +4,7 @@
>  #include <sys/types.h>
>  
>  #include "list.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "list.h"
>  #include "util.h"
>  #include "image.h"
> diff --git a/include/eventfd.h b/include/eventfd.h
> index a5b4618..7515410 100644
> --- a/include/eventfd.h
> +++ b/include/eventfd.h
> @@ -5,7 +5,7 @@
>  #include <unistd.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "files.h"
>  #include "crtools.h"
>  
> diff --git a/include/eventpoll.h b/include/eventpoll.h
> index 4928258..a2f5f11 100644
> --- a/include/eventpoll.h
> +++ b/include/eventpoll.h
> @@ -5,7 +5,7 @@
>  #include <unistd.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "files.h"
>  #include "crtools.h"
>  
> diff --git a/include/file-ids.h b/include/file-ids.h
> index 86e16b8..9e38173 100644
> --- a/include/file-ids.h
> +++ b/include/file-ids.h
> @@ -2,7 +2,7 @@
>  #define __CR_FILE_IDS_H__
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "rbtree.h"
>  
>  #include "../protobuf/fdinfo.pb-c.h"
> diff --git a/include/files-reg.h b/include/files-reg.h
> index 17c88c9..51022e7 100644
> --- a/include/files-reg.h
> +++ b/include/files-reg.h
> @@ -1,7 +1,7 @@
>  #ifndef __CR_FILES_REG_H__
>  #define __CR_FILES_REG_H__
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "files.h"
>  #include "image.h"
>  
> diff --git a/include/files.h b/include/files.h
> index caefb34..0c727aa 100644
> --- a/include/files.h
> +++ b/include/files.h
> @@ -2,7 +2,7 @@
>  #define __CR_FILES_H__
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "lock.h"
>  #include "list.h"
>  #include "image.h"
> diff --git a/include/fpu.h b/include/fpu.h
> index 8682663..da717cd 100644
> --- a/include/fpu.h
> +++ b/include/fpu.h
> @@ -4,7 +4,7 @@
>  #include <sys/types.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  
>  #define FP_MIN_ALIGN_BYTES		64
>  
> diff --git a/include/image.h b/include/image.h
> index 6d6a4a6..cdf362d 100644
> --- a/include/image.h
> +++ b/include/image.h
> @@ -1,7 +1,7 @@
>  #ifndef __CR_IMAGE_H__
>  #define __CR_IMAGE_H__
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "compiler.h"
>  
>  /*
> diff --git a/include/inotify.h b/include/inotify.h
> index 417f2a3..d45b2bc 100644
> --- a/include/inotify.h
> +++ b/include/inotify.h
> @@ -5,7 +5,7 @@
>  #include <unistd.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "files.h"
>  #include "crtools.h"
>  
> diff --git a/include/linkage.h b/include/linkage.h
> deleted file mode 100644
> index 5e0948f..0000000
> --- a/include/linkage.h
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#ifndef __CR_LINKAGE_H__
> -#define __CR_LINKAGE_H__
> -
> -#ifdef __ASSEMBLY__
> -
> -#define __ALIGN		.align 4, 0x90
> -#define __ALIGN_STR	".align 4, 0x90"
> -
> -#define GLOBAL(name)		\
> -	.globl name;		\
> -	name:
> -
> -#define ENTRY(name)		\
> -	.globl name;		\
> -	.type name, @function;	\
> -	__ALIGN;		\
> -	name:
> -
> -#define END(sym)		\
> -	.size sym, . - sym
> -
> -#endif  /* __ASSEMBLY__ */
> -
> -#endif /* __CR_LINKAGE_H__ */
> diff --git a/include/lock.h b/include/lock.h
> index 8ef4113..cf976c2 100644
> --- a/include/lock.h
> +++ b/include/lock.h
> @@ -6,8 +6,8 @@
>  #include <limits.h>
>  #include <errno.h>
>  
> -#include "types.h"
> -#include "atomic.h"
> +#include "asm/types.h"
> +#include "asm/atomic.h"
>  #include "syscall.h"
>  #include "util.h"
>  
> diff --git a/include/memcpy_64.h b/include/memcpy_64.h
> deleted file mode 100644
> index 20f11cd..0000000
> --- a/include/memcpy_64.h
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -#ifndef __CR_MEMCPY_64_H__
> -#define __CR_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;
> -}
> -
> -#endif /* __CR_MEMCPY_64_H__ */
> diff --git a/include/proc_parse.h b/include/proc_parse.h
> index df72ef7..896b7e2 100644
> --- a/include/proc_parse.h
> +++ b/include/proc_parse.h
> @@ -2,7 +2,7 @@
>  #define __CR_PROC_PARSE_H__
>  
>  #include <sys/types.h>
> -#include "types.h"
> +#include "asm/types.h"
>  #include "image.h"
>  #include "list.h"
>  
> diff --git a/include/processor-flags.h b/include/processor-flags.h
> deleted file mode 100644
> index 9f1bccd..0000000
> --- a/include/processor-flags.h
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -#ifndef __CR_PROCESSOR_FLAGS_H__
> -#define __CR_PROCESSOR_FLAGS_H__
> -
> -/* Taken from linux kernel headers */
> -
> -/*
> - * EFLAGS bits
> - */
> -#define X86_EFLAGS_CF	0x00000001 /* Carry Flag */
> -#define X86_EFLAGS_BIT1	0x00000002 /* Bit 1 - always on */
> -#define X86_EFLAGS_PF	0x00000004 /* Parity Flag */
> -#define X86_EFLAGS_AF	0x00000010 /* Auxiliary carry Flag */
> -#define X86_EFLAGS_ZF	0x00000040 /* Zero Flag */
> -#define X86_EFLAGS_SF	0x00000080 /* Sign Flag */
> -#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
> -#define X86_EFLAGS_IF	0x00000200 /* Interrupt Flag */
> -#define X86_EFLAGS_DF	0x00000400 /* Direction Flag */
> -#define X86_EFLAGS_OF	0x00000800 /* Overflow Flag */
> -#define X86_EFLAGS_IOPL	0x00003000 /* IOPL mask */
> -#define X86_EFLAGS_NT	0x00004000 /* Nested Task */
> -#define X86_EFLAGS_RF	0x00010000 /* Resume Flag */
> -#define X86_EFLAGS_VM	0x00020000 /* Virtual Mode */
> -#define X86_EFLAGS_AC	0x00040000 /* Alignment Check */
> -#define X86_EFLAGS_VIF	0x00080000 /* Virtual Interrupt Flag */
> -#define X86_EFLAGS_VIP	0x00100000 /* Virtual Interrupt Pending */
> -#define X86_EFLAGS_ID	0x00200000 /* CPUID detection flag */
> -
> -#endif /* __CR_PROCESSOR_FLAGS_H__ */
> diff --git a/include/protobuf.h b/include/protobuf.h
> index 6851c22..4bed9f9 100644
> --- a/include/protobuf.h
> +++ b/include/protobuf.h
> @@ -1,7 +1,7 @@
>  #ifndef __CR_PROTOBUF_H__
>  #define __CR_PROTOBUF_H__
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "compiler.h"
>  #include "util.h"
>  
> diff --git a/include/rbtree.h b/include/rbtree.h
> index a512cf3..f608210 100644
> --- a/include/rbtree.h
> +++ b/include/rbtree.h
> @@ -8,7 +8,7 @@
>  #include <stddef.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  
>  #define	RB_RED		0
>  #define	RB_BLACK	1
> diff --git a/include/restorer.h b/include/restorer.h
> index 095f03d..97e9958 100644
> --- a/include/restorer.h
> +++ b/include/restorer.h
> @@ -5,7 +5,7 @@
>  #include <limits.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "image.h"
>  #include "lock.h"
>  #include "util.h"
> diff --git a/include/sk-queue.h b/include/sk-queue.h
> index 7d13410..6dd01c3 100644
> --- a/include/sk-queue.h
> +++ b/include/sk-queue.h
> @@ -1,7 +1,7 @@
>  #ifndef __CR_SK_QUEUE_H__
>  #define __CR_SK_QUEUE_H__
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "list.h"
>  #include "crtools.h"
>  #include "image.h"
> diff --git a/include/sockets.h b/include/sockets.h
> index 0deadb6..ed3ac09 100644
> --- a/include/sockets.h
> +++ b/include/sockets.h
> @@ -6,7 +6,7 @@
>  #include <unistd.h>
>  #include <stdbool.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  
>  #include "protobuf.h"
>  #include "../protobuf/sk-opts.pb-c.h"
> diff --git a/include/syscall-types.h b/include/syscall-types.h
> index 4285015..15713fc 100644
> --- a/include/syscall-types.h
> +++ b/include/syscall-types.h
> @@ -12,7 +12,7 @@
>  #include <arpa/inet.h>
>  #include <sched.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  
>  #ifndef CONFIG_X86_64
>  # error x86-32 bit mode not yet implemented
> diff --git a/include/syscall-x86-64.def b/include/syscall-x86-64.def
> deleted file mode 100644
> index 7121e60..0000000
> --- a/include/syscall-x86-64.def
> +++ /dev/null
> @@ -1,76 +0,0 @@
> -#
> -# System calls table, please make sure the table consist only the syscalls
> -# really used somewhere in project.
> -#
> -# The template is (name and srguments are optinal if you need only __NR_x
> -# defined, but no realy entry point in syscalls lib).
> -#
> -# name			code		name			arguments
> -# -----------------------------------------------------------------------
> -#
> -__NR_read		0		sys_read		(int fd, void *buf, unsigned long count)
> -__NR_write		1		sys_write		(int fd, const void *buf, unsigned long count)
> -__NR_open		2		sys_open		(const char *filename, unsigned long flags, unsigned long mode)
> -__NR_close		3		sys_close		(int fd)
> -__NR_lseek		8		sys_lseek		(int fd, unsigned long offset, unsigned long origin)
> -__NR_mmap		9		sys_mmap		(void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long offset)
> -__NR_mprotect		10		sys_mprotect		(const void *addr, unsigned long len, unsigned long prot)
> -__NR_munmap		11		sys_munmap		(void *addr, unsigned long len)
> -__NR_brk		12		sys_brk			(void *addr)
> -__NR_rt_sigaction	13		sys_sigaction		(int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
> -__NR_rt_sigprocmask	14		sys_sigprocmask		(int how, k_rtsigset_t *set, k_rtsigset_t *old, size_t sigsetsize)
> -__NR_rt_sigreturn	15		sys_rt_sigreturn	(void)
> -__NR_ioctl		16		sys_ioctl		(unsigned int fd, unsigned int cmd, unsigned long arg)
> -__NR_mremap		25		sys_mremap		(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, unsigned long new_addr)
> -__NR_mincore		27		sys_mincore		(void *addr, unsigned long size, unsigned char *vec)
> -__NR_madvise		28		sys_madvise		(unsigned long start, size_t len, int behavior)
> -__NR_shmat		30		sys_shmat		(int shmid, void *shmaddr, int shmflag)
> -__NR_pause		34		sys_pause		(void)
> -__NR_nanosleep		35		sys_nanosleep		(struct timespec *req, struct timespec *rem)
> -__NR_getitimer		36		sys_getitimer		(int which, const struct itimerval *val)
> -__NR_setitimer		38		sys_setitimer		(int which, const struct itimerval *val, struct itimerval *old)
> -__NR_getpid		39		sys_getpid		(void)
> -__NR_socket		41		sys_socket		(int domain, int type, int protocol)
> -__NR_connect		42		sys_connect		(int sockfd, struct sockaddr *addr, int addrlen)
> -__NR_sendmsg		46		sys_sendmsg		(int sockfd, const struct msghdr *msg, int flags)
> -__NR_recvmsg		47		sys_recvmsg		(int sockfd, struct msghdr *msg, int flags)
> -__NR_bind		49		sys_bind		(int sockfd, const struct sockaddr *addr, int addrlen)
> -__NR_setsockopt		54		sys_setsockopt		(int sockfd, int level, int optname, const void *optval, socklen_t optlen)
> -__NR_getsockopt		55		sys_getsockopt		(int sockfd, int level, int optname, const void *optval, socklen_t *optlen)
> -__NR_clone		56		sys_clone		(unsigned long flags, void *child_stack, void *parent_tid, void *child_tid)
> -__NR_exit		60		sys_exit		(unsigned long error_code)
> -__NR_wait4		61		sys_waitpid		(int pid, int *status, int options, struct rusage *ru)
> -__NR_kill		62		sys_kill		(long pid, int sig)
> -__NR_fcntl		72		sys_fcntl		(int fd, int type, long arg)
> -__NR_flock		73		sys_flock		(int fd, unsigned long cmd)
> -__NR_mkdir		83		sys_mkdir		(const char *name, int mode)
> -__NR_rmdir		84		sys_rmdir		(const char *name)
> -__NR_unlink		87		sys_unlink		(char *pathname)
> -__NR_readlink		89		sys_readlink		(const char *path, char *buf, int bufsize)
> -__NR_getgroups		115		sys_getgroups		(int gsize, unsigned int *groups)
> -__NR_setresuid		117		sys_setresuid		(int uid, int euid, int suid)
> -__NR_setresgid		119		sys_setresgid		(int gid, int egid, int sgid)
> -__NR_getpgid		121		sys_getpgid		(void)
> -__NR_setfsuid		122		sys_setfsuid		(int fsuid)
> -__NR_setfsgid		123		sys_setfsgid		(int fsgid)
> -__NR_getsid		124		sys_getsid		(void)
> -__NR_capset		126		sys_capset		(struct cap_header *h, struct cap_data *d)
> -__NR_personality	135		sys_personality		(unsigned int personality)
> -__NR_setpriority	141		sys_setpriority		(int which, int who, int nice)
> -__NR_sched_setscheduler	144		sys_sched_setscheduler	(int pid, int policy, struct sched_param *p)
> -__NR_prctl		157		sys_prctl		(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
> -__NR_arch_prctl		158		sys_arch_prctl		(int option, unsigned long addr)
> -__NR_mount		165		sys_mount		(char *dev_nmae, char *dir_name, char *type, unsigned long flags, void *data)
> -__NR_umount2		166		sys_umount2		(char *name, int flags)
> -__NR_gettid		186		sys_gettid		(void)
> -__NR_futex		202		sys_futex		(u32 *uaddr, int op, u32 val, struct timespec *utime, u32 *uaddr2, u32 val3)
> -__NR_set_thread_area	205		sys_set_thread_area	(user_desc_t *info)
> -__NR_get_thread_area	211		sys_get_thread_area	(user_desc_t *info)
> -__NR_set_tid_address	218		sys_set_tid_address	(int *tid_addr)
> -__NR_restart_syscall	219		sys_restart_syscall	(void)
> -__NR_exit_group		231		sys_exit_group		(int error_code)
> -__NR_set_robust_list	273		sys_set_robust_list	(struct robust_list_head *head, size_t len)
> -__NR_get_robust_list	274		sys_get_robust_list	(int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
> -__NR_open_by_handle_at	304		sys_open_by_handle_at	(int mountdirfd, struct file_handle *handle, int flags)
> -__NR_setns		308		sys_setns		(int fd, int nstype)
> -__NR_kcmp		312		sys_kcmp		(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2)
> diff --git a/include/types.h b/include/types.h
> deleted file mode 100644
> index f299752..0000000
> --- a/include/types.h
> +++ /dev/null
> @@ -1,248 +0,0 @@
> -#ifndef __CR_TYPES_H__
> -#define __CR_TYPES_H__
> -
> -#include <stdint.h>
> -#include <stdbool.h>
> -#include <signal.h>
> -
> -#include "bitops.h"
> -
> -/* prctl */
> -#define ARCH_SET_GS 0x1001
> -#define ARCH_SET_FS 0x1002
> -#define ARCH_GET_FS 0x1003
> -#define ARCH_GET_GS 0x1004
> -
> -#define FS_TLS 0
> -#define GS_TLS 1
> -
> -/* prctl.h */
> -#define PR_SET_NAME		15
> -#define PR_GET_NAME		16
> -
> -#define PR_CAPBSET_DROP		24
> -#define PR_GET_SECUREBITS	27
> -#define PR_SET_SECUREBITS	28
> -
> -#define SECURE_NO_SETUID_FIXUP	2
> -
> -#define PR_SET_MM		35
> -# define PR_SET_MM_START_CODE		1
> -# define PR_SET_MM_END_CODE		2
> -# define PR_SET_MM_START_DATA		3
> -# define PR_SET_MM_END_DATA		4
> -# define PR_SET_MM_START_STACK		5
> -# define PR_SET_MM_START_BRK		6
> -# define PR_SET_MM_BRK			7
> -# define PR_SET_MM_ARG_START		8
> -# define PR_SET_MM_ARG_END		9
> -# define PR_SET_MM_ENV_START		10
> -# define PR_SET_MM_ENV_END		11
> -# define PR_SET_MM_AUXV			12
> -# define PR_SET_MM_EXE_FILE		13
> -
> -#define PR_GET_TID_ADDRESS     40
> -
> -/* fcntl */
> -#ifndef F_LINUX_SPECIFIC_BASE
> -#define F_LINUX_SPECIFIC_BASE	1024
> -#endif
> -#ifndef F_SETPIPE_SZ
> -# define F_SETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 7)
> -#endif
> -#ifndef F_GETPIPE_SZ
> -# define F_GETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 8)
> -#endif
> -
> -#ifndef F_GETOWNER_UIDS
> -#define F_GETOWNER_UIDS	17
> -#endif
> -
> -#define CLONE_CHILD_USEPID      0x02000000
> -#define CLONE_VFORK		0x00004000
> -
> -#define SIGMAX			64
> -#define SIGMAX_OLD		31
> -
> -#define ERESTARTSYS		512
> -#define ERESTARTNOINTR		513
> -#define ERESTARTNOHAND		514
> -#define ERESTART_RESTARTBLOCK	516
> -
> -typedef uint64_t		u64;
> -typedef int64_t			s64;
> -typedef unsigned int		u32;
> -typedef signed int		s32;
> -typedef unsigned short		u16;
> -typedef signed short		s16;
> -typedef unsigned char		u8;
> -typedef signed char		s8;
> -
> -#define MAJOR(dev)		((dev)>>8)
> -#define MINOR(dev)		((dev) & 0xff)
> -
> -#define _LINUX_CAPABILITY_VERSION_3	0x20080522
> -#define _LINUX_CAPABILITY_U32S_3	2
> -
> -#ifdef CONFIG_X86_64
> -
> -typedef struct {
> -	unsigned long sig[1];
> -} rt_sigset_t;
> -
> -typedef void rt_signalfn_t(int, siginfo_t *, void *);
> -typedef rt_signalfn_t *rt_sighandler_t;
> -
> -typedef void rt_restorefn_t(void);
> -typedef rt_restorefn_t *rt_sigrestore_t;
> -
> -typedef struct {
> -	rt_sighandler_t	rt_sa_handler;
> -	unsigned long	rt_sa_flags;
> -	rt_sigrestore_t	rt_sa_restorer;
> -	rt_sigset_t	rt_sa_mask;
> -} rt_sigaction_t;
> -
> -#define _KNSIG           64
> -# define _NSIG_BPW      64
> -
> -#define _KNSIG_WORDS     (_KNSIG / _NSIG_BPW)
> -
> -typedef struct {
> -	unsigned long sig[_KNSIG_WORDS];
> -} k_rtsigset_t;
> -
> -static inline void ksigfillset(k_rtsigset_t *set)
> -{
> -	int i;
> -	for (i = 0; i < _KNSIG_WORDS; i++)
> -		set->sig[i] = (unsigned long)-1;
> -}
> -
> -typedef struct {
> -	unsigned int	entry_number;
> -	unsigned int	base_addr;
> -	unsigned int	limit;
> -	unsigned int	seg_32bit:1;
> -	unsigned int	contents:2;
> -	unsigned int	read_exec_only:1;
> -	unsigned int	limit_in_pages:1;
> -	unsigned int	seg_not_present:1;
> -	unsigned int	useable:1;
> -	unsigned int	lm:1;
> -} user_desc_t;
> -
> -typedef struct {
> -	unsigned long	r15;
> -	unsigned long	r14;
> -	unsigned long	r13;
> -	unsigned long	r12;
> -	unsigned long	bp;
> -	unsigned long	bx;
> -	unsigned long	r11;
> -	unsigned long	r10;
> -	unsigned long	r9;
> -	unsigned long	r8;
> -	unsigned long	ax;
> -	unsigned long	cx;
> -	unsigned long	dx;
> -	unsigned long	si;
> -	unsigned long	di;
> -	unsigned long	orig_ax;
> -	unsigned long	ip;
> -	unsigned long	cs;
> -	unsigned long	flags;
> -	unsigned long	sp;
> -	unsigned long	ss;
> -	unsigned long	fs_base;
> -	unsigned long	gs_base;
> -	unsigned long	ds;
> -	unsigned long	es;
> -	unsigned long	fs;
> -	unsigned long	gs;
> -} user_regs_struct_t;
> -
> -typedef struct {
> -	unsigned short	cwd;
> -	unsigned short	swd;
> -	unsigned short	twd;	/* Note this is not the same as
> -				   the 32bit/x87/FSAVE twd */
> -	unsigned short	fop;
> -	u64		rip;
> -	u64		rdp;
> -	u32		mxcsr;
> -	u32		mxcsr_mask;
> -	u32		st_space[32];	/* 8*16 bytes for each FP-reg = 128 bytes */
> -	u32		xmm_space[64];	/* 16*16 bytes for each XMM-reg = 256 bytes */
> -	u32		padding[24];
> -} user_fpregs_struct_t;
> -
> -#else /* CONFIG_X86_64 */
> -# error x86-32 bit mode not yet implemented
> -#endif /* CONFIG_X86_64 */
> -
> -#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
> -#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
> -
> -#ifndef PAGE_SIZE
> -# define PAGE_SIZE	4096
> -#endif
> -
> -#ifndef PAGE_MASK
> -# define PAGE_MASK	(~(PAGE_SIZE - 1))
> -#endif
> -
> -/* For sys_kcmp */
> -enum kcmp_type {
> -	KCMP_FILE,
> -	KCMP_VM,
> -	KCMP_FILES,
> -	KCMP_FS,
> -	KCMP_SIGHAND,
> -	KCMP_IO,
> -	KCMP_SYSVSEM,
> -
> -	KCMP_TYPES,
> -};
> -
> -/* For UNIX sockets data */
> -#ifndef SCM_MAX_FD
> -# define SCM_MAX_FD	253
> -#endif
> -
> -#include <fcntl.h>
> -
> -#ifndef F_SETOWN_EX
> -#define F_SETOWN_EX	15
> -#define F_GETOWN_EX	16
> -
> -struct f_owner_ex {
> -	int	type;
> -	pid_t	pid;
> -};
> -#endif
> -
> -/* File handle */
> -typedef struct {
> -	u32 bytes;
> -	u32 type;
> -	u64 __handle[16];
> -} fh_t;
> -
> -#ifndef MAP_HUGETLB
> -# define MAP_HUGETLB 0x40000
> -#endif
> -
> -#ifndef MADV_HUGEPAGE
> -# define MADV_HUGEPAGE 14
> -#endif
> -
> -#ifndef MADV_NOHUGEPAGE
> -# define MADV_NOHUGEPAGE 15
> -#endif
> -
> -#ifndef MADV_DONTDUMP
> -# define MADV_DONTDUMP 16
> -#endif
> -
> -#endif /* __CR_TYPES_H__ */
> diff --git a/include/unix_diag.h b/include/unix_diag.h
> index 7e7dd33..3f24683 100644
> --- a/include/unix_diag.h
> +++ b/include/unix_diag.h
> @@ -1,7 +1,7 @@
>  #ifndef __CR_UNIX_DIAG_H__
>  #define __CR_UNIX_DIAG_H__
>  
> -#include "types.h"
> +#include "asm/types.h"
>  
>  struct unix_diag_req {
>  	u8	sdiag_family;
> diff --git a/include/util.h b/include/util.h
> index d3c85fc..0fa5003 100644
> --- a/include/util.h
> +++ b/include/util.h
> @@ -13,7 +13,7 @@
>  #include <dirent.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "log.h"
>  
>  #include "../protobuf/vma.pb-c.h"
> diff --git a/inotify.c b/inotify.c
> index 1e54288..c7f7365 100644
> --- a/inotify.c
> +++ b/inotify.c
> @@ -20,7 +20,7 @@
>  #include <aio.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "inotify.h"
>  #include "proc_parse.h"
>  #include "syscall.h"
> diff --git a/kcmp-ids.c b/kcmp-ids.c
> index 6823586..3f75cff 100644
> --- a/kcmp-ids.c
> +++ b/kcmp-ids.c
> @@ -1,6 +1,6 @@
>  #include <unistd.h>
>  #include <stdlib.h>
> -#include "types.h"
> +#include "asm/types.h"
>  #include "rbtree.h"
>  #include "util.h"
>  #include "syscall.h"
> diff --git a/log.c b/log.c
> index 5fa1c6b..c02dff2 100644
> --- a/log.c
> +++ b/log.c
> @@ -13,7 +13,7 @@
>  #include <fcntl.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "util.h"
>  #include "crtools.h"
>  
> diff --git a/mount.c b/mount.c
> index a4c31b9..1069928 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -13,7 +13,7 @@
>  #include <sys/wait.h>
>  
>  #include "crtools.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "util.h"
>  #include "log.h"
>  #include "mount.h"
> diff --git a/netfilter.c b/netfilter.c
> index 44dc0f9..13ba3c8 100644
> --- a/netfilter.c
> +++ b/netfilter.c
> @@ -5,7 +5,7 @@
>  #include <wait.h>
>  #include <stdlib.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "util.h"
>  #include "list.h"
>  #include "files.h"
> diff --git a/parasite-syscall.c b/parasite-syscall.c
> index 5e01450..26de3ad 100644
> --- a/parasite-syscall.c
> +++ b/parasite-syscall.c
> @@ -11,7 +11,7 @@
>  
>  #include "syscall.h"
>  #include "ptrace.h"
> -#include "processor-flags.h"
> +#include "asm/processor-flags.h"
>  #include "parasite-syscall.h"
>  #include "parasite-blob.h"
>  #include "parasite.h"
> diff --git a/pie/Makefile b/pie/Makefile
> index efb7532..49c22d8 100644
> --- a/pie/Makefile
> +++ b/pie/Makefile
> @@ -3,7 +3,7 @@ CFLAGS		+=  -fpie  -Wa,--noexecstack -fno-strict-aliasing
>  
>  GEN-OFFSETS	:= gen-offsets.sh
>  
> -PASM-OBJS	+= parasite-head-x86-64.o
> +PASM-OBJS	+= $(ARCH_DIR)/parasite-head.o
>  
>  PARASITE	+= parasite.bin.o parasite.bin
>  RESTORER	:= restorer.bin.o restorer.bin
> diff --git a/pie/parasite-head-x86-64.S b/pie/parasite-head-x86-64.S
> deleted file mode 100644
> index a2c12dc..0000000
> --- a/pie/parasite-head-x86-64.S
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#include "linkage.h"
> -#include "parasite.h"
> -
> -	.section .head.text, "ax"
> -ENTRY(__export_parasite_head_start)
> -	leaq	__export_parasite_stack(%rip), %rsp
> -	subq	$16, %rsp
> -	andq	$~15, %rsp
> -	pushq	$0
> -	movq	%rsp, %rbp
> -	movl	__export_parasite_cmd(%rip), %edi
> -	leaq	__export_parasite_args(%rip), %rsi
> -	call	parasite_service
> -	int	$0x03
> -	.align 8
> -__export_parasite_cmd:
> -	.long 0
> -__export_parasite_args:
> -	.long 0
> -	.space PARASITE_ARG_SIZE,0
> -	.space PARASITE_STACK_SIZE,0
> -__export_parasite_stack:
> -	.long 0
> -END(__export_parasite_head_start)
> diff --git a/pie/restorer.c b/pie/restorer.c
> index 03536ae..337577a 100644
> --- a/pie/restorer.c
> +++ b/pie/restorer.c
> @@ -14,7 +14,7 @@
>  #include <sys/resource.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "syscall.h"
>  #include "log.h"
>  #include "util.h"
> diff --git a/proc_parse.c b/proc_parse.c
> index a7de1d1..81bf11c 100644
> --- a/proc_parse.c
> +++ b/proc_parse.c
> @@ -9,7 +9,7 @@
>  #include <string.h>
>  #include <linux/fs.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "list.h"
>  #include "util.h"
>  #include "crtools.h"
> diff --git a/protobuf.c b/protobuf.c
> index f5ec1ea..5213d48 100644
> --- a/protobuf.c
> +++ b/protobuf.c
> @@ -10,7 +10,7 @@
>  
>  #include "crtools.h"
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "log.h"
>  #include "util.h"
>  #include "string.h"
> diff --git a/ptrace.c b/ptrace.c
> index 66de9f4..0140918 100644
> --- a/ptrace.c
> +++ b/ptrace.c
> @@ -15,7 +15,7 @@
>  
>  #include "crtools.h"
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "util.h"
>  #include "ptrace.h"
>  #include "proc_parse.h"
> diff --git a/signalfd.c b/signalfd.c
> index 578fec0..91c14d6 100644
> --- a/signalfd.c
> +++ b/signalfd.c
> @@ -3,7 +3,7 @@
>  #include <sys/signalfd.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "signalfd.h"
>  #include "proc_parse.h"
>  #include "crtools.h"
> diff --git a/sk-inet.c b/sk-inet.c
> index 19a413b..25581ba 100644
> --- a/sk-inet.c
> +++ b/sk-inet.c
> @@ -9,7 +9,7 @@
>  #include <string.h>
>  #include <stdlib.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "libnetlink.h"
>  #include "crtools.h"
>  #include "inet_diag.h"
> diff --git a/sk-packet.c b/sk-packet.c
> index a82825a..0e85d36 100644
> --- a/sk-packet.c
> +++ b/sk-packet.c
> @@ -5,7 +5,7 @@
>  #include <unistd.h>
>  #include <string.h>
>  #include "crtools.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "files.h"
>  #include "sockets.h"
>  #include "libnetlink.h"
> diff --git a/sk-queue.c b/sk-queue.c
> index b96daaa..4f9a743 100644
> --- a/sk-queue.c
> +++ b/sk-queue.c
> @@ -10,7 +10,7 @@
>  #include <sys/socket.h>
>  #include <sys/sendfile.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "list.h"
>  #include "image.h"
>  #include "crtools.h"
> diff --git a/sk-tcp.c b/sk-tcp.c
> index c7c2c15..ebf9815 100644
> --- a/sk-tcp.c
> +++ b/sk-tcp.c
> @@ -10,7 +10,7 @@
>  #include "util.h"
>  #include "list.h"
>  #include "log.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "files.h"
>  #include "sockets.h"
>  #include "files.h"
> diff --git a/sk-unix.c b/sk-unix.c
> index b2081fb..c6ec844 100644
> --- a/sk-unix.c
> +++ b/sk-unix.c
> @@ -8,7 +8,7 @@
>  #include <sys/un.h>
>  #include <stdlib.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "libnetlink.h"
>  #include "crtools.h"
>  #include "unix_diag.h"
> diff --git a/sysctl.c b/sysctl.c
> index a7bb6e3..92fc153 100644
> --- a/sysctl.c
> +++ b/sysctl.c
> @@ -4,7 +4,7 @@
>  #include <string.h>
>  #include <stdlib.h>
>  
> -#include "types.h"
> +#include "asm/types.h"
>  #include "sysctl.h"
>  #include "util.h"
>  
> diff --git a/tty.c b/tty.c
> index f5f10f9..e084059 100644
> --- a/tty.c
> +++ b/tty.c
> @@ -13,7 +13,7 @@
>  #include <linux/major.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  
>  #include "syscall.h"
>  #include "files.h"
> diff --git a/util-net.c b/util-net.c
> index 0feae03..3aace3d 100644
> --- a/util-net.c
> +++ b/util-net.c
> @@ -4,8 +4,8 @@
>  #include <errno.h>
>  
>  #include "compiler.h"
> -#include "memcpy_64.h"
> -#include "types.h"
> +#include "asm/memcpy_64.h"
> +#include "asm/types.h"
>  #include "syscall.h"
>  
>  #include "util-net.h"
> diff --git a/util.c b/util.c
> index 59ed831..90c82f7 100644
> --- a/util.c
> +++ b/util.c
> @@ -30,7 +30,7 @@
>  #include <sys/wait.h>
>  
>  #include "compiler.h"
> -#include "types.h"
> +#include "asm/types.h"
>  #include "list.h"
>  #include "util.h"
>  
> 




More information about the CRIU mailing list