Bug #534
closedRegression from Issue #466: cpuid instruction clobbers ebx register on i386
Description
Issue: src/util-cpu.c::UtilCpuGetTicks() - On i386, the cpuid
asm instruction clobbers %ebx
, which is used as the PIC register. It looks like Issue #466 introduced this code.
Error:gcc -DHAVE_CONFIG_H -I. -I.. -I../libhtp -D_FORTIFY_SOURCE=2 -I/usr/include/nspr -I/usr/include/nss -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -DRELEASE -Wextra -Wall -fno-strict-aliasing -fno-tree-pre -Wno-unused-parameter -std=gnu99 -fstack-protector -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -march=native -DNFQ -DPRELUDE -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -I/usr/include -DLIBPCAP_VERSION_MAJOR=1 -DHAVE_PCAP_SET_BUFF -DHAVE_LIBCAP_NG -c util-cpu.c
util-cpu.c: In function 'UtilCpuGetTicks':
util-cpu.c:193:5: error: PIC register clobbered by '%ebx' in 'asm'
util-cpu.c:207:5: error: PIC register clobbered by '%ebx' in 'asm'
make[4]: *** [util-cpu.o] Error 1
Proposed Fix: Since the output of the cpuid
instruction isn't really used, simply save %ebx
before cpuid
and restore it afterwards on the i386 arch.
Files