Skip to content

Commit

Permalink
x86/cpu: Use INVPCID mnemonic in invpcid.h
Browse files Browse the repository at this point in the history
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 <ubizjak@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200508092247.132147-1-ubizjak@gmail.com

Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
Uros Bizjak authored and Borislav Petkov committed May 12, 2020
1 parent e2abfc0 commit 7e32a9d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arch/x86/include/asm/invpcid.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ static inline void __invpcid(unsigned long pcid, unsigned long addr,
* stale TLB entries and, especially if we're flushing global
* mappings, we don't want the compiler to reorder any subsequent
* memory accesses before the TLB flush.
*
* The hex opcode is invpcid (%ecx), %eax in 32-bit mode and
* invpcid (%rcx), %rax in long mode.
*/
asm volatile (".byte 0x66, 0x0f, 0x38, 0x82, 0x01"
: : "m" (desc), "a" (type), "c" (&desc) : "memory");
asm volatile("invpcid %[desc], %[type]"
:: [desc] "m" (desc), [type] "r" (type) : "memory");
}

#define INVPCID_TYPE_INDIV_ADDR 0
Expand Down

0 comments on commit 7e32a9d

Please sign in to comment.