From: Uros Bizjak <ubizjak@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>,
Yu-cheng Yu <yu-cheng.yu@intel.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Borislav Petkov <bp@alien8.de>, Kees Cook <keescook@chromium.org>,
Mike Rapoport <rppt@kernel.org>, Ingo Molnar <mingo@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
"H . Peter Anvin" <hpa@zytor.com>
Subject: [PATCH] x86/asm: Use "m" operand constraint in WRUSSQ asm template
Date: Tue, 19 Mar 2024 18:16:46 +0100 [thread overview]
Message-ID: <20240319171714.76342-1-ubizjak@gmail.com> (raw)
The WRUSSQ instruction uses a memory operand, so use "m"
operand constraint instead of forcing usage of pointer
register using "r" constraint. The generated assembly
code improves from:
6ece3: 48 8d 43 f8 lea -0x8(%rbx),%rax
...
6eceb: 66 48 0f 38 f5 18 wrussq %rbx,(%rax)
to:
6ecea: 66 48 0f 38 f5 43 f8 wrussq %rax,-0x8(%rbx)
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
---
arch/x86/include/asm/special_insns.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index 0ee2ba589492..aec6e2d3aa1d 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -205,9 +205,9 @@ static inline void clwb(volatile void *__p)
#ifdef CONFIG_X86_USER_SHADOW_STACK
static inline int write_user_shstk_64(u64 __user *addr, u64 val)
{
- asm goto("1: wrussq %[val], (%[addr])\n"
+ asm goto("1: wrussq %[val], %[addr]\n"
_ASM_EXTABLE(1b, %l[fail])
- :: [addr] "r" (addr), [val] "r" (val)
+ :: [addr] "m" (*addr), [val] "r" (val)
:: fail);
return 0;
fail:
--
2.42.0
next reply other threads:[~2024-03-19 17:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 17:16 Uros Bizjak [this message]
2024-03-20 11:21 ` [tip: x86/asm] x86/asm: Use "m" operand constraint in WRUSSQ asm template tip-bot2 for Uros Bizjak
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=20240319171714.76342-1-ubizjak@gmail.com \
--to=ubizjak@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=rick.p.edgecombe@intel.com \
--cc=rppt@kernel.org \
--cc=x86@kernel.org \
--cc=yu-cheng.yu@intel.com \
/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