Skip to content

Commit 5328663

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/asm: Use CLFLUSHOPT and CLWB mnemonics in <asm/special_insns.h>
Current minimum required version of binutils is 2.25, which supports CLFLUSHOPT and CLWB instruction mnemonics. Replace the byte-wise specification of CLFLUSHOPT and CLWB with these proper mnemonics. No functional change intended. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20250313102715.333142-1-ubizjak@gmail.com
1 parent 21fe251 commit 5328663

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

arch/x86/include/asm/special_insns.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,8 @@ static __always_inline void clflush(volatile void *__p)
176176

177177
static inline void clflushopt(volatile void *__p)
178178
{
179-
alternative_io(".byte 0x3e; clflush %0",
180-
".byte 0x66; clflush %0",
181-
X86_FEATURE_CLFLUSHOPT,
179+
alternative_io("ds clflush %0",
180+
"clflushopt %0", X86_FEATURE_CLFLUSHOPT,
182181
"+m" (*(volatile char __force *)__p));
183182
}
184183

@@ -187,13 +186,10 @@ static inline void clwb(volatile void *__p)
187186
volatile struct { char x[64]; } *p = __p;
188187

189188
asm volatile(ALTERNATIVE_2(
190-
".byte 0x3e; clflush (%[pax])",
191-
".byte 0x66; clflush (%[pax])", /* clflushopt (%%rax) */
192-
X86_FEATURE_CLFLUSHOPT,
193-
".byte 0x66, 0x0f, 0xae, 0x30", /* clwb (%%rax) */
194-
X86_FEATURE_CLWB)
195-
: [p] "+m" (*p)
196-
: [pax] "a" (p));
189+
"ds clflush %0",
190+
"clflushopt %0", X86_FEATURE_CLFLUSHOPT,
191+
"clwb %0", X86_FEATURE_CLWB)
192+
: "+m" (*p));
197193
}
198194

199195
#ifdef CONFIG_X86_USER_SHADOW_STACK

0 commit comments

Comments
 (0)