From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AC8334C6E for ; Fri, 21 Mar 2014 16:03:40 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 21 Mar 2014 08:05:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,704,1389772800"; d="scan'208";a="503842487" Received: from unknown (HELO hanvin-mobl6.amr.corp.intel.com) ([10.255.40.21]) by fmsmga002.fm.intel.com with ESMTP; 21 Mar 2014 08:03:34 -0700 Message-ID: <532C54C6.2060202@linux.intel.com> Date: Fri, 21 Mar 2014 08:03:34 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Neil Horman , dev@dpdk.org References: <20140320163921.GC7721@hmsreliant.think-freely.org> <1395413340-27392-1-git-send-email-nhorman@tuxdriver.com> In-Reply-To: <1395413340-27392-1-git-send-email-nhorman@tuxdriver.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] 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: Fri, 21 Mar 2014 15:03:41 -0000 On 03/21/2014 07:49 AM, Neil Horman wrote: > From: "H. Peter Anvin" > > 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 > Tested-by: Neil Horman > Thank you for dealing with this! On the subject of my other email... are C99 initializers acceptable in dpdk? If so, I think making that change, too, would be a good idea. -hpa