lkml.org 
[lkml]   [2020]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] x86: Use xorl %0,%0 in __get_user_asm
Date
xorl %0,%0 is equivalent to xorq %0,%0 as both will zero the
entire register. Use xorl %0,%0 for all operand sizes to avoid
REX prefix byte when legacy registers are used and to avoid size
prefix byte when 16bit registers are used.

Zeroing the full register is OK in this use case. xorl %0,%0 also
breaks register dependency chains, avoiding potential partial
register stalls with 8 and 16bit operands.

The patch lowers the size of .fixup section by 20 bytes.

Changes since v1:
- Rewrite commit message.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
arch/x86/include/asm/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index ecefaffd15d4..2bffba2a1b23 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -343,7 +343,7 @@ do { \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: mov %[efault],%[errout]\n" \
- " xor"itype" %[output],%[output]\n" \
+ " xorl %k[output],%k[output]\n" \
" jmp 2b\n" \
".previous\n" \
_ASM_EXTABLE_UA(1b, 3b) \
--
2.26.2
\
 
 \ /
  Last update: 2020-08-27 20:10    [W:0.059 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site