From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22693 invoked by alias); 14 Jun 2006 15:02:09 -0000 Received: (qmail 22681 invoked by uid 22791); 14 Jun 2006 15:02:07 -0000 X-Spam-Check-By: sourceware.org Received: from smtp111.sbc.mail.mud.yahoo.com (HELO smtp111.sbc.mail.mud.yahoo.com) (68.142.198.210) by sourceware.org (qpsmtpd/0.31) with SMTP; Wed, 14 Jun 2006 15:02:01 +0000 Received: (qmail 10836 invoked from network); 14 Jun 2006 15:01:59 -0000 Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@71.146.67.96 with login) by smtp111.sbc.mail.mud.yahoo.com with SMTP; 14 Jun 2006 15:01:59 -0000 Received: by lucon.org (Postfix, from userid 1000) id 89B8563EEC; Wed, 14 Jun 2006 08:01:58 -0700 (PDT) Date: Wed, 14 Jun 2006 15:14:00 -0000 From: "H. J. Lu" To: Nick Clifton Cc: binutils@sources.redhat.com Subject: Re: PATCH: Add --alt-nops=short|long to x86/x86-64 assemblers Message-ID: <20060614150158.GA30299@lucon.org> References: <20060613190254.GB21884@lucon.org> <448FBB66.7040806@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <448FBB66.7040806@redhat.com> User-Agent: Mutt/1.4.2.1i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00229.txt.bz2 On Wed, Jun 14, 2006 at 08:31:50AM +0100, Nick Clifton wrote: > Hi H.J. > > >Since Pentium Pro, there are new nops instructions. This patch adds > >--alt-nops=short|long to x86/x86-64 assemblers. --alt-nops=short > >will generate a single nop instruction up to 10 bytes for code > >alignment. --alt-nops=long will generate a single nop instruction up > >to 15 bytes. Any comments? > > I am not familiar with the x86 instruction set, so please can you > explain why it is necessary to have these two different versions of the > nop and why the user has to select one ? ie if the space to be padded > is up to 10 bytes why can't the assembler just use the "short" version > automatically and if it is longer than 10 bytes use the "long" version ? x86/x86-64 assemblers need to fill the text section from 1 to 15 bytes for alignment. We have simple nop instructions for 1 to 10 bytes. For 11 to 15 bytes, we can add 0x66 prefix repeatedly to 10 byte nop to get 11-15byte nops. However some processors prefer simple nops. That is, 3 0x66 prefixes on the 10 byte nop are slower on those processors than a 6 byte nop + a 7 byte nop. User can use --alt-nops=short to avoid repeated 0x66 prefixes. Maybe we can use something other than short|long. But I don't have a better name. H.J.