Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/asm/entry: Untangle 'ia32_sysenter_target' into two entry points: entry_SYSENTER_32 and entry_SYSENTER_compat

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>

+12 -11
+5 -5
arch/x86/entry/entry_32.S
··· 307 307 the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */ 308 308 309 309 # sysenter call handler stub 310 - ENTRY(ia32_sysenter_target) 310 + ENTRY(entry_SYSENTER_32) 311 311 movl TSS_sysenter_sp0(%esp),%esp 312 312 sysenter_past_esp: 313 313 /* ··· 412 412 .popsection 413 413 _ASM_EXTABLE(1b,2b) 414 414 PTGS_TO_GS_EX 415 - ENDPROC(ia32_sysenter_target) 415 + ENDPROC(entry_SYSENTER_32) 416 416 417 417 # system call handler stub 418 418 ENTRY(system_call) ··· 1135 1135 1136 1136 ENTRY(debug) 1137 1137 ASM_CLAC 1138 - cmpl $ia32_sysenter_target,(%esp) 1138 + cmpl $entry_SYSENTER_32,(%esp) 1139 1139 jne debug_stack_correct 1140 1140 FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn 1141 1141 debug_stack_correct: ··· 1165 1165 popl %eax 1166 1166 je nmi_espfix_stack 1167 1167 #endif 1168 - cmpl $ia32_sysenter_target,(%esp) 1168 + cmpl $entry_SYSENTER_32,(%esp) 1169 1169 je nmi_stack_fixup 1170 1170 pushl %eax 1171 1171 movl %esp,%eax ··· 1176 1176 cmpl $(THREAD_SIZE-20),%eax 1177 1177 popl %eax 1178 1178 jae nmi_stack_correct 1179 - cmpl $ia32_sysenter_target,12(%esp) 1179 + cmpl $entry_SYSENTER_32,12(%esp) 1180 1180 je nmi_debug_stack_check 1181 1181 nmi_stack_correct: 1182 1182 pushl %eax
+2 -2
arch/x86/entry/entry_64_compat.S
··· 57 57 * path below. We set up a complete hardware stack frame to share code 58 58 * with the int 0x80 path. 59 59 */ 60 - ENTRY(ia32_sysenter_target) 60 + ENTRY(entry_SYSENTER_compat) 61 61 /* 62 62 * Interrupts are off on entry. 63 63 * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, ··· 256 256 257 257 RESTORE_EXTRA_REGS 258 258 jmp sysenter_do_call 259 - ENDPROC(ia32_sysenter_target) 259 + ENDPROC(entry_SYSENTER_compat) 260 260 261 261 /* 262 262 * 32-bit SYSCALL instruction entry.
+2 -1
arch/x86/include/asm/proto.h
··· 10 10 11 11 void entry_INT80_compat(void); 12 12 void entry_SYSCALL_compat(void); 13 - void ia32_sysenter_target(void); 13 + void entry_SYSENTER_32(void); 14 + void entry_SYSENTER_compat(void); 14 15 15 16 void x86_configure_nx(void); 16 17 void x86_report_nx(void);
+2 -2
arch/x86/kernel/cpu/common.c
··· 1026 1026 (unsigned long)tss + offsetofend(struct tss_struct, SYSENTER_stack), 1027 1027 0); 1028 1028 1029 - wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)ia32_sysenter_target, 0); 1029 + wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0); 1030 1030 1031 1031 out: 1032 1032 put_cpu(); ··· 1216 1216 */ 1217 1217 wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); 1218 1218 wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL); 1219 - wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target); 1219 + wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat); 1220 1220 #else 1221 1221 wrmsrl(MSR_CSTAR, ignore_sysret); 1222 1222 wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG);
+1 -1
arch/x86/xen/xen-asm_64.S
··· 128 128 /* 32-bit compat sysenter target */ 129 129 ENTRY(xen_sysenter_target) 130 130 undo_xen_syscall 131 - jmp ia32_sysenter_target 131 + jmp entry_SYSENTER_compat 132 132 ENDPROC(xen_sysenter_target) 133 133 134 134 #else /* !CONFIG_IA32_EMULATION */