aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/processor.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-11-28 14:50:30 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2012-11-29 16:25:39 -0500
commit45c39fb0cc20d24da08d5bb159f57d191098104d (patch)
tree9ec9db8c7b9fa46d383b0c7dd4fe5339b577dfe6 /arch/x86/include/asm/processor.h
parente3228cf4544355f73437a2b9c6916be9cbafc201 (diff)
x86, cleanups: Simplify sync_core() in the case of no CPUID
Simplify the implementation of sync_core() for the case where we may not have the CPUID instruction available. [ v2: stylistic cleanup of the #else clause per suggestion by Borislav Petkov. ] Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Link: http://lkml.kernel.org/r/1354132230-21854-9-git-send-email-hpa@linux.intel.com Cc: Borislav Petkov <bp@alien8.de>
Diffstat (limited to 'arch/x86/include/asm/processor.h')
-rw-r--r--arch/x86/include/asm/processor.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 9a4ee46959f3..b0d3e7362205 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -673,17 +673,28 @@ static inline void sync_core(void)
673 int tmp; 673 int tmp;
674 674
675#ifdef CONFIG_M486 675#ifdef CONFIG_M486
676 if (boot_cpu_data.x86 < 5) 676 /*
677 /* There is no speculative execution. 677 * Do a CPUID if available, otherwise do a jump. The jump
678 * jmp is a barrier to prefetching. */ 678 * can conveniently enough be the jump around CPUID.
679 asm volatile("jmp 1f\n1:\n" ::: "memory"); 679 */
680 else 680 asm volatile("cmpl %2,%1\n\t"
681 "jl 1f\n\t"
682 "cpuid\n"
683 "1:"
684 : "=a" (tmp)
685 : "rm" (boot_cpu_data.cpuid_level), "ri" (0), "0" (1)
686 : "ebx", "ecx", "edx", "memory");
687#else
688 /*
689 * CPUID is a barrier to speculative execution.
690 * Prefetched instructions are automatically
691 * invalidated when modified.
692 */
693 asm volatile("cpuid"
694 : "=a" (tmp)
695 : "0" (1)
696 : "ebx", "ecx", "edx", "memory");
681#endif 697#endif
682 /* cpuid is a barrier to speculative execution.
683 * Prefetched instructions are automatically
684 * invalidated when modified. */
685 asm volatile("cpuid" : "=a" (tmp) : "0" (1)
686 : "ebx", "ecx", "edx", "memory");
687} 698}
688 699
689static inline void __monitor(const void *eax, unsigned long ecx, 700static inline void __monitor(const void *eax, unsigned long ecx,