Skip to content

Commit 966f504

Browse files
ubizjakbp3tk0v
authored andcommitted
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. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/20250616083611.157740-1-ubizjak@gmail.com
1 parent d20a5d9 commit 966f504

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

arch/x86/include/asm/special_insns.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ static inline u32 rdpkru(void)
7575
* "rdpkru" instruction. Places PKRU contents in to EAX,
7676
* clears EDX and requires that ecx=0.
7777
*/
78-
asm volatile(".byte 0x0f,0x01,0xee\n\t"
79-
: "=a" (pkru), "=d" (edx)
80-
: "c" (ecx));
78+
asm volatile("rdpkru" : "=a" (pkru), "=d" (edx) : "c" (ecx));
8179
return pkru;
8280
}
8381

@@ -89,8 +87,7 @@ static inline void wrpkru(u32 pkru)
8987
* "wrpkru" instruction. Loads contents in EAX to PKRU,
9088
* requires that ecx = edx = 0.
9189
*/
92-
asm volatile(".byte 0x0f,0x01,0xef\n\t"
93-
: : "a" (pkru), "c"(ecx), "d"(edx));
90+
asm volatile("wrpkru" : : "a" (pkru), "c"(ecx), "d"(edx));
9491
}
9592

9693
#else

0 commit comments

Comments
 (0)