x86/entry: Reverse arguments to do_syscall_64()
authorH. Peter Anvin (Intel) <hpa@zytor.com>
Mon, 10 May 2021 18:53:11 +0000 (11:53 -0700)
committerIngo Molnar <mingo@kernel.org>
Wed, 12 May 2021 08:49:14 +0000 (10:49 +0200)
Reverse the order of arguments to do_syscall_64() so that the first
argument is the pt_regs pointer. This is not only consistent with
*all* other entry points from assembly, but it actually makes the
compiled code slightly better.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210510185316.3307264-3-hpa@zytor.com
arch/x86/entry/common.c
arch/x86/entry/entry_64.S
arch/x86/include/asm/syscall.h

index 7b2542b13ebd9683748677df37604adb911c4b40..00da0f5420de8e1d9589203f75a1161ca02027f8 100644 (file)
@@ -36,7 +36,7 @@
 #include <asm/irq_stack.h>
 
 #ifdef CONFIG_X86_64
-__visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs)
+__visible noinstr void do_syscall_64(struct pt_regs *regs, unsigned long nr)
 {
        add_random_kstack_offset();
        nr = syscall_enter_from_user_mode(regs, nr);
index a16a5294d55f655a70566a1dc4f92b1fa2574798..1d9db15fdc692623ee73bf5c66a69a3d59261364 100644 (file)
@@ -107,8 +107,8 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL)
        PUSH_AND_CLEAR_REGS rax=$-ENOSYS
 
        /* IRQs are off. */
-       movq    %rax, %rdi
-       movq    %rsp, %rsi
+       movq    %rsp, %rdi
+       movq    %rax, %rsi
        call    do_syscall_64           /* returns with IRQs disabled */
 
        /*
index 7cbf733d11afd9fe150cbd8676065821a928d9ad..4e20054d7533ed9addbe9c7bdfa7edc99dee12d0 100644 (file)
@@ -160,7 +160,7 @@ static inline int syscall_get_arch(struct task_struct *task)
                ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
 }
 
-void do_syscall_64(unsigned long nr, struct pt_regs *regs);
+void do_syscall_64(struct pt_regs *regs, unsigned long nr);
 void do_int80_syscall_32(struct pt_regs *regs);
 long do_fast_syscall_32(struct pt_regs *regs);