diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-06-08 02:33:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-06-08 02:47:46 -0400 |
commit | 4c8cd0c50d0b1559727bf0ec7ff27caeba2dfe09 (patch) | |
tree | bd477ba39b3ee39b9f6ecf64bfc74a602fa27d60 | |
parent | 2cd23553b488589f287457b7396470f5e3c40698 (diff) |
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>
-rw-r--r-- | arch/x86/entry/entry_32.S | 10 | ||||
-rw-r--r-- | arch/x86/entry/entry_64_compat.S | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/proto.h | 3 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 4 | ||||
-rw-r--r-- | arch/x86/xen/xen-asm_64.S | 2 |
5 files changed, 12 insertions, 11 deletions
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 0ac73de925d1..a65f46c3b8e1 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S | |||
@@ -307,7 +307,7 @@ END(resume_kernel) | |||
307 | the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */ | 307 | the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */ |
308 | 308 | ||
309 | # sysenter call handler stub | 309 | # sysenter call handler stub |
310 | ENTRY(ia32_sysenter_target) | 310 | ENTRY(entry_SYSENTER_32) |
311 | movl TSS_sysenter_sp0(%esp),%esp | 311 | movl TSS_sysenter_sp0(%esp),%esp |
312 | sysenter_past_esp: | 312 | sysenter_past_esp: |
313 | /* | 313 | /* |
@@ -412,7 +412,7 @@ sysexit_audit: | |||
412 | .popsection | 412 | .popsection |
413 | _ASM_EXTABLE(1b,2b) | 413 | _ASM_EXTABLE(1b,2b) |
414 | PTGS_TO_GS_EX | 414 | PTGS_TO_GS_EX |
415 | ENDPROC(ia32_sysenter_target) | 415 | ENDPROC(entry_SYSENTER_32) |
416 | 416 | ||
417 | # system call handler stub | 417 | # system call handler stub |
418 | ENTRY(system_call) | 418 | ENTRY(system_call) |
@@ -1135,7 +1135,7 @@ END(page_fault) | |||
1135 | 1135 | ||
1136 | ENTRY(debug) | 1136 | ENTRY(debug) |
1137 | ASM_CLAC | 1137 | ASM_CLAC |
1138 | cmpl $ia32_sysenter_target,(%esp) | 1138 | cmpl $entry_SYSENTER_32,(%esp) |
1139 | jne debug_stack_correct | 1139 | jne debug_stack_correct |
1140 | FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn | 1140 | FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn |
1141 | debug_stack_correct: | 1141 | debug_stack_correct: |
@@ -1165,7 +1165,7 @@ ENTRY(nmi) | |||
1165 | popl %eax | 1165 | popl %eax |
1166 | je nmi_espfix_stack | 1166 | je nmi_espfix_stack |
1167 | #endif | 1167 | #endif |
1168 | cmpl $ia32_sysenter_target,(%esp) | 1168 | cmpl $entry_SYSENTER_32,(%esp) |
1169 | je nmi_stack_fixup | 1169 | je nmi_stack_fixup |
1170 | pushl %eax | 1170 | pushl %eax |
1171 | movl %esp,%eax | 1171 | movl %esp,%eax |
@@ -1176,7 +1176,7 @@ ENTRY(nmi) | |||
1176 | cmpl $(THREAD_SIZE-20),%eax | 1176 | cmpl $(THREAD_SIZE-20),%eax |
1177 | popl %eax | 1177 | popl %eax |
1178 | jae nmi_stack_correct | 1178 | jae nmi_stack_correct |
1179 | cmpl $ia32_sysenter_target,12(%esp) | 1179 | cmpl $entry_SYSENTER_32,12(%esp) |
1180 | je nmi_debug_stack_check | 1180 | je nmi_debug_stack_check |
1181 | nmi_stack_correct: | 1181 | nmi_stack_correct: |
1182 | pushl %eax | 1182 | pushl %eax |
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S index 8058892fb5ff..59840e33d203 100644 --- a/arch/x86/entry/entry_64_compat.S +++ b/arch/x86/entry/entry_64_compat.S | |||
@@ -57,7 +57,7 @@ ENDPROC(native_usergs_sysret32) | |||
57 | * path below. We set up a complete hardware stack frame to share code | 57 | * path below. We set up a complete hardware stack frame to share code |
58 | * with the int 0x80 path. | 58 | * with the int 0x80 path. |
59 | */ | 59 | */ |
60 | ENTRY(ia32_sysenter_target) | 60 | ENTRY(entry_SYSENTER_compat) |
61 | /* | 61 | /* |
62 | * Interrupts are off on entry. | 62 | * Interrupts are off on entry. |
63 | * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, | 63 | * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, |
@@ -256,7 +256,7 @@ sysenter_tracesys: | |||
256 | 256 | ||
257 | RESTORE_EXTRA_REGS | 257 | RESTORE_EXTRA_REGS |
258 | jmp sysenter_do_call | 258 | jmp sysenter_do_call |
259 | ENDPROC(ia32_sysenter_target) | 259 | ENDPROC(entry_SYSENTER_compat) |
260 | 260 | ||
261 | /* | 261 | /* |
262 | * 32-bit SYSCALL instruction entry. | 262 | * 32-bit SYSCALL instruction entry. |
diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h index 7d2961a231f1..83a7f8227949 100644 --- a/arch/x86/include/asm/proto.h +++ b/arch/x86/include/asm/proto.h | |||
@@ -10,7 +10,8 @@ void syscall_init(void); | |||
10 | 10 | ||
11 | void entry_INT80_compat(void); | 11 | void entry_INT80_compat(void); |
12 | void entry_SYSCALL_compat(void); | 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 | void x86_configure_nx(void); | 16 | void x86_configure_nx(void); |
16 | void x86_report_nx(void); | 17 | void x86_report_nx(void); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index f0b85c401014..b2ae7cec33ca 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1026,7 +1026,7 @@ void enable_sep_cpu(void) | |||
1026 | (unsigned long)tss + offsetofend(struct tss_struct, SYSENTER_stack), | 1026 | (unsigned long)tss + offsetofend(struct tss_struct, SYSENTER_stack), |
1027 | 0); | 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 | out: | 1031 | out: |
1032 | put_cpu(); | 1032 | put_cpu(); |
@@ -1216,7 +1216,7 @@ void syscall_init(void) | |||
1216 | */ | 1216 | */ |
1217 | wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); | 1217 | wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); |
1218 | wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL); | 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 | #else | 1220 | #else |
1221 | wrmsrl(MSR_CSTAR, ignore_sysret); | 1221 | wrmsrl(MSR_CSTAR, ignore_sysret); |
1222 | wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG); | 1222 | wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG); |
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S index 3c43c03a499c..ccac1b1e6e93 100644 --- a/arch/x86/xen/xen-asm_64.S +++ b/arch/x86/xen/xen-asm_64.S | |||
@@ -128,7 +128,7 @@ ENDPROC(xen_syscall32_target) | |||
128 | /* 32-bit compat sysenter target */ | 128 | /* 32-bit compat sysenter target */ |
129 | ENTRY(xen_sysenter_target) | 129 | ENTRY(xen_sysenter_target) |
130 | undo_xen_syscall | 130 | undo_xen_syscall |
131 | jmp ia32_sysenter_target | 131 | jmp entry_SYSENTER_compat |
132 | ENDPROC(xen_sysenter_target) | 132 | ENDPROC(xen_sysenter_target) |
133 | 133 | ||
134 | #else /* !CONFIG_IA32_EMULATION */ | 134 | #else /* !CONFIG_IA32_EMULATION */ |