Skip to content

Commit 3e5e7f7

Browse files
H. Peter Anvin (Intel)ingomolnar
authored andcommitted
x86/entry: Reverse arguments to do_syscall_64()
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
1 parent 6627eb2 commit 3e5e7f7

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

arch/x86/entry/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <asm/irq_stack.h>
3737

3838
#ifdef CONFIG_X86_64
39-
__visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs)
39+
__visible noinstr void do_syscall_64(struct pt_regs *regs, unsigned long nr)
4040
{
4141
add_random_kstack_offset();
4242
nr = syscall_enter_from_user_mode(regs, nr);

arch/x86/entry/entry_64.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL)
107107
PUSH_AND_CLEAR_REGS rax=$-ENOSYS
108108

109109
/* IRQs are off. */
110-
movq %rax, %rdi
111-
movq %rsp, %rsi
110+
movq %rsp, %rdi
111+
movq %rax, %rsi
112112
call do_syscall_64 /* returns with IRQs disabled */
113113

114114
/*

arch/x86/include/asm/syscall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static inline int syscall_get_arch(struct task_struct *task)
160160
? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
161161
}
162162

163-
void do_syscall_64(unsigned long nr, struct pt_regs *regs);
163+
void do_syscall_64(struct pt_regs *regs, unsigned long nr);
164164
void do_int80_syscall_32(struct pt_regs *regs);
165165
long do_fast_syscall_32(struct pt_regs *regs);
166166

0 commit comments

Comments
 (0)