From 59d970a7efaef0a4cc6bbec7e5c1041be598bcc2 Mon Sep 17 00:00:00 2001 From: kib Date: Tue, 13 Feb 2018 15:30:31 +0000 Subject: [PATCH] Fix build with gas. Do not use C constant suffixes. Bit values are small enough to not require typing, despite they are used for 64bit MSR writes. The added cast in hw_ibrs_recalculate() is redundand but I prefer to add it for clarity. Reported by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/include/specialreg.h | 4 ++-- sys/x86/x86/cpu_machdep.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index e812c373d91d..30f580f0d3d1 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -702,8 +702,8 @@ * document 336996-001 Speculative Execution Side Channel Mitigations. */ /* MSR IA32_SPEC_CTRL */ -#define IA32_SPEC_CTRL_IBRS 0x0000000000000001ULL -#define IA32_SPEC_CTRL_STIBP 0x0000000000000002ULL +#define IA32_SPEC_CTRL_IBRS 0x00000001 +#define IA32_SPEC_CTRL_STIBP 0x00000002 /* MSR IA32_PRED_CMD */ #define IA32_PRED_CMD_IBPB_BARRIER 0x0000000000000001ULL diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index 1868b331c08d..16f3b806436d 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -592,7 +592,7 @@ hw_ibrs_recalculate(void) if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_IBRS_ALL) != 0) { if (hw_ibrs_disable) { v= rdmsr(MSR_IA32_SPEC_CTRL); - v &= ~IA32_SPEC_CTRL_IBRS; + v &= ~(uint64_t)IA32_SPEC_CTRL_IBRS; wrmsr(MSR_IA32_SPEC_CTRL, v); } else { v= rdmsr(MSR_IA32_SPEC_CTRL);