[dpdk-dev] [PATCH v2] eal_common_cpuflags: Fix %rbx corruption, and simplify the code

H. Peter Anvin hpa at linux.intel.com
Fri Mar 21 16:03:34 CET 2014


On 03/21/2014 07:49 AM, Neil Horman wrote:
> From: "H. Peter Anvin" <hpa at linux.intel.com>
> 
> 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 <nhorman at tuxdriver.com>
> Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
> Tested-by: Neil Horman <nhorman at tuxdriver.com>
> 

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




More information about the dev mailing list