x86/asm: Use RDPKRU and WRPKRU mnemonics in <asm/special_insns.h>
PATCH 1/1 x86/asm: Use RDPKRU and WRPKRU mnemonics in <asm/special_insns.h>
Current minimum required version of binutils is 2.30, which supports RDPKRU and WRPKRU instruction mnemonics.
Replace the byte-wise specification of RDPKRU and
WRPKRU with these proper mnemonics.
No functional change intended.
--- arch/x86/include/asm/special_insns.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/include/asm/special_insns.h +2 -5
@@ -75,9 +75,7 @@ static inline u32 rdpkru(void)* "rdpkru" instruction. Places PKRU contents in to EAX, * clears EDX and requires that ecx=0. */ - asmvolatile (".byte 0x0f,0x01,0xee\n\t" - :"=a" (pkru),"=d" (edx) - :"c" (ecx)); + asmvolatile ("rdpkru" :"=a" (pkru),"=d" (edx) :"c" (ecx));return pkru; }
@@ -89,8 +87,7 @@ static inline void wrpkru(u32 pkru)* "wrpkru" instruction. Loads contents in EAX to PKRU, * requires that ecx = edx = 0. */ - asmvolatile (".byte 0x0f,0x01,0xef\n\t" - : : "a" (pkru), "c"(ecx), "d"(edx)); + asm volatile("wrpkru" : : "a" (pkru), "c"(ecx), "d"(edx)); }#else
Signature · 1 line
2.49.0
Quoted 5 lines · Uros Bizjak
Current minimum required version of binutils is 2.30, which supports RDPKRU and WRPKRU instruction mnemonics.
Replace the byte-wise specification of RDPKRU and
WRPKRU with these proper mnemonics.
What about the minimal clang version and their integrated assembler?
Quoted 9 lines · Peter Zijlstra
Quoted 5 lines · Uros Bizjak
Current minimum required version of binutils is 2.30, which supports RDPKRU and WRPKRU instruction mnemonics.
Replace the byte-wise specification of RDPKRU and
WRPKRU with these proper mnemonics.What about the minimal clang version and their integrated assembler?
Yes, it works with the minimum required clang version 13.0.1.
Uros.
Peter Zijlstra
Acked-byQuoted 6 lines · Uros Bizjak
Quoted 5 lines · Peter Zijlstra
Quoted 3 lines · Uros Bizjak
Current minimum required version of binutils is 2.30, which supports RDPKRU and WRPKRU instruction mnemonics.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Replace the byte-wise specification of RDPKRU and
WRPKRU with these proper mnemonics.What about the minimal clang version and their integrated assembler?
Yes, it works with the minimum required clang version 13.0.1.
Excellent!
The following commit has been merged into the x86/cleanups branch of tip:
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 966f504977e3a04fcadbaf199e3302e95e8958b7 Gitweb: https://git.kernel.org/tip/966f504977e3a04fcadbaf199e3302e95e8958b7 Author: Uros Bizjak <[email protected]> AuthorDate: Mon, 16 Jun 2025 10:35:57 +02:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Fri, 22 Aug 2025 18:54:07 +02:00
x86/asm: Use RDPKRU and WRPKRU mnemonics in <asm/special_insns.h>
Current minimum required version of binutils is 2.30, which supports RDPKRU and WRPKRU instruction mnemonics.
Replace the byte-wise specification of RDPKRU and WRPKRU with these proper mnemonics.
No functional change intended.
--- arch/x86/include/asm/special_insns.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/include/asm/special_insns.h +2 -5
@@ -75,9 +75,7 @@ static inline u32 rdpkru(void)* "rdpkru" instruction. Places PKRU contents in to EAX, * clears EDX and requires that ecx=0. */ - asmvolatile (".byte 0x0f,0x01,0xee\n\t" - :"=a" (pkru),"=d" (edx) - :"c" (ecx)); + asmvolatile ("rdpkru" :"=a" (pkru),"=d" (edx) :"c" (ecx));return pkru; }
@@ -89,8 +87,7 @@ static inline void wrpkru(u32 pkru)* "wrpkru" instruction. Loads contents in EAX to PKRU, * requires that ecx = edx = 0. */ - asmvolatile (".byte 0x0f,0x01,0xef\n\t" - : : "a" (pkru), "c"(ecx), "d"(edx)); + asm volatile("wrpkru" : : "a" (pkru), "c"(ecx), "d"(edx)); }#else