mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +00:00
compel: arch,x86 -- Drop native ia32 pieces
It was never functional neither we plan to support native ia32 mode, so drop these incomplete code pieces out. - Presumably we will need TASK_SIZE for compat mode so I provide TASK_SIZE_IA32 for this sake - 32 bit syscalls are remaining for a while Acked-by: Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
909590a355
commit
b729c187d5
@@ -33,29 +33,15 @@ CFLAGS += -DNO_RELOCS
|
|||||||
HOSTCFLAGS += -DNO_RELOCS
|
HOSTCFLAGS += -DNO_RELOCS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ARCH),x86)
|
|
||||||
obj-y += src/lib/handle-elf-32.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
obj-y += src/main.o
|
obj-y += src/main.o
|
||||||
obj-y += arch/$(ARCH)/src/lib/handle-elf.o
|
obj-y += arch/$(ARCH)/src/lib/handle-elf.o
|
||||||
obj-y += src/lib/handle-elf.o
|
obj-y += src/lib/handle-elf.o
|
||||||
|
|
||||||
ifeq ($(ARCH),x86)
|
|
||||||
CFLAGS_handle-elf-32.o += -UCONFIG_X86_64 -DCONFIG_X86_32
|
|
||||||
CFLAGS_handle-elf-32.d += -UCONFIG_X86_64 -DCONFIG_X86_32
|
|
||||||
endif
|
|
||||||
|
|
||||||
host-ccflags-y += $(ccflags-y)
|
host-ccflags-y += $(ccflags-y)
|
||||||
|
|
||||||
hostprogs-y += compel-host-bin
|
hostprogs-y += compel-host-bin
|
||||||
compel-host-bin-objs := $(patsubst %.o,%-host.o,$(obj-y) $(host-lib-y))
|
compel-host-bin-objs := $(patsubst %.o,%-host.o,$(obj-y) $(host-lib-y))
|
||||||
|
|
||||||
ifeq ($(ARCH),x86)
|
|
||||||
HOSTCFLAGS_handle-elf-32-host.o += -UCONFIG_X86_64 -DCONFIG_X86_32
|
|
||||||
HOSTCFLAGS_handle-elf-32-host.d += -UCONFIG_X86_64 -DCONFIG_X86_32
|
|
||||||
endif
|
|
||||||
|
|
||||||
cleanup-y += compel/compel
|
cleanup-y += compel/compel
|
||||||
cleanup-y += compel/compel-host-bin
|
cleanup-y += compel/compel-host-bin
|
||||||
cleanup-y += compel/libcompel.so
|
cleanup-y += compel/libcompel.so
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
#include "common/asm/linkage.h"
|
|
||||||
|
|
||||||
.section .head.text, "ax"
|
|
||||||
|
|
||||||
#ifndef CONFIG_X86_32
|
|
||||||
# error 32-bit parasite should compile with CONFIG_X86_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ENTRY(__export_parasite_head_start)
|
|
||||||
subl $16, %esp
|
|
||||||
andl $~15, %esp
|
|
||||||
pushl $0
|
|
||||||
movl %esp, %ebp
|
|
||||||
call 1f
|
|
||||||
1: popl %ecx
|
|
||||||
movl (__export_parasite_cmd-1b)(%ecx), %eax
|
|
||||||
leal (__export_parasite_args-1b)(%ecx), %edx
|
|
||||||
call parasite_service
|
|
||||||
int $0x03
|
|
||||||
.align 8
|
|
||||||
GLOBAL(__export_parasite_cmd)
|
|
||||||
.long 0
|
|
||||||
END(__export_parasite_head_start)
|
|
@@ -12,17 +12,9 @@ elf_ident_64_le[EI_NIDENT] = {
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned char __maybe_unused
|
|
||||||
elf_ident_32[EI_NIDENT] = {
|
|
||||||
0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
};
|
|
||||||
|
|
||||||
int handle_binary(void *mem, size_t size)
|
int handle_binary(void *mem, size_t size)
|
||||||
{
|
{
|
||||||
if (memcmp(mem, elf_ident_32, sizeof(elf_ident_32)) == 0)
|
if (memcmp(mem, elf_ident_64_le, sizeof(elf_ident_64_le)) == 0)
|
||||||
return handle_elf_x86_32(mem, size);
|
|
||||||
else if (memcmp(mem, elf_ident_64_le, sizeof(elf_ident_64_le)) == 0)
|
|
||||||
return handle_elf_x86_64(mem, size);
|
return handle_elf_x86_64(mem, size);
|
||||||
|
|
||||||
pr_err("Unsupported Elf format detected\n");
|
pr_err("Unsupported Elf format detected\n");
|
||||||
|
@@ -1,17 +1,6 @@
|
|||||||
#ifndef COMPEL_HANDLE_ELF_H__
|
#ifndef COMPEL_HANDLE_ELF_H__
|
||||||
#define COMPEL_HANDLE_ELF_H__
|
#define COMPEL_HANDLE_ELF_H__
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
|
||||||
|
|
||||||
#include "elf32-types.h"
|
|
||||||
|
|
||||||
#define ELF_X86_32
|
|
||||||
|
|
||||||
#define __handle_elf handle_elf_x86_32
|
|
||||||
#define arch_is_machine_supported(e_machine) (e_machine == EM_386)
|
|
||||||
|
|
||||||
#else /* CONFIG_X86_64 */
|
|
||||||
|
|
||||||
#include "elf64-types.h"
|
#include "elf64-types.h"
|
||||||
|
|
||||||
#define ELF_X86_64
|
#define ELF_X86_64
|
||||||
@@ -19,8 +8,6 @@
|
|||||||
#define __handle_elf handle_elf_x86_64
|
#define __handle_elf handle_elf_x86_64
|
||||||
#define arch_is_machine_supported(e_machine) (e_machine == EM_X86_64)
|
#define arch_is_machine_supported(e_machine) (e_machine == EM_X86_64)
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int handle_elf_x86_32(void *mem, size_t size);
|
extern int handle_elf_x86_32(void *mem, size_t size);
|
||||||
extern int handle_elf_x86_64(void *mem, size_t size);
|
extern int handle_elf_x86_64(void *mem, size_t size);
|
||||||
|
|
||||||
|
@@ -59,7 +59,6 @@ typedef struct {
|
|||||||
uint32_t ss;
|
uint32_t ss;
|
||||||
} user_regs_struct32;
|
} user_regs_struct32;
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
|
||||||
/*
|
/*
|
||||||
* To be sure that we rely on inited reg->__is_native, this member
|
* To be sure that we rely on inited reg->__is_native, this member
|
||||||
* is (short int) instead of initial (bool). The right way to
|
* is (short int) instead of initial (bool). The right way to
|
||||||
@@ -90,16 +89,6 @@ static inline bool user_regs_native(user_regs_struct_t *pregs)
|
|||||||
((user_regs_native(pregs)) ? \
|
((user_regs_native(pregs)) ? \
|
||||||
((pregs)->native.name = (val)) : \
|
((pregs)->native.name = (val)) : \
|
||||||
((pregs)->compat.name = (val)))
|
((pregs)->compat.name = (val)))
|
||||||
#else
|
|
||||||
typedef struct {
|
|
||||||
union {
|
|
||||||
user_regs_struct32 native;
|
|
||||||
};
|
|
||||||
} user_regs_struct_t;
|
|
||||||
#define user_regs_native(pregs) true
|
|
||||||
#define get_user_reg(pregs, name) ((pregs)->native.name)
|
|
||||||
#define set_user_reg(pregs, name, val) ((pregs)->native.name = val)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@@ -83,10 +83,6 @@ typedef struct compat_siginfo {
|
|||||||
int _pad[128/sizeof(int) - 3];
|
int _pad[128/sizeof(int) - 3];
|
||||||
} compat_siginfo_t;
|
} compat_siginfo_t;
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
|
||||||
#define rt_sigframe_ia32 rt_sigframe
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct compat_sigaltstack {
|
typedef struct compat_sigaltstack {
|
||||||
compat_uptr_t ss_sp;
|
compat_uptr_t ss_sp;
|
||||||
int ss_flags;
|
int ss_flags;
|
||||||
@@ -106,11 +102,7 @@ struct rt_sigframe_ia32 {
|
|||||||
int32_t sig;
|
int32_t sig;
|
||||||
uint32_t pinfo;
|
uint32_t pinfo;
|
||||||
uint32_t puc;
|
uint32_t puc;
|
||||||
#ifdef CONFIG_X86_64
|
|
||||||
compat_siginfo_t info;
|
compat_siginfo_t info;
|
||||||
#else
|
|
||||||
struct rt_siginfo info;
|
|
||||||
#endif
|
|
||||||
struct ucontext_ia32 uc;
|
struct ucontext_ia32 uc;
|
||||||
char retcode[8];
|
char retcode[8];
|
||||||
|
|
||||||
@@ -118,7 +110,6 @@ struct rt_sigframe_ia32 {
|
|||||||
fpu_state_t fpu_state;
|
fpu_state_t fpu_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
|
||||||
struct rt_sigframe_64 {
|
struct rt_sigframe_64 {
|
||||||
char *pretcode;
|
char *pretcode;
|
||||||
struct rt_ucontext uc;
|
struct rt_ucontext uc;
|
||||||
@@ -194,24 +185,6 @@ do { \
|
|||||||
else \
|
else \
|
||||||
ARCH_RT_SIGRETURN_COMPAT(new_sp); \
|
ARCH_RT_SIGRETURN_COMPAT(new_sp); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else /* CONFIG_X86_64 */
|
|
||||||
#define RT_SIGFRAME_UC(rt_sigframe) (&rt_sigframe->uc)
|
|
||||||
#define RT_SIGFRAME_OFFSET(rt_sigframe) 4
|
|
||||||
#define RT_SIGFRAME_REGIP(rt_sigframe) \
|
|
||||||
(unsigned long)(rt_sigframe)->uc.uc_mcontext.ip
|
|
||||||
#define RT_SIGFRAME_FPU(rt_sigframe) (&(rt_sigframe)->fpu_state)
|
|
||||||
#define RT_SIGFRAME_HAS_FPU(rt_sigframe) (RT_SIGFRAME_FPU(rt_sigframe)->has_fpu)
|
|
||||||
|
|
||||||
#define ARCH_RT_SIGRETURN(new_sp, rt_sigframe) \
|
|
||||||
asm volatile( \
|
|
||||||
"movl %0, %%eax \n" \
|
|
||||||
"movl %%eax, %%esp \n" \
|
|
||||||
"movl $"__stringify(__NR_rt_sigreturn)", %%eax \n" \
|
|
||||||
"int $0x80 \n" \
|
|
||||||
: \
|
|
||||||
: "r"(new_sp) \
|
|
||||||
: "eax","esp","memory")
|
|
||||||
#endif /* CONFIG_X86_64 */
|
|
||||||
|
|
||||||
int sigreturn_prep_fpu_frame(struct rt_sigframe *sigframe,
|
int sigreturn_prep_fpu_frame(struct rt_sigframe *sigframe,
|
||||||
struct rt_sigframe *rsigframe);
|
struct rt_sigframe *rsigframe);
|
||||||
|
@@ -425,14 +425,11 @@ int ptrace_set_regs(pid_t pid, user_regs_struct_t *regs)
|
|||||||
return ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &iov);
|
return ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &iov);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
#define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
|
||||||
# define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
|
|
||||||
#else
|
|
||||||
/*
|
/*
|
||||||
* Task size may be limited to 3G but we need a
|
* Task size may be limited to 3G but we need a
|
||||||
* higher limit, because it's backward compatible.
|
* higher limit, because it's backward compatible.
|
||||||
*/
|
*/
|
||||||
# define TASK_SIZE (0xffffe000)
|
#define TASK_SIZE_IA32 (0xffffe000)
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned long compel_task_size(void) { return TASK_SIZE; }
|
unsigned long compel_task_size(void) { return TASK_SIZE; }
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
handle-elf-32.c
|
|
@@ -1 +0,0 @@
|
|||||||
handle-elf.c
|
|
Reference in New Issue
Block a user