diff --git a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h index eabf1f22f..eeb68be69 100644 --- a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h +++ b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h @@ -24,11 +24,6 @@ typedef struct user_fpsimd_state user_fpregs_struct_t; #define user_regs_native(pregs) true -#define AT_VECTOR_SIZE 40 - -typedef uint64_t auxv_t; -typedef uint64_t tls_t; - #define ARCH_SI_TRAP TRAP_BRKPT #define __NR(syscall, compat) __NR_##syscall diff --git a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h index b532c7dd9..03442ee2b 100644 --- a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h +++ b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h @@ -58,11 +58,6 @@ struct user_vfp_exc { #define user_regs_native(pregs) true -#define AT_VECTOR_SIZE 40 - -typedef uint32_t auxv_t; -typedef uint32_t tls_t; - #define ARCH_SI_TRAP TRAP_BRKPT #define __NR(syscall, compat) __NR_##syscall diff --git a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h index ecf643d68..4b8a20055 100644 --- a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h +++ b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h @@ -78,21 +78,6 @@ typedef struct { #define user_regs_native(pregs) true -/* - * Copied from the following kernel header files : - * include/linux/auxvec.h - * arch/powerpc/include/uapi/asm/auxvec.h - * include/linux/mm_types.h - */ -#define AT_VECTOR_SIZE_BASE 20 -#define AT_VECTOR_SIZE_ARCH 6 -#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1)) - -typedef uint64_t auxv_t; - -/* Not used but the structure parasite_dump_thread needs a tls_t field */ -typedef uint64_t tls_t; - #define ARCH_SI_TRAP TRAP_BRKPT #define __NR(syscall, compat) __NR_##syscall diff --git a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h index cb12ff00f..55fcd8106 100644 --- a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h +++ b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h @@ -124,25 +124,14 @@ typedef struct xsave_struct user_fpregs_struct_t; #define REG_IP(regs) get_user_reg(®s, ip) #define REG_SYSCALL_NR(regs) get_user_reg(®s, orig_ax) -typedef uint64_t auxv_t; +#define __NR(syscall, compat) ((compat) ? __NR32_##syscall : __NR_##syscall) /* - * Linux preserves three TLS segments in GDT. - * Offsets in GDT differ between 32-bit and 64-bit machines. - * For 64-bit x86 those GDT offsets are the same - * for native and compat tasks. + * For x86_32 __NR_mmap inside the kernel represents old_mmap system + * call, but since we didn't use it yet lets go further and simply + * define own alias for __NR_mmap2 which would allow us to unify code + * between 32 and 64 bits version. */ -#define GDT_ENTRY_TLS_MIN 12 -#define GDT_ENTRY_TLS_MAX 14 -#define GDT_ENTRY_TLS_NUM 3 -typedef struct { - user_desc_t desc[GDT_ENTRY_TLS_NUM]; -} tls_t; - -#define REG_RES(regs) get_user_reg(®s, ax) -#define REG_IP(regs) get_user_reg(®s, ip) -#define REG_SYSCALL_NR(regs) get_user_reg(®s, orig_ax) - -#define AT_VECTOR_SIZE 44 +#define __NR32_mmap __NR32_mmap2 #endif /* UAPI_COMPEL_ASM_TYPES_H__ */ diff --git a/criu/arch/aarch64/include/asm/types.h b/criu/arch/aarch64/include/asm/types.h index a84aea18e..e79f86698 100644 --- a/criu/arch/aarch64/include/asm/types.h +++ b/criu/arch/aarch64/include/asm/types.h @@ -25,4 +25,8 @@ typedef UserAarch64RegsEntry UserRegsEntry; static inline void *decode_pointer(uint64_t v) { return (void*)v; } static inline uint64_t encode_pointer(void *p) { return (uint64_t)p; } +#define AT_VECTOR_SIZE 40 +typedef uint64_t auxv_t; +typedef uint64_t tls_t; + #endif /* __CR_ASM_TYPES_H__ */ diff --git a/criu/arch/arm/include/asm/types.h b/criu/arch/arm/include/asm/types.h index 99543fa9e..32612a692 100644 --- a/criu/arch/arm/include/asm/types.h +++ b/criu/arch/arm/include/asm/types.h @@ -24,4 +24,8 @@ typedef UserArmRegsEntry UserRegsEntry; static inline void *decode_pointer(u64 v) { return (void*)(u32)v; } static inline u64 encode_pointer(void *p) { return (u32)p; } +#define AT_VECTOR_SIZE 40 +typedef uint32_t auxv_t; +typedef uint32_t tls_t; + #endif /* __CR_ASM_TYPES_H__ */ diff --git a/criu/arch/ppc64/include/asm/types.h b/criu/arch/ppc64/include/asm/types.h index a23d50035..a82bc71a8 100644 --- a/criu/arch/ppc64/include/asm/types.h +++ b/criu/arch/ppc64/include/asm/types.h @@ -22,4 +22,19 @@ typedef UserPpc64RegsEntry UserRegsEntry; static inline void *decode_pointer(uint64_t v) { return (void*)v; } static inline uint64_t encode_pointer(void *p) { return (uint64_t)p; } +/* + * Copied from the following kernel header files : + * include/linux/auxvec.h + * arch/powerpc/include/uapi/asm/auxvec.h + * include/linux/mm_types.h + */ +#define AT_VECTOR_SIZE_BASE 20 +#define AT_VECTOR_SIZE_ARCH 6 +#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1)) + +typedef uint64_t auxv_t; + +/* Not used but the structure parasite_dump_thread needs a tls_t field */ +typedef uint64_t tls_t; + #endif /* __CR_ASM_TYPES_H__ */ diff --git a/criu/arch/x86/include/asm/types.h b/criu/arch/x86/include/asm/types.h index dbf284035..4a93ffdeb 100644 --- a/criu/arch/x86/include/asm/types.h +++ b/criu/arch/x86/include/asm/types.h @@ -37,4 +37,20 @@ typedef UserX86RegsEntry UserRegsEntry; static inline u64 encode_pointer(void *p) { return (u64)(long)p; } static inline void *decode_pointer(u64 v) { return (void*)(long)v; } +#define AT_VECTOR_SIZE 44 +typedef uint64_t auxv_t; + +/* + * Linux preserves three TLS segments in GDT. + * Offsets in GDT differ between 32-bit and 64-bit machines. + * For 64-bit x86 those GDT offsets are the same + * for native and compat tasks. + */ +#define GDT_ENTRY_TLS_MIN 12 +#define GDT_ENTRY_TLS_MAX 14 +#define GDT_ENTRY_TLS_NUM 3 +typedef struct { + user_desc_t desc[GDT_ENTRY_TLS_NUM]; +} tls_t; + #endif /* __CR_ASM_TYPES_H__ */