Skip to content

Commit 7e32a9d

Browse files
ubizjaksuryasaimadhu
authored andcommitted
x86/cpu: Use INVPCID mnemonic in invpcid.h
The current minimum required version of binutils is 2.23, which supports the INVPCID instruction mnemonic. Replace the byte-wise specification of INVPCID with the proper mnemonic. [ bp: Add symbolic operand names for increased readability and flip their order like the insn expects them for the AT&T syntax. ] Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: H. Peter Anvin (Intel) <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Borislav Petkov <[email protected]>
1 parent e2abfc0 commit 7e32a9d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

arch/x86/include/asm/invpcid.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ static inline void __invpcid(unsigned long pcid, unsigned long addr,
1212
* stale TLB entries and, especially if we're flushing global
1313
* mappings, we don't want the compiler to reorder any subsequent
1414
* memory accesses before the TLB flush.
15-
*
16-
* The hex opcode is invpcid (%ecx), %eax in 32-bit mode and
17-
* invpcid (%rcx), %rax in long mode.
1815
*/
19-
asm volatile (".byte 0x66, 0x0f, 0x38, 0x82, 0x01"
20-
: : "m" (desc), "a" (type), "c" (&desc) : "memory");
16+
asm volatile("invpcid %[desc], %[type]"
17+
:: [desc] "m" (desc), [type] "r" (type) : "memory");
2118
}
2219

2320
#define INVPCID_TYPE_INDIV_ADDR 0

0 commit comments

Comments
 (0)