From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id E68E5AFCB for ; Tue, 15 Apr 2014 16:56:16 +0200 (CEST) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1Wa4mS-0001r3-S9; Tue, 15 Apr 2014 10:56:16 -0400 Date: Tue, 15 Apr 2014 10:56:12 -0400 From: Neil Horman To: "De Lara Guarch, Pablo" Message-ID: <20140415145612.GE3557@hmsreliant.think-freely.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v5] eal_common_cpuflags: Fix %rbx corruption, and simplify the code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Apr 2014 14:56:17 -0000 On Tue, Apr 15, 2014 at 02:09:34PM +0000, De Lara Guarch, Pablo wrote: > Hi, > > I have checked that on gcc-4.5, I get a compilation error due to the following patch: > > > > Neil Horman reported that on x86-64 the upper half of %rbx would get > > > clobbered when the code was compiled PIC or PIE, because the > > > i386-specific code to preserve %ebx was incorrectly compiled. > > > > > > However, the code is really way more complex than it needs to be. > > > For one thing, the CPUID instruction only needs %eax (leaf) and %ecx > > > (subleaf) as parameters, and since we are testing for bits, we might > > > as well list the bits explicitly. Furthermore, we can use an array > > > rather than doing a switch statement inside a structure. > > > > > > Reported-by: Neil Horman > > > Signed-off-by: H. Peter Anvin > > > Signed-off-by: Neil Horman > > The compilation error is: > > /root/dpdk/lib/librte_eal/common/eal_common_cpuflags.c: In function 'rte_cpu_check_supported': > /root/dpdk/lib/librte_eal/common/eal_common_cpuflags.c:271:48: error: array subscript is above array bounds > make[7]: *** [eal_common_cpuflags.o] Error 1 > > This error is not present in newer gcc versions (4.6 and above). > > Thanks, > > Pablo de Lara > DPDK SW Engineer > What was the value of RTE_COMPILE_TIME_CPUFLAGS when you built your library? If you added defines for flag support that are not tested for yet in the cpu_feature_table, that would be the error you would see I think Regards Neil > -------------------------------------------------------------- > Intel Shannon Limited > Registered in Ireland > Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare > > >