diff --git a/compel/Makefile b/compel/Makefile index 204e19f0c..159a3e1cc 100644 --- a/compel/Makefile +++ b/compel/Makefile @@ -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 diff --git a/compel/arch/x86/plugins/std/parasite-head-compat.S b/compel/arch/x86/plugins/std/parasite-head-compat.S deleted file mode 100644 index f08cc1c3c..000000000 --- a/compel/arch/x86/plugins/std/parasite-head-compat.S +++ /dev/null @@ -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) diff --git a/compel/arch/x86/src/lib/handle-elf.c b/compel/arch/x86/src/lib/handle-elf.c index 38e27abd3..62fb28f49 100644 --- a/compel/arch/x86/src/lib/handle-elf.c +++ b/compel/arch/x86/src/lib/handle-elf.c @@ -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"); diff --git a/compel/arch/x86/src/lib/include/handle-elf.h b/compel/arch/x86/src/lib/include/handle-elf.h index bfc935a4e..08de8363f 100644 --- a/compel/arch/x86/src/lib/include/handle-elf.h +++ b/compel/arch/x86/src/lib/include/handle-elf.h @@ -1,17 +1,6 @@ #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); 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 55fcd8106..af42461ae 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 @@ -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 { diff --git a/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h b/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h index a939bbee1..21cd341c0 100644 --- a/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h +++ b/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h @@ -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); diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c index 53f29cfbf..d86e0a811 100644 --- a/compel/arch/x86/src/lib/infect.c +++ b/compel/arch/x86/src/lib/infect.c @@ -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; } diff --git a/compel/src/lib/handle-elf-32-host.c b/compel/src/lib/handle-elf-32-host.c deleted file mode 120000 index 126cd5984..000000000 --- a/compel/src/lib/handle-elf-32-host.c +++ /dev/null @@ -1 +0,0 @@ -handle-elf-32.c \ No newline at end of file diff --git a/compel/src/lib/handle-elf-32.c b/compel/src/lib/handle-elf-32.c deleted file mode 120000 index fe4611886..000000000 --- a/compel/src/lib/handle-elf-32.c +++ /dev/null @@ -1 +0,0 @@ -handle-elf.c \ No newline at end of file