[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200827164905.88235-1-ubizjak@gmail.com>
Date: Thu, 27 Aug 2020 18:49:05 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: x86@...nel.org, linux-kernel@...r.kernel.org
Cc: Uros Bizjak <ubizjak@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH] x86: Use XORL r32,r32 in __get_user_asm
Use XORL r32,r32 for all operand sizes. x86_64 zero extends 32bit
operations, so for 64bit operands, XORL r32,r32 is functionally
equal to XORL r64,r64, but avoids a REX prefix byte when legacy
registers are used.
32bit operation also avoids 0x66 size prefix for 16bit operands
and REX prefix when %sil, %dil and %bpl 8bit registers are used.
As a bonus, 32bit XORL 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.
Signed-off-by: Uros Bizjak <ubizjak@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: "H. Peter Anvin" <hpa@...or.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
Powered by blists - more mailing lists