Commit b729c187 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

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: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 909590a3
......@@ -33,29 +33,15 @@ CFLAGS += -DNO_RELOCS
HOSTCFLAGS += -DNO_RELOCS
endif
ifeq ($(ARCH),x86)
obj-y += src/lib/handle-elf-32.o
endif
obj-y += src/main.o
obj-y += arch/$(ARCH)/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)
hostprogs-y += compel-host-bin
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-host-bin
cleanup-y += compel/libcompel.so
......
#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,
};
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)
{
if (memcmp(mem, elf_ident_32, sizeof(elf_ident_32)) == 0)
return handle_elf_x86_32(mem, size);
else if (memcmp(mem, elf_ident_64_le, sizeof(elf_ident_64_le)) == 0)
if (memcmp(mem, elf_ident_64_le, sizeof(elf_ident_64_le)) == 0)
return handle_elf_x86_64(mem, size);
pr_err("Unsupported Elf format detected\n");
......
#ifndef 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"
#define ELF_X86_64
......@@ -19,8 +8,6 @@
#define __handle_elf handle_elf_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_64(void *mem, size_t size);
......
......@@ -59,7 +59,6 @@ typedef struct {
uint32_t ss;
} user_regs_struct32;
#ifdef CONFIG_X86_64
/*
* To be sure that we rely on inited reg->__is_native, this member
* 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)) ? \
((pregs)->native.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
typedef struct {
......
......@@ -83,10 +83,6 @@ typedef struct compat_siginfo {
int _pad[128/sizeof(int) - 3];
} compat_siginfo_t;
#ifdef CONFIG_X86_32
#define rt_sigframe_ia32 rt_sigframe
#endif
typedef struct compat_sigaltstack {
compat_uptr_t ss_sp;
int ss_flags;
......@@ -106,11 +102,7 @@ struct rt_sigframe_ia32 {
int32_t sig;
uint32_t pinfo;
uint32_t puc;
#ifdef CONFIG_X86_64
compat_siginfo_t info;
#else
struct rt_siginfo info;
#endif
struct ucontext_ia32 uc;
char retcode[8];
......@@ -118,7 +110,6 @@ struct rt_sigframe_ia32 {
fpu_state_t fpu_state;
};
#ifdef CONFIG_X86_64
struct rt_sigframe_64 {
char *pretcode;
struct rt_ucontext uc;
......@@ -194,24 +185,6 @@ do { \
else \
ARCH_RT_SIGRETURN_COMPAT(new_sp); \
} 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,
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);
}
#ifdef CONFIG_X86_64
# define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
#else
#define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
/*
* Task size may be limited to 3G but we need a
* higher limit, because it's backward compatible.
*/
# define TASK_SIZE (0xffffe000)
#endif
#define TASK_SIZE_IA32 (0xffffe000)
unsigned long compel_task_size(void) { return TASK_SIZE; }
handle-elf-32.c
\ No newline at end of file
handle-elf.c
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment