Skip to content

Commit

Permalink
x86/entry: Reverse arguments to do_syscall_64()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
H. Peter Anvin (Intel) authored and Ingo Molnar committed May 12, 2021
1 parent 6627eb2 commit 3e5e7f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/x86/entry/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/entry/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3e5e7f7

Please sign in to comment.