From 3a13a53b432d732be258d677b6afca969ce0d65f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 8 Apr 2010 22:32:38 +0000 Subject: Support i386 without SSE. gdb/ 2010-04-08 H.J. Lu * i386-linux-nat.c (have_ptrace_getfpxregs): Initialize to -1 if HAVE_PTRACE_GETFPXREGS is defined. (i386_linux_read_description): Set have_ptrace_getfpxregs and have_ptrace_getregset to 0 if ptrace PTRACE_GETFPXREGS failed. * i386-linux-tdep.c: Include "features/i386/i386-mmx-linux.c" (i386_linux_core_read_description): Return tdesc_i386_mmx_linux if .reg-xfp section doesn't exist. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_mmx_linux. * i386-linux-tdep.h (tdesc_i386_mmx_linux): New. * i386-tdep.c: Include "features/i386/i386-mmx.c". (i386_go32_init_abi): Set tdesc to tdesc_i386_mmx. (i386_validate_tdesc_p): Make org.gnu.gdb.i386.sse optional. Set xcr0 to I386_XSTATE_X87_MASK if SSE isn't available. (i386_gdbarch_init): Update comments. (_initialize_i386_tdep): Call initialize_tdesc_i386_mmx. * common/i386-xstate.h (I386_XSTATE_X87_MASK): New. * config/djgpp/fnchange.lst: Add i386 MMX XML files. * features/Makefile (i386/i386-mmx-expedite): New. (i386/i386-mmx-linux-expedite): Likewise. ($(outdir)/i386/i386-mmx.dat): Likewise. ($(outdir)/i386/i386-mmx-linux.dat): Likewise. * features/i386/i386-mmx-linux.c: New. * features/i386/i386-mmx-linux.xml: Likewise. * features/i386/i386-mmx.c: Likewise. * features/i386/i386-mmx.xml: Likewise. * regformats/i386/i386-mmx-linux.dat: Likewise. * regformats/i386/i386-mmx.dat: Likewise. * features/Makefile (WHICH): Add i386/i386-mmx and i386/i386-mmx-linux. gdb/doc/ 2010-04-08 H.J. Lu * gdb.texinfo (i386 Features): Make org.gnu.gdb.i386.avx optional. Make org.gnu.gdb.i386.avx requires org.gnu.gdb.i386.avx. gdb/gdbserver/ 2010-04-08 H.J. Lu * Makefile.in (clean): Also remove i386-mmx.c i386-mmx-linux.c. (i386-mmx.o): New. (i386-mmx.c): Likewise. (i386-mmx-linux.o): Likewise. (i386-mmx-linux.c): Likewise. * configure.srv (srv_i386_regobj): Add i386-mmx.o. (srv_i386_linux_regobj): Add i386-mmx-linux.o. (srv_i386_xmlfiles): Add i386/i386-mmx.xml. (srv_i386_linux_xmlfiles): Add i386/i386-mmx-linux.xml. * linux-x86-low.c (init_registers_i386_mmx_linux): New. (x86_linux_update_xmltarget): Call init_registers_i386_mmx_linux and return if ptrace PTRACE_GETFPXREGS failed in 32bit. --- gdb/gdbserver/ChangeLog | 17 +++++++++++++++++ gdb/gdbserver/Makefile.in | 7 +++++++ gdb/gdbserver/configure.srv | 8 ++++---- gdb/gdbserver/linux-x86-low.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 68 insertions(+), 7 deletions(-) (limited to 'gdb/gdbserver') diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 8a26b27..e9324d1 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,20 @@ +2010-04-08 H.J. Lu + + * Makefile.in (clean): Also remove i386-mmx.c i386-mmx-linux.c. + (i386-mmx.o): New. + (i386-mmx.c): Likewise. + (i386-mmx-linux.o): Likewise. + (i386-mmx-linux.c): Likewise. + + * configure.srv (srv_i386_regobj): Add i386-mmx.o. + (srv_i386_linux_regobj): Add i386-mmx-linux.o. + (srv_i386_xmlfiles): Add i386/i386-mmx.xml. + (srv_i386_linux_xmlfiles): Add i386/i386-mmx-linux.xml. + + * linux-x86-low.c (init_registers_i386_mmx_linux): New. + (x86_linux_update_xmltarget): Call init_registers_i386_mmx_linux + and return if ptrace PTRACE_GETFPXREGS failed in 32bit. + 2010-04-07 H.J. Lu * Makefile.in (clean): Updated. diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 2ec9784..a95837a 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -219,6 +219,7 @@ clean: rm -f xml-builtin.c stamp-xml rm -f i386-avx.c i386-avx-linux.c rm -f amd64-avx.c amd64-avx-linux.c + rm -f i386-mmx.c i386-mmx-linux.c maintainer-clean realclean distclean: clean rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log @@ -359,6 +360,12 @@ i386-avx.c : $(srcdir)/../regformats/i386/i386-avx.dat $(regdat_sh) i386-avx-linux.o : i386-avx-linux.c $(regdef_h) i386-avx-linux.c : $(srcdir)/../regformats/i386/i386-avx-linux.dat $(regdat_sh) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx-linux.dat i386-avx-linux.c +i386-mmx.o : i386-mmx.c $(regdef_h) +i386-mmx.c : $(srcdir)/../regformats/i386/i386-mmx.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-mmx.dat i386-mmx.c +i386-mmx-linux.o : i386-mmx-linux.c $(regdef_h) +i386-mmx-linux.c : $(srcdir)/../regformats/i386/i386-mmx-linux.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-mmx-linux.dat i386-mmx-linux.c reg-ia64.o : reg-ia64.c $(regdef_h) reg-ia64.c : $(srcdir)/../regformats/reg-ia64.dat $(regdat_sh) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-ia64.dat reg-ia64.c diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 8bc9aeb..803d3f4 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -22,16 +22,16 @@ # Default hostio_last_error implementation srv_hostio_err_objs="hostio-errno.o" -srv_i386_regobj="i386.o i386-avx.o" -srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o" +srv_i386_regobj="i386.o i386-avx.o i386-mmx.o" +srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-mmx-linux.o" srv_amd64_regobj="amd64.o x86-64-avx.o" srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o" srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml" srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml" -srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml $srv_i386_32bit_xmlfiles" +srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml i386/i386-mmx.xml $srv_i386_32bit_xmlfiles" srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml $srv_i386_64bit_xmlfiles" -srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles" +srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/i386-mmx-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles" srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles" # Input is taken from the "${target}" variable. diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 3853b25..9754c1e 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -37,6 +37,8 @@ void init_registers_amd64_linux (void); void init_registers_i386_avx_linux (void); /* Defined in auto-generated file amd64-avx-linux.c. */ void init_registers_amd64_avx_linux (void); +/* Defined in auto-generated file i386-mmx-linux.c. */ +void init_registers_i386_mmx_linux (void); /* Backward compatibility for gdb without XML support. */ @@ -828,19 +830,56 @@ static int use_xml; static void x86_linux_update_xmltarget (void) { + int pid; + struct regset_info *regset; static unsigned long long xcr0; static int have_ptrace_getregset = -1; +#ifdef HAVE_PTRACE_GETFPXREGS + static int have_ptrace_getfpxregs = -1; +#endif if (!current_inferior) return; + pid = pid_of (get_thread_lwp (current_inferior)); #ifdef __x86_64__ if (num_xmm_registers == 8) init_registers_i386_linux (); else init_registers_amd64_linux (); #else - init_registers_i386_linux (); + { +# ifdef HAVE_PTRACE_GETFPXREGS + if (have_ptrace_getfpxregs == -1) + { + elf_fpxregset_t fpxregs; + + if (ptrace (PTRACE_GETFPXREGS, pid, 0, (int) &fpxregs) < 0) + { + have_ptrace_getfpxregs = 0; + x86_xcr0 = I386_XSTATE_X87_MASK; + + /* Disable PTRACE_GETFPXREGS. */ + for (regset = target_regsets; + regset->fill_function != NULL; regset++) + if (regset->get_request == PTRACE_GETFPXREGS) + { + regset->size = 0; + break; + } + } + else + have_ptrace_getfpxregs = 1; + } + + if (!have_ptrace_getfpxregs) + { + init_registers_i386_mmx_linux (); + return; + } +# endif + init_registers_i386_linux (); + } #endif if (!use_xml) @@ -863,10 +902,8 @@ x86_linux_update_xmltarget (void) /* Check if XSAVE extended state is supported. */ if (have_ptrace_getregset == -1) { - int pid = pid_of (get_thread_lwp (current_inferior)); unsigned long long xstateregs[I386_XSTATE_SSE_SIZE / sizeof (long long)]; struct iovec iov; - struct regset_info *regset; iov.iov_base = xstateregs; iov.iov_len = sizeof (xstateregs); -- cgit v1.1