From: Alexey Dobriyan <adobriyan@gmail.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com
Cc: x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
Alexey Dobriyan <adobriyan@gmail.com>
Subject: [PATCH 1/4] x86/asm: inline constant inputs in rdpkru(), wrpkru()
Date: Fri, 7 Mar 2025 09:12:00 +0300 [thread overview]
Message-ID: <20250307061203.3281-1-adobriyan@gmail.com> (raw)
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
next reply other threads:[~2025-03-07 6:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 6:12 Alexey Dobriyan [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2025-03-06 21:07 Alexey Dobriyan
2025-03-06 21:35 ` Dave Hansen
2025-03-07 16:19 ` Alexey Dobriyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250307061203.3281-1-adobriyan@gmail.com \
--to=adobriyan@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®