All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] x86/asm: inline constant inputs in rdpkru(), wrpkru()
@ 2025-03-07  6:12 Alexey Dobriyan
  2025-03-07  6:12 ` [PATCH 2/4] x86/asm: delete dummy variable in clwb() Alexey Dobriyan
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Alexey Dobriyan @ 2025-03-07  6:12 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen; +Cc: x86, hpa, linux-kernel, Alexey Dobriyan

Put immediate values directly into registers deleting dummy variables.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 arch/x86/include/asm/special_insns.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index 21ce480658b1..494a1aa19f05 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -79,7 +79,6 @@ void native_write_cr4(unsigned long val);
 #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
 static inline u32 rdpkru(void)
 {
-	u32 ecx = 0;
 	u32 edx, pkru;
 
 	/*
@@ -88,20 +87,18 @@ static inline u32 rdpkru(void)
 	 */
 	asm volatile(".byte 0x0f,0x01,0xee\n\t"
 		     : "=a" (pkru), "=d" (edx)
-		     : "c" (ecx));
+		     : "c" (0));
 	return pkru;
 }
 
 static inline void wrpkru(u32 pkru)
 {
-	u32 ecx = 0, edx = 0;
-
 	/*
 	 * "wrpkru" instruction.  Loads contents in EAX to PKRU,
 	 * requires that ecx = edx = 0.
 	 */
 	asm volatile(".byte 0x0f,0x01,0xef\n\t"
-		     : : "a" (pkru), "c"(ecx), "d"(edx));
+		     : : "a" (pkru), "c" (0), "d" (0));
 }
 
 #else
-- 
2.45.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-03-07 16:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07  6:12 [PATCH 1/4] x86/asm: inline constant inputs in rdpkru(), wrpkru() Alexey Dobriyan
2025-03-07  6:12 ` [PATCH 2/4] x86/asm: delete dummy variable in clwb() Alexey Dobriyan
2025-03-07  6:12 ` [PATCH 3/4] x86/asm: delete dummy variables in movdir64b() Alexey Dobriyan
2025-03-07 11:49   ` Ingo Molnar
2025-03-07 11:54     ` H. Peter Anvin
2025-03-07 16:15     ` Alexey Dobriyan
2025-03-07 16:23       ` H. Peter Anvin
2025-03-07  6:12 ` [PATCH 4/4] x86/asm: delete dummy variable in enqcmds() Alexey Dobriyan
2025-03-07 16:29 ` [PATCH 1/4] x86/asm: inline constant inputs in rdpkru(), wrpkru() Dave Hansen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.