From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752490AbbCZKZi (ORCPT ); Thu, 26 Mar 2015 06:25:38 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:34619 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326AbbCZKZg (ORCPT ); Thu, 26 Mar 2015 06:25:36 -0400 Date: Thu, 26 Mar 2015 11:25:31 +0100 From: Ingo Molnar To: Denys Vlasenko Cc: Borislav Petkov , 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: <20150326102531.GA19907@gmail.com> 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=us-ascii Content-Disposition: inline In-Reply-To: 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 * Denys Vlasenko wrote: > In my experiment, GAS uses 10-byte insn only for constants which > won't work with 7-byte encoding; or if I explicitly ask for "movabs": > > _start: .globl _start > mov $0x12345678,%edi # 5 bytes > mov $0x12345678,%rdi # 7 bytes > movq $0x12345678,%rdi # 7 bytes > mov $0x80000000,%rdi # 10 bytes > mov $0x123456789,%rdi # 10 bytes > movabs $0x12345678,%rdi # 10 bytes > > > $ gcc -nostartfiles -nostdlib -c z.S && objdump -dr z.o > z.o: file format elf64-x86-64 > Disassembly of section .text: > 0000000000000000 <_start>: > 0: bf 78 56 34 12 mov $0x12345678,%edi > 5: 48 c7 c7 78 56 34 12 mov $0x12345678,%rdi > c: 48 c7 c7 78 56 34 12 mov $0x12345678,%rdi > 13: 48 bf 00 00 00 80 00 movabs $0x80000000,%rdi > 1a: 00 00 00 > 1d: 48 bf 89 67 45 23 01 movabs $0x123456789,%rdi > 24: 00 00 00 > 27: 48 bf 78 56 34 12 00 movabs $0x12345678,%rdi > 2e: 00 00 00 I see, so: movq $AUDIT_ARCH_X86_64, %rsi generated a 10-byte MOVABS opcode, while moving into %esi generates the 5-byte 32-bit MOV opcode? Thanks, Ingo