Skip to content

Commit 6483371

Browse files
ubizjakIngo Molnar
authored andcommitted
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: Uros Bizjak <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d689863 commit 6483371

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/include/asm/special_insns.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ static inline void clwb(volatile void *__p)
205205
#ifdef CONFIG_X86_USER_SHADOW_STACK
206206
static inline int write_user_shstk_64(u64 __user *addr, u64 val)
207207
{
208-
asm goto("1: wrussq %[val], (%[addr])\n"
208+
asm goto("1: wrussq %[val], %[addr]\n"
209209
_ASM_EXTABLE(1b, %l[fail])
210-
:: [addr] "r" (addr), [val] "r" (val)
210+
:: [addr] "m" (*addr), [val] "r" (val)
211211
:: fail);
212212
return 0;
213213
fail:

0 commit comments

Comments
 (0)