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

Thomas Monjalon thomas.monjalon at 6wind.com
Wed Apr 2 14:42:03 CEST 2014


2014-03-25 13:51, H. Peter Anvin:
> On 03/25/2014 12:52 PM, Neil Horman wrote:
> > 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>
> > Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
> 
> Looks good to me.
> 
> Reviewed-by: H. Peter Anvin <hpa at linux.intel.com>

Applied for version 1.6.0r2.

Thanks for this difficult fix.
-- 
Thomas


More information about the dev mailing list