diff options
| author | Linus Torvalds <[email protected]> | 2018-04-05 09:53:00 +0000 |
|---|---|---|
| committer | Ingo Molnar <[email protected]> | 2018-04-05 14:59:24 +0000 |
| commit | dfe64506c01e57159a4c550fe537c13a317ff01b (patch) | |
| tree | 4c5623bfac6ecb60eb36dec94784eda740d11c0f /arch/x86/entry/common.c | |
| parent | Merge branch 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git... (diff) | |
| download | kernel-dfe64506c01e57159a4c550fe537c13a317ff01b.tar.gz kernel-dfe64506c01e57159a4c550fe537c13a317ff01b.zip | |
x86/syscalls: Don't pointlessly reload the system call number
We have it in a register in the low-level asm, just pass it in as an
argument rather than have do_syscall_64() load it back in from the
ptregs pointer.
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'arch/x86/entry/common.c')
| -rw-r--r-- | arch/x86/entry/common.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 74f6eee15179..a8b066dbbf48 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -266,14 +266,13 @@ __visible inline void syscall_return_slowpath(struct pt_regs *regs) } #ifdef CONFIG_X86_64 -__visible void do_syscall_64(struct pt_regs *regs) +__visible void do_syscall_64(unsigned long nr, struct pt_regs *regs) { - struct thread_info *ti = current_thread_info(); - unsigned long nr = regs->orig_ax; + struct thread_info *ti; enter_from_user_mode(); local_irq_enable(); - + ti = current_thread_info(); if (READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY) nr = syscall_trace_enter(regs); @@ -282,8 +281,9 @@ __visible void do_syscall_64(struct pt_regs *regs) * table. The only functional difference is the x32 bit in * regs->orig_ax, which changes the behavior of some syscalls. */ - if (likely((nr & __SYSCALL_MASK) < NR_syscalls)) { - nr = array_index_nospec(nr & __SYSCALL_MASK, NR_syscalls); + nr &= __SYSCALL_MASK; + if (likely(nr < NR_syscalls)) { + nr = array_index_nospec(nr, NR_syscalls); regs->ax = sys_call_table[nr]( regs->di, regs->si, regs->dx, regs->r10, regs->r8, regs->r9); |
