From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752465AbbCZJxE (ORCPT ); Thu, 26 Mar 2015 05:53:04 -0400 Received: from mail.skyhub.de ([78.46.96.112]:51269 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbbCZJxB (ORCPT ); Thu, 26 Mar 2015 05:53:01 -0400 Date: Thu, 26 Mar 2015 10:51:14 +0100 From: Borislav Petkov To: Ingo Molnar Cc: Linus Torvalds , "H. Peter Anvin" , Denys Vlasenko , Steven Rostedt , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [PATCH 3/4] x86/asm/entry/64: use smaller insns Message-ID: <20150326095114.GB27751@pd.tnic> References: <1427303896-24023-1-git-send-email-dvlasenk@redhat.com> <1427303896-24023-3-git-send-email-dvlasenk@redhat.com> <20150326092712.GA27751@pd.tnic> <20150326093732.GC14706@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150326093732.GC14706@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 26, 2015 at 10:37:32AM +0100, Ingo Molnar wrote: > But here GAS generates the 10-byte opcode even if 'mov $0x12345678, > %rdi' is used, which is an unforced error. 7 bytes: 48 c7 c7 78 56 34 12 mov $0x12345678,%rdi which is REX + opcode C7 + ModRM + 4-byte immediate. If it used the bX opcodes, it would have to use REX prefix too for the %rdi register which would generate a 10-byte insn then: 0: 48 bf 78 56 43 12 00 mov $0x12435678,%rdi 7: 00 00 00 REX + opcode BF + 8 bytes immediate. So I think using the REX register "rdi" forces it to use the REX prefix and thus the longer instructions. All IMHO of course. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --