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

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Tue Apr 15 16:09:34 CEST 2014


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 <nhorman at tuxdriver.com>
> > Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
> > Signed-off-by: Neil Horman <nhorman at tuxdriver.com>

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

--------------------------------------------------------------
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




More information about the dev mailing list