x86/entry/64: Stop using int_ret_from_sys_call in ret_from_fork

ret_from_fork is now open-coded and is no longer tangled up with
the syscall code.  This isn't so bad -- this adds very little
code, and IMO the result is much easier to understand.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/a0747e2a5e47084655a1e96351c545b755c41fa7.1454022279.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Andy Lutomirski 2016-01-28 15:11:27 -08:00 committed by Ingo Molnar
parent 46eabf06c0
commit 24d978b76f
1 changed files with 21 additions and 18 deletions

View File

@ -390,7 +390,6 @@ END(ptregs_\func)
* rdi: prev task we switched from * rdi: prev task we switched from
*/ */
ENTRY(ret_from_fork) ENTRY(ret_from_fork)
LOCK ; btr $TIF_FORK, TI_flags(%r8) LOCK ; btr $TIF_FORK, TI_flags(%r8)
pushq $0x0002 pushq $0x0002
@ -398,28 +397,32 @@ ENTRY(ret_from_fork)
call schedule_tail /* rdi: 'prev' task parameter */ call schedule_tail /* rdi: 'prev' task parameter */
RESTORE_EXTRA_REGS
testb $3, CS(%rsp) /* from kernel_thread? */ testb $3, CS(%rsp) /* from kernel_thread? */
jnz 1f
/* /*
* By the time we get here, we have no idea whether our pt_regs, * We came from kernel_thread. This code path is quite twisted, and
* ti flags, and ti status came from the 64-bit SYSCALL fast path, * someone should clean it up.
* the slow path, or one of the 32-bit compat paths. *
* Use IRET code path to return, since it can safely handle * copy_thread_tls stashes the function pointer in RBX and the
* all of the above. * parameter to be passed in RBP. The called function is permitted
* to call do_execve and thereby jump to user mode.
*/ */
jnz int_ret_from_sys_call movq RBP(%rsp), %rdi
call *RBX(%rsp)
/*
* We came from kernel_thread
* nb: we depend on RESTORE_EXTRA_REGS above
*/
movq %rbp, %rdi
call *%rbx
movl $0, RAX(%rsp) movl $0, RAX(%rsp)
RESTORE_EXTRA_REGS
jmp int_ret_from_sys_call /*
* Fall through as though we're exiting a syscall. This makes a
* twisted sort of sense if we just called do_execve.
*/
1:
movq %rsp, %rdi
call syscall_return_slowpath /* returns with IRQs disabled */
TRACE_IRQS_ON /* user mode is traced as IRQS on */
SWAPGS
jmp restore_regs_and_iret
END(ret_from_fork) END(ret_from_fork)
/* /*