All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Andy Lutomirski <luto@amacapital.net>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Brian Gerst <brgerst@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 3/4] x86/asm/entry: Untangle 'system_call' into two entry points: entry_SYSCALL_64 and entry_INT80_32
Date: Mon,  8 Jun 2015 10:35:00 +0200	[thread overview]
Message-ID: <1433752501-15901-4-git-send-email-mingo@kernel.org> (raw)
In-Reply-To: <1433752501-15901-1-git-send-email-mingo@kernel.org>

The 'system_call' entry points differ starkly between native 32-bit and 64-bit
kernels: on 32-bit kernels it defines the INT 0x80 entry point, while on
64-bit it's the SYSCALL entry point.

This is pretty confusing when looking at generic code, and it also obscures
the nature of the entry point at the assembly level.

So unangle this by splitting the name into its two uses:

	system_call (32) -> entry_INT80_32
	system_call (64) -> entry_SYSCALL_64

As per the generic naming scheme for x86 system call entry points:

	entry_MNEMONIC_qualifier

where 'qualifier' is one of _32, _64 or _compat.

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: 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>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/entry/entry_32.S    |  4 ++--
 arch/x86/entry/entry_64.S    | 10 +++++-----
 arch/x86/include/asm/proto.h |  5 +++--
 arch/x86/kernel/cpu/common.c |  2 +-
 arch/x86/kernel/traps.c      |  5 ++---
 arch/x86/xen/xen-asm_64.S    |  2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index a65f46c3b8e1..d59461032625 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -415,7 +415,7 @@ ENTRY(entry_SYSENTER_32)
 ENDPROC(entry_SYSENTER_32)
 
 	# system call handler stub
-ENTRY(system_call)
+ENTRY(entry_INT80_32)
 	ASM_CLAC
 	pushl %eax			# save orig_eax
 	SAVE_ALL
@@ -508,7 +508,7 @@ ENTRY(iret_exc)
 	lss (%esp), %esp		/* switch to espfix segment */
 	jmp restore_nocheck
 #endif
-ENDPROC(system_call)
+ENDPROC(entry_INT80_32)
 
 	# perform work that needs to be done immediately before resumption
 	ALIGN
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 4cf3dd36aa0d..e1852c407155 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -137,7 +137,7 @@ ENDPROC(native_usergs_sysret64)
  * with them due to bugs in both AMD and Intel CPUs.
  */
 
-ENTRY(system_call)
+ENTRY(entry_SYSCALL_64)
 	/*
 	 * Interrupts are off on entry.
 	 * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON,
@@ -149,7 +149,7 @@ ENTRY(system_call)
 	 * after the swapgs, so that it can do the swapgs
 	 * for the guest and jump here on syscall.
 	 */
-GLOBAL(system_call_after_swapgs)
+GLOBAL(entry_SYSCALL_64_after_swapgs)
 
 	movq	%rsp,PER_CPU_VAR(rsp_scratch)
 	movq	PER_CPU_VAR(cpu_current_top_of_stack),%rsp
@@ -182,7 +182,7 @@ GLOBAL(system_call_after_swapgs)
 
 	testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
 	jnz tracesys
-system_call_fastpath:
+entry_SYSCALL_64_fastpath:
 #if __SYSCALL_MASK == ~0
 	cmpq $__NR_syscall_max,%rax
 #else
@@ -246,7 +246,7 @@ GLOBAL(system_call_after_swapgs)
 	jnz tracesys_phase2		/* if needed, run the slow path */
 	RESTORE_C_REGS_EXCEPT_RAX	/* else restore clobbered regs */
 	movq ORIG_RAX(%rsp), %rax
-	jmp system_call_fastpath	/*      and return to the fast path */
+	jmp entry_SYSCALL_64_fastpath	/*      and return to the fast path */
 
 tracesys_phase2:
 	SAVE_EXTRA_REGS
@@ -411,7 +411,7 @@ GLOBAL(int_with_check)
 opportunistic_sysret_failed:
 	SWAPGS
 	jmp	restore_c_regs_and_iret
-END(system_call)
+END(entry_SYSCALL_64)
 
 
 	.macro FORK_LIKE func
diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h
index 83a7f8227949..a4a77286cb1d 100644
--- a/arch/x86/include/asm/proto.h
+++ b/arch/x86/include/asm/proto.h
@@ -5,11 +5,12 @@
 
 /* misc architecture specific prototypes */
 
-void system_call(void);
 void syscall_init(void);
 
-void entry_INT80_compat(void);
+void entry_SYSCALL_64(void);
 void entry_SYSCALL_compat(void);
+void entry_INT80_32(void);
+void entry_INT80_compat(void);
 void entry_SYSENTER_32(void);
 void entry_SYSENTER_compat(void);
 
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index b2ae7cec33ca..914be4bbc2e5 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1204,7 +1204,7 @@ void syscall_init(void)
 	 * set CS/DS but only a 32bit target. LSTAR sets the 64bit rip.
 	 */
 	wrmsrl(MSR_STAR,  ((u64)__USER32_CS)<<48  | ((u64)__KERNEL_CS)<<32);
-	wrmsrl(MSR_LSTAR, system_call);
+	wrmsrl(MSR_LSTAR, entry_SYSCALL_64);
 
 #ifdef CONFIG_IA32_EMULATION
 	wrmsrl(MSR_CSTAR, entry_SYSCALL_compat);
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index edf97986a53d..001ddac221a1 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -72,8 +72,7 @@ gate_desc debug_idt_table[NR_VECTORS] __page_aligned_bss;
 #else
 #include <asm/processor-flags.h>
 #include <asm/setup.h>
-
-asmlinkage int system_call(void);
+#include <asm/proto.h>
 #endif
 
 /* Must be page-aligned because the real IDT is used in a fixmap. */
@@ -997,7 +996,7 @@ void __init trap_init(void)
 #endif
 
 #ifdef CONFIG_X86_32
-	set_system_trap_gate(IA32_SYSCALL_VECTOR, &system_call);
+	set_system_trap_gate(IA32_SYSCALL_VECTOR, entry_INT80_32);
 	set_bit(IA32_SYSCALL_VECTOR, used_vectors);
 #endif
 
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
index ccac1b1e6e93..f22667abf7b9 100644
--- a/arch/x86/xen/xen-asm_64.S
+++ b/arch/x86/xen/xen-asm_64.S
@@ -114,7 +114,7 @@ RELOC(xen_sysret32, 1b+1)
 /* Normal 64-bit system call target */
 ENTRY(xen_syscall_target)
 	undo_xen_syscall
-	jmp system_call_after_swapgs
+	jmp entry_SYSCALL_64_after_swapgs
 ENDPROC(xen_syscall_target)
 
 #ifdef CONFIG_IA32_EMULATION
-- 
2.1.4


  parent reply	other threads:[~2015-06-08  8:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08  8:34 [PATCH 0/4] x86: Untangle and standardize x86 system call entry point names Ingo Molnar
2015-06-08  8:34 ` [PATCH 1/4] x86/asm/entry: Rename compat syscall entry points Ingo Molnar
2015-06-08  8:47   ` Borislav Petkov
2015-06-08  8:34 ` [PATCH 2/4] x86/asm/entry: Untangle 'ia32_sysenter_target' into two entry points: entry_SYSENTER_32 and entry_SYSENTER_compat Ingo Molnar
2015-06-09  0:13   ` Andy Lutomirski
2015-06-09  9:33     ` Ingo Molnar
2015-06-09 16:33       ` Andy Lutomirski
2015-06-08  8:35 ` Ingo Molnar [this message]
2015-06-08  8:35 ` [PATCH 4/4] x86/asm/entry/32: Clean up entry_32.S Ingo Molnar
2015-06-08 13:14   ` Denys Vlasenko
2015-06-08 18:51     ` [PATCH] x86/asm/entry/64: Clean up entry_64.S Ingo Molnar
2015-07-06 15:00       ` Sasha Levin
2015-07-06 16:07         ` Ingo Molnar
2015-07-06 16:19           ` Sasha Levin
2015-07-06 16:23             ` Ingo Molnar
2015-07-06 16:36               ` Sasha Levin
2015-07-06 16:43                 ` Ingo Molnar
2015-07-06 17:02                   ` Sasha Levin
2015-07-06 17:20         ` Andy Lutomirski
2015-07-06 17:34           ` Sasha Levin
2015-07-06 17:41             ` Ingo Molnar
2015-07-06 18:35               ` Andy Lutomirski
2015-07-06 18:39                 ` Andy Lutomirski
2015-07-08 15:39                   ` Sasha Levin
2015-07-07  7:01                 ` Ingo Molnar
2015-07-09  0:59         ` Andy Lutomirski
2015-07-10 13:27           ` Sasha Levin
2015-07-10 15:26           ` Andrey Ryabinin
2015-07-10 15:36             ` Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433752501-15901-4-git-send-email-mingo@kernel.org \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.