This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

src/gdb ChangeLog Makefile.in go32-nat.c commo ...


CVSROOT:	/cvs/src
Module name:	src
Changes by:	vapier@sourceware.org	2013-06-19 22:29:37

Modified files:
	gdb            : ChangeLog Makefile.in go32-nat.c 
	gdb/common     : linux-btrace.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.arch: i386-avx.c i386-avx.exp i386-sse.c 
	                        i386-sse.exp 
Added files:
	gdb/common     : i386-cpuid.h i386-gcc-cpuid.h 
Removed files:
	gdb/testsuite/gdb.arch: i386-cpuid.h 

Log message:
	gdb: clean up x86 cpuid implementations
	
	We've currently got 3 files doing open coded implementations of cpuid.
	Each has its own set of workarounds and varying levels of how well
	they're written and are generally hardcoded to specific cpuid functions.
	If you try to build the latest gdb as a PIE on an i386 system, the build
	will fail because one of them lacks PIC workarounds (wrt ebx).
	
	Specifically, we have:
	common/linux-btrace.c:
	two copies of cpuid asm w/specific args, one has no workarounds
	while the other implicitly does to avoid memcpy
	go32-nat.c:
	two copies of cpuid asm w/specific args, one has workarounds to
	avoid memcpy
	gdb/testsuite/gdb.arch/i386-cpuid.h:
	one general cpuid asm w/many workarounds copied from older gcc
	
	Fortunately, that last header there is pretty damn good -- it handles
	lots of edge cases, the code is nice & tight (uses gcc asm operands
	rather than manual movs), and is already almost a general library type
	header.  It's also the basis of what is now the public cpuid.h that is
	shipped with gcc-4.3+.
	
	So what I've done is pull that test header out and into gdb/common/
	(not sure if there's a better place), synced to the version found in
	gcc-4.8.0, put a wrapper API around it, and then cut over all the
	existing call points to this new header.
	
	Since the func already has support for "is cpuid supported on this proc",
	it makes it trivial to push the i386/x86_64 ifdefs down into this wrapper
	API too.  Now it can be safely used for all targets and gcc will elide
	the unused code for us.
	
	I've verified the gdb.arch testsuite still passes, and this code compiles
	for an armv7a host as well as x86_64.  The go32-nat code has been left
	ifdef-ed out until someone can test & verify the new stuff works (and if
	it doesn't, figure out how to make the new code work).
	
	URL: https://bugs.gentoo.org/467806
	Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15718&r2=1.15719
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/Makefile.in.diff?cvsroot=src&r1=1.1256&r2=1.1257
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/go32-nat.c.diff?cvsroot=src&r1=1.94&r2=1.95
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/common/i386-cpuid.h.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/common/i386-gcc-cpuid.h.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/common/linux-btrace.c.diff?cvsroot=src&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3701&r2=1.3702
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.arch/i386-avx.c.diff?cvsroot=src&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.arch/i386-avx.exp.diff?cvsroot=src&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.arch/i386-sse.c.diff?cvsroot=src&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.arch/i386-sse.exp.diff?cvsroot=src&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.arch/i386-cpuid.h.diff?cvsroot=src&r1=1.10&r2=NONE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]