x86/asm/entry: Untangle 'ia32_sysenter_target' into two entry points: entry_SYSENTER_...
authorIngo Molnar <mingo@kernel.org>
Mon, 8 Jun 2015 06:33:56 +0000 (08:33 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 8 Jun 2015 06:47:46 +0000 (08:47 +0200)
So the SYSENTER instruction is pretty quirky and it has different behavior
depending on bitness and CPU maker.

Yet we create a false sense of coherency by naming it 'ia32_sysenter_target'
in both of the cases.

Split the name into its two uses:

ia32_sysenter_target (32)    -> entry_SYSENTER_32
ia32_sysenter_target (64)    -> entry_SYSENTER_compat

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
arch/x86/entry/entry_64_compat.S
arch/x86/include/asm/proto.h
arch/x86/kernel/cpu/common.c
arch/x86/xen/xen-asm_64.S

index 0ac73de925d1dccdbf11e8b9fda6ead8c552a9ce..a65f46c3b8e1f5bc2c07213684ae1bab41b2efa9 100644 (file)
@@ -307,7 +307,7 @@ END(resume_kernel)
    the vsyscall page.  See vsyscall-sysentry.S, which defines the symbol.  */
 
        # sysenter call handler stub
-ENTRY(ia32_sysenter_target)
+ENTRY(entry_SYSENTER_32)
        movl TSS_sysenter_sp0(%esp),%esp
 sysenter_past_esp:
        /*
@@ -412,7 +412,7 @@ sysexit_audit:
 .popsection
        _ASM_EXTABLE(1b,2b)
        PTGS_TO_GS_EX
-ENDPROC(ia32_sysenter_target)
+ENDPROC(entry_SYSENTER_32)
 
        # system call handler stub
 ENTRY(system_call)
@@ -1135,7 +1135,7 @@ END(page_fault)
 
 ENTRY(debug)
        ASM_CLAC
-       cmpl $ia32_sysenter_target,(%esp)
+       cmpl $entry_SYSENTER_32,(%esp)
        jne debug_stack_correct
        FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn
 debug_stack_correct:
@@ -1165,7 +1165,7 @@ ENTRY(nmi)
        popl %eax
        je nmi_espfix_stack
 #endif
-       cmpl $ia32_sysenter_target,(%esp)
+       cmpl $entry_SYSENTER_32,(%esp)
        je nmi_stack_fixup
        pushl %eax
        movl %esp,%eax
@@ -1176,7 +1176,7 @@ ENTRY(nmi)
        cmpl $(THREAD_SIZE-20),%eax
        popl %eax
        jae nmi_stack_correct
-       cmpl $ia32_sysenter_target,12(%esp)
+       cmpl $entry_SYSENTER_32,12(%esp)
        je nmi_debug_stack_check
 nmi_stack_correct:
        pushl %eax
index 8058892fb5fffc693741b6857aa790e840f06a55..59840e33d2038f7883fa9d8d2b841b49ad73ef70 100644 (file)
@@ -57,7 +57,7 @@ ENDPROC(native_usergs_sysret32)
  * path below. We set up a complete hardware stack frame to share code
  * with the int 0x80 path.
  */
-ENTRY(ia32_sysenter_target)
+ENTRY(entry_SYSENTER_compat)
        /*
         * Interrupts are off on entry.
         * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON,
@@ -256,7 +256,7 @@ sysenter_tracesys:
 
        RESTORE_EXTRA_REGS
        jmp     sysenter_do_call
-ENDPROC(ia32_sysenter_target)
+ENDPROC(entry_SYSENTER_compat)
 
 /*
  * 32-bit SYSCALL instruction entry.
index 7d2961a231f1404ddd48ee206c808891c2bd10ee..83a7f8227949b9178a475ee89bd1657d11ecb748 100644 (file)
@@ -10,7 +10,8 @@ void syscall_init(void);
 
 void entry_INT80_compat(void);
 void entry_SYSCALL_compat(void);
-void ia32_sysenter_target(void);
+void entry_SYSENTER_32(void);
+void entry_SYSENTER_compat(void);
 
 void x86_configure_nx(void);
 void x86_report_nx(void);
index f0b85c401014207fd92b3d1f910f41b725dd1af3..b2ae7cec33ca5b6e6db25b70571eeb89c6db022e 100644 (file)
@@ -1026,7 +1026,7 @@ void enable_sep_cpu(void)
              (unsigned long)tss + offsetofend(struct tss_struct, SYSENTER_stack),
              0);
 
-       wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)ia32_sysenter_target, 0);
+       wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0);
 
 out:
        put_cpu();
@@ -1216,7 +1216,7 @@ void syscall_init(void)
         */
        wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
        wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL);
-       wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
+       wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat);
 #else
        wrmsrl(MSR_CSTAR, ignore_sysret);
        wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG);
index 3c43c03a499c2855006ff796aaea27db285799ef..ccac1b1e6e9353369e98a4429574792f54aa9399 100644 (file)
@@ -128,7 +128,7 @@ ENDPROC(xen_syscall32_target)
 /* 32-bit compat sysenter target */
 ENTRY(xen_sysenter_target)
        undo_xen_syscall
-       jmp ia32_sysenter_target
+       jmp entry_SYSENTER_compat
 ENDPROC(xen_sysenter_target)
 
 #else /* !CONFIG_IA32_EMULATION */