Commit 64833714 authored by Uros Bizjak's avatar Uros Bizjak Committed by Ingo Molnar

x86/asm: Use "m" operand constraint in WRUSSQ asm template

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: default avatarUros Bizjak <ubizjak@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/r/20240319171714.76342-1-ubizjak@gmail.com
parent d689863c
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment