Commit e2bd7af9 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

x86/compat: Remove call32_from_64() helper

It looks like, this one is no more needed.
You were a hard child, RIP.
Signed-off-by: 's avatarDmitry Safonov <dima@arista.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent b0c5881d
......@@ -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
/*
* 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)
......@@ -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
......
......@@ -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
......
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