[CRIU] [PATCH 3/3] x86/compat: Remove call32_from_64() helper

Dmitry Safonov dima at arista.com
Wed Oct 31 01:35:31 MSK 2018


It looks like, this one is no more needed.
You were a hard child, RIP.

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 criu/arch/x86/Makefile             |  1 -
 criu/arch/x86/call32.S             | 83 ------------------------------
 criu/arch/x86/include/asm/compat.h |  5 --
 criu/pie/Makefile                  |  1 -
 4 files changed, 90 deletions(-)
 delete mode 100644 criu/arch/x86/call32.S

diff --git a/criu/arch/x86/Makefile b/criu/arch/x86/Makefile
index 75fa782c8279..20a40e4ae7be 100644
--- a/criu/arch/x86/Makefile
+++ b/criu/arch/x86/Makefile
@@ -15,5 +15,4 @@ obj-y			+= kerndat.o
 obj-y			+= sigframe.o
 ifeq ($(CONFIG_COMPAT),y)
         obj-y		+= sigaction_compat.o
-        obj-y		+= call32.o
 endif
diff --git a/criu/arch/x86/call32.S b/criu/arch/x86/call32.S
deleted file mode 100644
index 8c32c4f7a3d6..000000000000
--- a/criu/arch/x86/call32.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * call32.S - assembly helpers for mixed-bitness code
- * From kernel selftests originally: tools/testing/selftests/x86/thunks.S
- * Copyright (c) 2015 Andrew Lutomirski
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * These are little helpers that make it easier to switch bitness on
- * the fly.
- */
-
-#include "common/asm/linkage.h"
-
-	.text
-
-/*
- * @rdi: Stack to use
- * @esi: Pointer to function for calling
- *
- * Note: .code32 in this function doesn't guarantee that is will
- *       be place under 4GB by linker.
- *       Linker script would guarantee that, but it would break
- *       -fpie address randomization. In the end, the caller is
- *       responible for placing/checking that the code is
- *       accessible in 32-bit mode.
- */
-ENTRY(call32_from_64)
-	/* Callee-saving registers due to ABI */
-	pushq %rbx
-	pushq %rbp
-	pushq %r12
-	pushq %r13
-	pushq %r14
-	pushq %r15
-	pushfq
-
-	/* Switch stacks */
-	sub $8, %rdi
-	mov %rsp,(%rdi)
-	mov %rdi,%rsp
-
-	/* Push return address and 64-bit segment descriptor */
-	sub $4, %rsp
-	movl $__USER_CS,(%rsp)
-	sub $4, %rsp
-	/* Using rip-relative addressing to get rid of R_X86_64_32S relocs */
-	leaq 2f(%rip),%r12
-	movl %r12d,(%rsp)
-
-	/* Switch into compatibility mode */
-	pushq $__USER32_CS
-	/* Using rip-relative addressing to get rid of R_X86_64_32S relocs */
-	leaq 1f(%rip), %r12
-	pushq %r12
-	lretq
-
-1:	.code32
-	/* Run function and switch back */
-	call *%esi
-	lret
-
-2:	.code64
-	/* Restore the stack */
-	mov (%rsp),%rsp
-	add $8, %rdi
-
-	/* Restore registers */
-	popfq
-	popq %r15
-	popq %r14
-	popq %r13
-	popq %r12
-	popq %rbp
-	popq %rbx
-	ret
-END(call32_from_64)
diff --git a/criu/arch/x86/include/asm/compat.h b/criu/arch/x86/include/asm/compat.h
index dce28adf67f9..cd1ae472d77e 100644
--- a/criu/arch/x86/include/asm/compat.h
+++ b/criu/arch/x86/include/asm/compat.h
@@ -60,11 +60,6 @@ static inline void do_full_int80(struct syscall_args32 *args)
 			: : "r8", "r9", "r10", "r11");
 }
 
-
-#ifdef CONFIG_COMPAT
-extern unsigned long call32_from_64(void *stack, void *func);
-#endif
-
 #ifndef CR_NOGLIBC
 # undef sys_mmap
 # undef sys_munmap
diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index 8b05c14a0e43..24f97ea0d35a 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -25,7 +25,6 @@ restorer-obj-y	+= ./$(ARCH_DIR)/restorer.o
 
 ifeq ($(ARCH),x86)
         ifeq ($(CONFIG_COMPAT),y)
-                restorer-obj-y	+= ./$(ARCH_DIR)/call32.o
                 restorer-obj-y	+= ./$(ARCH_DIR)/restorer_unmap.o
                 restorer-obj-y	+= ./$(ARCH_DIR)/sigaction_compat_pie.o
         endif
-- 
2.19.1



More information about the CRIU mailing list