* PATCH: Support i386 without SSE @ 2010-04-07 20:05 H.J. Lu 2010-04-07 20:12 ` H.J. Lu 2010-04-08 19:08 ` Mark Kettenis 0 siblings, 2 replies; 10+ messages in thread From: H.J. Lu @ 2010-04-07 20:05 UTC (permalink / raw) To: GDB Hi, This patch supports i386 without SSE. Any comments/suggestions? Thanks. H.J, --- gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * 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. * 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-07 H.J. Lu <hongjiu.lu@intel.com> * 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-07 H.J. Lu <hongjiu.lu@intel.com> * 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. diff --git a/gdb/common/i386-xstate.h b/gdb/common/i386-xstate.h index 5e16015..ec40a0d 100644 --- a/gdb/common/i386-xstate.h +++ b/gdb/common/i386-xstate.h @@ -26,6 +26,7 @@ #define I386_XSTATE_AVX (1ULL << 2) /* Supported mask and size of the extended state. */ +#define I386_XSTATE_X87_MASK I386_XSTATE_X87 #define I386_XSTATE_SSE_MASK (I386_XSTATE_X87 | I386_XSTATE_SSE) #define I386_XSTATE_AVX_MASK (I386_XSTATE_SSE_MASK | I386_XSTATE_AVX) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index fd8b0bc..a818ece 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -33846,7 +33846,7 @@ targets. It should describe the following registers: The register sets may be different, depending on the target. -The @samp{org.gnu.gdb.i386.sse} feature is required. It should +The @samp{org.gnu.gdb.i386.sse} feature is optional. It should describe registers: @itemize @minus @@ -33858,7 +33858,8 @@ describe registers: @samp{mxcsr} @end itemize -The @samp{org.gnu.gdb.i386.avx} feature is optional. It should +The @samp{org.gnu.gdb.i386.avx} feature is optional and requires the +@samp{org.gnu.gdb.i386.sse} feature. It should describe the upper 128 bits of @sc{ymm} registers: @itemize @minus diff --git a/gdb/features/Makefile b/gdb/features/Makefile index 1166582..987854b 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -32,6 +32,7 @@ WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \ i386/i386 i386/i386-linux \ + i386/i386-mmx i386/i386-mmx-linux \ i386/amd64 i386/amd64-linux \ i386/i386-avx i386/i386-avx-linux \ i386/amd64-avx i386/amd64-avx-linux \ @@ -49,6 +50,8 @@ i386/amd64-expedite = rbp,rsp,rip i386/amd64-linux-expedite = rbp,rsp,rip i386/i386-avx-expedite = ebp,esp,eip i386/i386-avx-linux-expedite = ebp,esp,eip +i386/i386-mmx-expedite = ebp,esp,eip +i386/i386-mmx-linux-expedite = ebp,esp,eip i386/amd64-avx-expedite = rbp,rsp,rip i386/amd64-avx-linux-expedite = rbp,rsp,rip mips-expedite = r29,pc @@ -99,6 +102,8 @@ $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \ $(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml $(outdir)/i386/i386-avx-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \ i386/32bit-linux.xml +$(outdir)/i386/i386-mmx.dat: i386/32bit-core.xml +$(outdir)/i386/i386-mmx-linux.dat: i386/32bit-core.xml i386/32bit-linux.xml $(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml $(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ i386/64bit-linux.xml diff --git a/gdb/features/i386/i386-mmx-linux.c b/gdb/features/i386/i386-mmx-linux.c new file mode 100644 index 0000000..364ade4 --- /dev/null +++ b/gdb/features/i386/i386-mmx-linux.c @@ -0,0 +1,76 @@ +/* THIS FILE IS GENERATED. Original: i386-mmx-linux.xml */ + +#include "defs.h" +#include "osabi.h" +#include "target-descriptions.h" + +struct target_desc *tdesc_i386_mmx_linux; +static void +initialize_tdesc_i386_mmx_linux (void) +{ + struct target_desc *result = allocate_target_description (); + struct tdesc_feature *feature; + struct tdesc_type *field_type, *type; + + set_tdesc_architecture (result, bfd_scan_arch ("i386")); + + set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux")); + + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core"); + field_type = tdesc_create_flags (feature, "i386_eflags", 4); + tdesc_add_flag (field_type, 0, "CF"); + tdesc_add_flag (field_type, 1, ""); + tdesc_add_flag (field_type, 2, "PF"); + tdesc_add_flag (field_type, 4, "AF"); + tdesc_add_flag (field_type, 6, "ZF"); + tdesc_add_flag (field_type, 7, "SF"); + tdesc_add_flag (field_type, 8, "TF"); + tdesc_add_flag (field_type, 9, "IF"); + tdesc_add_flag (field_type, 10, "DF"); + tdesc_add_flag (field_type, 11, "OF"); + tdesc_add_flag (field_type, 14, "NT"); + tdesc_add_flag (field_type, 16, "RF"); + tdesc_add_flag (field_type, 17, "VM"); + tdesc_add_flag (field_type, 18, "AC"); + tdesc_add_flag (field_type, 19, "VIF"); + tdesc_add_flag (field_type, 20, "VIP"); + tdesc_add_flag (field_type, 21, "ID"); + + tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags"); + tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int"); + tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int"); + tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int"); + + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); + tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int"); + + tdesc_i386_mmx_linux = result; +} diff --git a/gdb/features/i386/i386-mmx-linux.xml b/gdb/features/i386/i386-mmx-linux.xml new file mode 100644 index 0000000..19d4f3f --- /dev/null +++ b/gdb/features/i386/i386-mmx-linux.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 2010 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!-- I386 with MMX - Includes Linux-only special "register". --> + +<!DOCTYPE target SYSTEM "gdb-target.dtd"> +<target> + <architecture>i386</architecture> + <osabi>GNU/Linux</osabi> + <xi:include href="32bit-core.xml"/> + <xi:include href="32bit-linux.xml"/> +</target> diff --git a/gdb/features/i386/i386-mmx.c b/gdb/features/i386/i386-mmx.c new file mode 100644 index 0000000..f43df65 --- /dev/null +++ b/gdb/features/i386/i386-mmx.c @@ -0,0 +1,71 @@ +/* THIS FILE IS GENERATED. Original: i386-mmx.xml */ + +#include "defs.h" +#include "osabi.h" +#include "target-descriptions.h" + +struct target_desc *tdesc_i386_mmx; +static void +initialize_tdesc_i386_mmx (void) +{ + struct target_desc *result = allocate_target_description (); + struct tdesc_feature *feature; + struct tdesc_type *field_type, *type; + + set_tdesc_architecture (result, bfd_scan_arch ("i386")); + + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core"); + field_type = tdesc_create_flags (feature, "i386_eflags", 4); + tdesc_add_flag (field_type, 0, "CF"); + tdesc_add_flag (field_type, 1, ""); + tdesc_add_flag (field_type, 2, "PF"); + tdesc_add_flag (field_type, 4, "AF"); + tdesc_add_flag (field_type, 6, "ZF"); + tdesc_add_flag (field_type, 7, "SF"); + tdesc_add_flag (field_type, 8, "TF"); + tdesc_add_flag (field_type, 9, "IF"); + tdesc_add_flag (field_type, 10, "DF"); + tdesc_add_flag (field_type, 11, "OF"); + tdesc_add_flag (field_type, 14, "NT"); + tdesc_add_flag (field_type, 16, "RF"); + tdesc_add_flag (field_type, 17, "VM"); + tdesc_add_flag (field_type, 18, "AC"); + tdesc_add_flag (field_type, 19, "VIF"); + tdesc_add_flag (field_type, 20, "VIP"); + tdesc_add_flag (field_type, 21, "ID"); + + tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags"); + tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int"); + tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int"); + tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int"); + + tdesc_i386_mmx = result; +} diff --git a/gdb/features/i386/i386-mmx.xml b/gdb/features/i386/i386-mmx.xml new file mode 100644 index 0000000..7bb9e7a --- /dev/null +++ b/gdb/features/i386/i386-mmx.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 2010 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!-- I386 with MMX --> + +<!DOCTYPE target SYSTEM "gdb-target.dtd"> +<target> + <architecture>i386</architecture> + <xi:include href="32bit-core.xml"/> +</target> 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); diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index a251907..d559811 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -150,7 +150,7 @@ int have_ptrace_getregs = for this to be a simple variable. */ int have_ptrace_getfpxregs = #ifdef HAVE_PTRACE_GETFPXREGS - 1 + -1 #else 0 #endif @@ -946,19 +946,33 @@ i386_linux_child_post_startup_inferior (ptid_t ptid) static const struct target_desc * i386_linux_read_description (struct target_ops *ops) { + int tid; static uint64_t xcr0; + /* GNU/Linux LWP ID's are process ID's. */ + tid = TIDGET (inferior_ptid); + if (tid == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ + +#ifdef HAVE_PTRACE_GETFPXREGS + if (have_ptrace_getfpxregs == -1) + { + elf_fpxregset_t fpxregs; + + if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0) + { + have_ptrace_getfpxregs = 0; + have_ptrace_getregset = 0; + return tdesc_i386_mmx_linux; + } + } +#endif + if (have_ptrace_getregset == -1) { - int tid; uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))]; struct iovec iov; - /* GNU/Linux LWP ID's are process ID's. */ - tid = TIDGET (inferior_ptid); - if (tid == 0) - tid = PIDGET (inferior_ptid); /* Not a threaded program. */ - iov.iov_base = xstateregs; iov.iov_len = sizeof (xstateregs); diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 34a1924..72aced5 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -50,6 +50,7 @@ #include <stdint.h> #include "features/i386/i386-linux.c" +#include "features/i386/i386-mmx-linux.c" #include "features/i386/i386-avx-linux.c" /* Supported register note sections. */ @@ -616,6 +617,10 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, if (section == NULL) return NULL; + section = bfd_get_section_by_name (abfd, ".reg-xfp"); + if (section == NULL) + return tdesc_i386_mmx_linux; + /* Linux/i386. */ xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) @@ -890,5 +895,6 @@ _initialize_i386_linux_tdep (void) /* Initialize the Linux target description */ initialize_tdesc_i386_linux (); + initialize_tdesc_i386_mmx_linux (); initialize_tdesc_i386_avx_linux (); } diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index eaeb63c..1228681 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -41,6 +41,7 @@ extern uint64_t i386_linux_core_read_xcr0 /* Linux target description. */ extern struct target_desc *tdesc_i386_linux; +extern struct target_desc *tdesc_i386_mmx_linux; extern struct target_desc *tdesc_i386_avx_linux; /* Format of XSAVE extended state is: diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index ce658cd..95a3c95 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -58,6 +58,7 @@ #include "features/i386/i386.c" #include "features/i386/i386-avx.c" +#include "features/i386/i386-mmx.c" /* Register names. */ @@ -2937,8 +2938,8 @@ i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->jb_pc_offset = 36; /* DJGPP does not support the SSE registers. */ - tdep->num_xmm_regs = 0; - set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I387_NUM_REGS); + if (! tdesc_has_registers (info.target_desc)) + tdep->tdesc = tdesc_i386_mmx; /* Native compiler is GCC, which uses the SVR4 register numbering even in COFF and STABS. See the comment in i386_gdbarch_init, @@ -6651,13 +6652,12 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, /* Get core registers. */ feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core"); + if (feature_core == NULL) + return 0; /* Get SSE registers. */ feature_sse = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"); - if (feature_core == NULL || feature_sse == NULL) - return 0; - /* Try AVX registers. */ feature_avx = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"); @@ -6666,6 +6666,10 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, /* The XCR0 bits. */ if (feature_avx) { + /* AVX register description requires SSE register description. */ + if (!feature_sse) + return 0; + tdep->xcr0 = I386_XSTATE_AVX_MASK; /* It may have been set by OSABI initialization function. */ @@ -6681,19 +6685,27 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, tdep->ymm0h_regnum + i, tdep->ymmh_register_names[i]); } - else + else if (feature_sse) tdep->xcr0 = I386_XSTATE_SSE_MASK; + else + { + tdep->xcr0 = I386_XSTATE_X87_MASK; + tdep->num_xmm_regs = 0; + } num_regs = tdep->num_core_regs; for (i = 0; i < num_regs; i++) valid_p &= tdesc_numbered_register (feature_core, tdesc_data, i, tdep->register_names[i]); - /* Need to include %mxcsr, so add one. */ - num_regs += tdep->num_xmm_regs + 1; - for (; i < num_regs; i++) - valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i, - tdep->register_names[i]); + if (feature_sse) + { + /* Need to include %mxcsr, so add one. */ + num_regs += tdep->num_xmm_regs + 1; + for (; i < num_regs; i++) + valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i, + tdep->register_names[i]); + } return valid_p; } @@ -6734,15 +6746,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) and the SSE registers. This can be overridden for a specific ABI by adjusting the members `st0_regnum', `mm0_regnum' and `num_xmm_regs' of `struct gdbarch_tdep', otherwise the registers - will show up in the output of "info all-registers". Ideally we - should try to autodetect whether they are available, such that we - can prevent "info all-registers" from displaying registers that - aren't available. - - NOTE: kevinb/2003-07-13: ... if it's a choice between printing - [the SSE registers] always (even when they don't exist) or never - showing them to the user (even when they do exist), I prefer the - former over the latter. */ + will show up in the output of "info all-registers". */ tdep->st0_regnum = I386_ST0_REGNUM; @@ -7041,6 +7045,7 @@ is \"default\"."), /* Initialize the standard target descriptions. */ initialize_tdesc_i386 (); + initialize_tdesc_i386_mmx (); initialize_tdesc_i386_avx (); /* Tell remote stub that we support XML target description. */ diff --git a/gdb/regformats/i386/i386-mmx-linux.dat b/gdb/regformats/i386/i386-mmx-linux.dat new file mode 100644 index 0000000..9dcf223 --- /dev/null +++ b/gdb/regformats/i386/i386-mmx-linux.dat @@ -0,0 +1,46 @@ +# DO NOT EDIT: generated from i386/i386-mmx-linux.xml +name:i386_mmx_linux +xmltarget:i386-mmx-linux.xml +expedite:ebp,esp,eip +32:eax +32:ecx +32:edx +32:ebx +32:esp +32:ebp +32:esi +32:edi +32:eip +32:eflags +32:cs +32:ss +32:ds +32:es +32:fs +32:gs +80:st0 +80:st1 +80:st2 +80:st3 +80:st4 +80:st5 +80:st6 +80:st7 +32:fctrl +32:fstat +32:ftag +32:fiseg +32:fioff +32:foseg +32:fooff +32:fop +0: +0: +0: +0: +0: +0: +0: +0: +0: +32:orig_eax diff --git a/gdb/regformats/i386/i386-mmx.dat b/gdb/regformats/i386/i386-mmx.dat new file mode 100644 index 0000000..38a95d4 --- /dev/null +++ b/gdb/regformats/i386/i386-mmx.dat @@ -0,0 +1,36 @@ +# DO NOT EDIT: generated from i386/i386-mmx.xml +name:i386_mmx +xmltarget:i386-mmx.xml +expedite:ebp,esp,eip +32:eax +32:ecx +32:edx +32:ebx +32:esp +32:ebp +32:esi +32:edi +32:eip +32:eflags +32:cs +32:ss +32:ds +32:es +32:fs +32:gs +80:st0 +80:st1 +80:st2 +80:st3 +80:st4 +80:st5 +80:st6 +80:st7 +32:fctrl +32:fstat +32:ftag +32:fiseg +32:fioff +32:foseg +32:fooff +32:fop ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: PATCH: Support i386 without SSE 2010-04-07 20:05 PATCH: Support i386 without SSE H.J. Lu @ 2010-04-07 20:12 ` H.J. Lu 2010-04-07 20:31 ` Eli Zaretskii 2010-04-08 19:08 ` Mark Kettenis 1 sibling, 1 reply; 10+ messages in thread From: H.J. Lu @ 2010-04-07 20:12 UTC (permalink / raw) To: GDB On Wed, Apr 07, 2010 at 01:05:47PM -0700, H.J. Lu wrote: > Hi, > > This patch supports i386 without SSE. Any comments/suggestions? > > Thanks. > > This patch updates config/djgpp/fnchange.lst to support i386 MMX XML files. H.J. --- gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * 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-07 H.J. Lu <hongjiu.lu@intel.com> * 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-07 H.J. Lu <hongjiu.lu@intel.com> * 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. diff --git a/gdb/common/i386-xstate.h b/gdb/common/i386-xstate.h index 5e16015..ec40a0d 100644 --- a/gdb/common/i386-xstate.h +++ b/gdb/common/i386-xstate.h @@ -26,6 +26,7 @@ #define I386_XSTATE_AVX (1ULL << 2) /* Supported mask and size of the extended state. */ +#define I386_XSTATE_X87_MASK I386_XSTATE_X87 #define I386_XSTATE_SSE_MASK (I386_XSTATE_X87 | I386_XSTATE_SSE) #define I386_XSTATE_AVX_MASK (I386_XSTATE_SSE_MASK | I386_XSTATE_AVX) diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 251ae2f..5e34bae 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -236,6 +236,10 @@ @V@/gdb/features/i386/i386-avx.c @V@/gdb/features/i386/i32-a.c @V@/gdb/features/i386/i386-avx-linux.xml @V@/gdb/features/i386/i32-al.xml @V@/gdb/features/i386/i386-avx.xml @V@/gdb/features/i386/i32-a.xml +@V@/gdb/features/i386/i386-mmx-linux.c @V@/features/i386/i32-ml.c +@V@/gdb/features/i386/i386-mmx.c @V@/gdb/features/i386/i32-m.c +@V@/gdb/features/i386/i386-mmx-linux.xml @V@/gdb/features/i386/i32-ml.xml +@V@/gdb/features/i386/i386-mmx.xml @V@/gdb/features/i386/i32-m.xml @V@/gdb/f-exp.tab.c @V@/gdb/f-exp_tab.c @V@/gdb/gdbserver/linux-cris-low.c @V@/gdb/gdbserver/lx-cris.c @V@/gdb/gdbserver/linux-crisv32-low.c @V@/gdb/gdbserver/lx-cris32.c diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index fd8b0bc..a818ece 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -33846,7 +33846,7 @@ targets. It should describe the following registers: The register sets may be different, depending on the target. -The @samp{org.gnu.gdb.i386.sse} feature is required. It should +The @samp{org.gnu.gdb.i386.sse} feature is optional. It should describe registers: @itemize @minus @@ -33858,7 +33858,8 @@ describe registers: @samp{mxcsr} @end itemize -The @samp{org.gnu.gdb.i386.avx} feature is optional. It should +The @samp{org.gnu.gdb.i386.avx} feature is optional and requires the +@samp{org.gnu.gdb.i386.sse} feature. It should describe the upper 128 bits of @sc{ymm} registers: @itemize @minus diff --git a/gdb/features/Makefile b/gdb/features/Makefile index 1166582..987854b 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -32,6 +32,7 @@ WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \ i386/i386 i386/i386-linux \ + i386/i386-mmx i386/i386-mmx-linux \ i386/amd64 i386/amd64-linux \ i386/i386-avx i386/i386-avx-linux \ i386/amd64-avx i386/amd64-avx-linux \ @@ -49,6 +50,8 @@ i386/amd64-expedite = rbp,rsp,rip i386/amd64-linux-expedite = rbp,rsp,rip i386/i386-avx-expedite = ebp,esp,eip i386/i386-avx-linux-expedite = ebp,esp,eip +i386/i386-mmx-expedite = ebp,esp,eip +i386/i386-mmx-linux-expedite = ebp,esp,eip i386/amd64-avx-expedite = rbp,rsp,rip i386/amd64-avx-linux-expedite = rbp,rsp,rip mips-expedite = r29,pc @@ -99,6 +102,8 @@ $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \ $(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml $(outdir)/i386/i386-avx-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \ i386/32bit-linux.xml +$(outdir)/i386/i386-mmx.dat: i386/32bit-core.xml +$(outdir)/i386/i386-mmx-linux.dat: i386/32bit-core.xml i386/32bit-linux.xml $(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml $(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ i386/64bit-linux.xml diff --git a/gdb/features/i386/i386-mmx-linux.c b/gdb/features/i386/i386-mmx-linux.c new file mode 100644 index 0000000..364ade4 --- /dev/null +++ b/gdb/features/i386/i386-mmx-linux.c @@ -0,0 +1,76 @@ +/* THIS FILE IS GENERATED. Original: i386-mmx-linux.xml */ + +#include "defs.h" +#include "osabi.h" +#include "target-descriptions.h" + +struct target_desc *tdesc_i386_mmx_linux; +static void +initialize_tdesc_i386_mmx_linux (void) +{ + struct target_desc *result = allocate_target_description (); + struct tdesc_feature *feature; + struct tdesc_type *field_type, *type; + + set_tdesc_architecture (result, bfd_scan_arch ("i386")); + + set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux")); + + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core"); + field_type = tdesc_create_flags (feature, "i386_eflags", 4); + tdesc_add_flag (field_type, 0, "CF"); + tdesc_add_flag (field_type, 1, ""); + tdesc_add_flag (field_type, 2, "PF"); + tdesc_add_flag (field_type, 4, "AF"); + tdesc_add_flag (field_type, 6, "ZF"); + tdesc_add_flag (field_type, 7, "SF"); + tdesc_add_flag (field_type, 8, "TF"); + tdesc_add_flag (field_type, 9, "IF"); + tdesc_add_flag (field_type, 10, "DF"); + tdesc_add_flag (field_type, 11, "OF"); + tdesc_add_flag (field_type, 14, "NT"); + tdesc_add_flag (field_type, 16, "RF"); + tdesc_add_flag (field_type, 17, "VM"); + tdesc_add_flag (field_type, 18, "AC"); + tdesc_add_flag (field_type, 19, "VIF"); + tdesc_add_flag (field_type, 20, "VIP"); + tdesc_add_flag (field_type, 21, "ID"); + + tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags"); + tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int"); + tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int"); + tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int"); + + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); + tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int"); + + tdesc_i386_mmx_linux = result; +} diff --git a/gdb/features/i386/i386-mmx-linux.xml b/gdb/features/i386/i386-mmx-linux.xml new file mode 100644 index 0000000..19d4f3f --- /dev/null +++ b/gdb/features/i386/i386-mmx-linux.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 2010 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!-- I386 with MMX - Includes Linux-only special "register". --> + +<!DOCTYPE target SYSTEM "gdb-target.dtd"> +<target> + <architecture>i386</architecture> + <osabi>GNU/Linux</osabi> + <xi:include href="32bit-core.xml"/> + <xi:include href="32bit-linux.xml"/> +</target> diff --git a/gdb/features/i386/i386-mmx.c b/gdb/features/i386/i386-mmx.c new file mode 100644 index 0000000..f43df65 --- /dev/null +++ b/gdb/features/i386/i386-mmx.c @@ -0,0 +1,71 @@ +/* THIS FILE IS GENERATED. Original: i386-mmx.xml */ + +#include "defs.h" +#include "osabi.h" +#include "target-descriptions.h" + +struct target_desc *tdesc_i386_mmx; +static void +initialize_tdesc_i386_mmx (void) +{ + struct target_desc *result = allocate_target_description (); + struct tdesc_feature *feature; + struct tdesc_type *field_type, *type; + + set_tdesc_architecture (result, bfd_scan_arch ("i386")); + + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core"); + field_type = tdesc_create_flags (feature, "i386_eflags", 4); + tdesc_add_flag (field_type, 0, "CF"); + tdesc_add_flag (field_type, 1, ""); + tdesc_add_flag (field_type, 2, "PF"); + tdesc_add_flag (field_type, 4, "AF"); + tdesc_add_flag (field_type, 6, "ZF"); + tdesc_add_flag (field_type, 7, "SF"); + tdesc_add_flag (field_type, 8, "TF"); + tdesc_add_flag (field_type, 9, "IF"); + tdesc_add_flag (field_type, 10, "DF"); + tdesc_add_flag (field_type, 11, "OF"); + tdesc_add_flag (field_type, 14, "NT"); + tdesc_add_flag (field_type, 16, "RF"); + tdesc_add_flag (field_type, 17, "VM"); + tdesc_add_flag (field_type, 18, "AC"); + tdesc_add_flag (field_type, 19, "VIF"); + tdesc_add_flag (field_type, 20, "VIP"); + tdesc_add_flag (field_type, 21, "ID"); + + tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags"); + tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32"); + tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext"); + tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int"); + tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int"); + tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int"); + tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int"); + + tdesc_i386_mmx = result; +} diff --git a/gdb/features/i386/i386-mmx.xml b/gdb/features/i386/i386-mmx.xml new file mode 100644 index 0000000..7bb9e7a --- /dev/null +++ b/gdb/features/i386/i386-mmx.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 2010 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!-- I386 with MMX --> + +<!DOCTYPE target SYSTEM "gdb-target.dtd"> +<target> + <architecture>i386</architecture> + <xi:include href="32bit-core.xml"/> +</target> 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); diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index a251907..d559811 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -150,7 +150,7 @@ int have_ptrace_getregs = for this to be a simple variable. */ int have_ptrace_getfpxregs = #ifdef HAVE_PTRACE_GETFPXREGS - 1 + -1 #else 0 #endif @@ -946,19 +946,33 @@ i386_linux_child_post_startup_inferior (ptid_t ptid) static const struct target_desc * i386_linux_read_description (struct target_ops *ops) { + int tid; static uint64_t xcr0; + /* GNU/Linux LWP ID's are process ID's. */ + tid = TIDGET (inferior_ptid); + if (tid == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ + +#ifdef HAVE_PTRACE_GETFPXREGS + if (have_ptrace_getfpxregs == -1) + { + elf_fpxregset_t fpxregs; + + if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0) + { + have_ptrace_getfpxregs = 0; + have_ptrace_getregset = 0; + return tdesc_i386_mmx_linux; + } + } +#endif + if (have_ptrace_getregset == -1) { - int tid; uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))]; struct iovec iov; - /* GNU/Linux LWP ID's are process ID's. */ - tid = TIDGET (inferior_ptid); - if (tid == 0) - tid = PIDGET (inferior_ptid); /* Not a threaded program. */ - iov.iov_base = xstateregs; iov.iov_len = sizeof (xstateregs); diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 34a1924..72aced5 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -50,6 +50,7 @@ #include <stdint.h> #include "features/i386/i386-linux.c" +#include "features/i386/i386-mmx-linux.c" #include "features/i386/i386-avx-linux.c" /* Supported register note sections. */ @@ -616,6 +617,10 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, if (section == NULL) return NULL; + section = bfd_get_section_by_name (abfd, ".reg-xfp"); + if (section == NULL) + return tdesc_i386_mmx_linux; + /* Linux/i386. */ xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) @@ -890,5 +895,6 @@ _initialize_i386_linux_tdep (void) /* Initialize the Linux target description */ initialize_tdesc_i386_linux (); + initialize_tdesc_i386_mmx_linux (); initialize_tdesc_i386_avx_linux (); } diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index eaeb63c..1228681 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -41,6 +41,7 @@ extern uint64_t i386_linux_core_read_xcr0 /* Linux target description. */ extern struct target_desc *tdesc_i386_linux; +extern struct target_desc *tdesc_i386_mmx_linux; extern struct target_desc *tdesc_i386_avx_linux; /* Format of XSAVE extended state is: diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index ce658cd..95a3c95 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -58,6 +58,7 @@ #include "features/i386/i386.c" #include "features/i386/i386-avx.c" +#include "features/i386/i386-mmx.c" /* Register names. */ @@ -2937,8 +2938,8 @@ i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->jb_pc_offset = 36; /* DJGPP does not support the SSE registers. */ - tdep->num_xmm_regs = 0; - set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I387_NUM_REGS); + if (! tdesc_has_registers (info.target_desc)) + tdep->tdesc = tdesc_i386_mmx; /* Native compiler is GCC, which uses the SVR4 register numbering even in COFF and STABS. See the comment in i386_gdbarch_init, @@ -6651,13 +6652,12 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, /* Get core registers. */ feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core"); + if (feature_core == NULL) + return 0; /* Get SSE registers. */ feature_sse = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"); - if (feature_core == NULL || feature_sse == NULL) - return 0; - /* Try AVX registers. */ feature_avx = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"); @@ -6666,6 +6666,10 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, /* The XCR0 bits. */ if (feature_avx) { + /* AVX register description requires SSE register description. */ + if (!feature_sse) + return 0; + tdep->xcr0 = I386_XSTATE_AVX_MASK; /* It may have been set by OSABI initialization function. */ @@ -6681,19 +6685,27 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, tdep->ymm0h_regnum + i, tdep->ymmh_register_names[i]); } - else + else if (feature_sse) tdep->xcr0 = I386_XSTATE_SSE_MASK; + else + { + tdep->xcr0 = I386_XSTATE_X87_MASK; + tdep->num_xmm_regs = 0; + } num_regs = tdep->num_core_regs; for (i = 0; i < num_regs; i++) valid_p &= tdesc_numbered_register (feature_core, tdesc_data, i, tdep->register_names[i]); - /* Need to include %mxcsr, so add one. */ - num_regs += tdep->num_xmm_regs + 1; - for (; i < num_regs; i++) - valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i, - tdep->register_names[i]); + if (feature_sse) + { + /* Need to include %mxcsr, so add one. */ + num_regs += tdep->num_xmm_regs + 1; + for (; i < num_regs; i++) + valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i, + tdep->register_names[i]); + } return valid_p; } @@ -6734,15 +6746,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) and the SSE registers. This can be overridden for a specific ABI by adjusting the members `st0_regnum', `mm0_regnum' and `num_xmm_regs' of `struct gdbarch_tdep', otherwise the registers - will show up in the output of "info all-registers". Ideally we - should try to autodetect whether they are available, such that we - can prevent "info all-registers" from displaying registers that - aren't available. - - NOTE: kevinb/2003-07-13: ... if it's a choice between printing - [the SSE registers] always (even when they don't exist) or never - showing them to the user (even when they do exist), I prefer the - former over the latter. */ + will show up in the output of "info all-registers". */ tdep->st0_regnum = I386_ST0_REGNUM; @@ -7041,6 +7045,7 @@ is \"default\"."), /* Initialize the standard target descriptions. */ initialize_tdesc_i386 (); + initialize_tdesc_i386_mmx (); initialize_tdesc_i386_avx (); /* Tell remote stub that we support XML target description. */ diff --git a/gdb/regformats/i386/i386-mmx-linux.dat b/gdb/regformats/i386/i386-mmx-linux.dat new file mode 100644 index 0000000..9dcf223 --- /dev/null +++ b/gdb/regformats/i386/i386-mmx-linux.dat @@ -0,0 +1,46 @@ +# DO NOT EDIT: generated from i386/i386-mmx-linux.xml +name:i386_mmx_linux +xmltarget:i386-mmx-linux.xml +expedite:ebp,esp,eip +32:eax +32:ecx +32:edx +32:ebx +32:esp +32:ebp +32:esi +32:edi +32:eip +32:eflags +32:cs +32:ss +32:ds +32:es +32:fs +32:gs +80:st0 +80:st1 +80:st2 +80:st3 +80:st4 +80:st5 +80:st6 +80:st7 +32:fctrl +32:fstat +32:ftag +32:fiseg +32:fioff +32:foseg +32:fooff +32:fop +0: +0: +0: +0: +0: +0: +0: +0: +0: +32:orig_eax diff --git a/gdb/regformats/i386/i386-mmx.dat b/gdb/regformats/i386/i386-mmx.dat new file mode 100644 index 0000000..38a95d4 --- /dev/null +++ b/gdb/regformats/i386/i386-mmx.dat @@ -0,0 +1,36 @@ +# DO NOT EDIT: generated from i386/i386-mmx.xml +name:i386_mmx +xmltarget:i386-mmx.xml +expedite:ebp,esp,eip +32:eax +32:ecx +32:edx +32:ebx +32:esp +32:ebp +32:esi +32:edi +32:eip +32:eflags +32:cs +32:ss +32:ds +32:es +32:fs +32:gs +80:st0 +80:st1 +80:st2 +80:st3 +80:st4 +80:st5 +80:st6 +80:st7 +32:fctrl +32:fstat +32:ftag +32:fiseg +32:fioff +32:foseg +32:fooff +32:fop ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: PATCH: Support i386 without SSE 2010-04-07 20:12 ` H.J. Lu @ 2010-04-07 20:31 ` Eli Zaretskii 0 siblings, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2010-04-07 20:31 UTC (permalink / raw) To: H.J. Lu; +Cc: gdb-patches > Date: Wed, 7 Apr 2010 13:12:36 -0700 > From: "H.J. Lu" <hongjiu.lu@intel.com> > > On Wed, Apr 07, 2010 at 01:05:47PM -0700, H.J. Lu wrote: > > Hi, > > > > This patch supports i386 without SSE. Any comments/suggestions? > > > > Thanks. > > > > > > This patch updates config/djgpp/fnchange.lst to support i386 MMX XML > files. Thanks. > * config/djgpp/fnchange.lst: Add i386 MMX XML files. This part is OK. > 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> > > * gdb.texinfo (i386 Features): Make org.gnu.gdb.i386.avx > optional. Make org.gnu.gdb.i386.avx requires > org.gnu.gdb.i386.avx. This part also. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: PATCH: Support i386 without SSE 2010-04-07 20:05 PATCH: Support i386 without SSE H.J. Lu 2010-04-07 20:12 ` H.J. Lu @ 2010-04-08 19:08 ` Mark Kettenis 2010-04-08 20:33 ` Pierre Muller [not found] ` <000c01cad75a$b751a490$25f4edb0$%muller@ics-cnrs.unistra.fr> 1 sibling, 2 replies; 10+ messages in thread From: Mark Kettenis @ 2010-04-08 19:08 UTC (permalink / raw) To: hjl.tools; +Cc: gdb-patches > Date: Wed, 7 Apr 2010 13:05:47 -0700 > From: "H.J. Lu" <hongjiu.lu@intel.com> > > Hi, > > This patch supports i386 without SSE. Any comments/suggestions? Eli, Pierre, can you test wether this fixes the issues on Go32? If so, I'm ok with this going in. > 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> > > * 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. > > * 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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: PATCH: Support i386 without SSE 2010-04-08 19:08 ` Mark Kettenis @ 2010-04-08 20:33 ` Pierre Muller [not found] ` <000c01cad75a$b751a490$25f4edb0$%muller@ics-cnrs.unistra.fr> 1 sibling, 0 replies; 10+ messages in thread From: Pierre Muller @ 2010-04-08 20:33 UTC (permalink / raw) To: 'Mark Kettenis', hjl.tools; +Cc: gdb-patches > -----Message d'origine----- > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Mark Kettenis > Envoyé : Thursday, April 08, 2010 9:08 PM > À : hjl.tools@gmail.com > Cc : gdb-patches@sourceware.org > Objet : Re: PATCH: Support i386 without SSE > > > Date: Wed, 7 Apr 2010 13:05:47 -0700 > > From: "H.J. Lu" <hongjiu.lu@intel.com> > > > > Hi, > > > > This patch supports i386 without SSE. Any comments/suggestions? > > Eli, Pierre, can you test wether this fixes the issues on Go32? I tested the patch and it does indeed fix the two problems that I reported. Nevertheless, there are still strange things: if you use 'maint print register-groups' you will find out that the SSE xmmX registers are still present as registers 32 to 40 and the ymmX as 41 to 48, but with empty names and a strange int0_t type. (see below). As this is not user visible, I think that the patch is OK for me... Pierre (top-gdb) maint print register-groups Name Nr Rel Offset Size Type Groups eax 0 0 0 4 int32_t general,all,save,restore ecx 1 1 4 4 int32_t general,all,save,restore edx 2 2 8 4 int32_t general,all,save,restore ebx 3 3 12 4 int32_t general,all,save,restore esp 4 4 16 4 *1 general,all,save,restore ebp 5 5 20 4 *1 general,all,save,restore esi 6 6 24 4 int32_t general,all,save,restore edi 7 7 28 4 int32_t general,all,save,restore eip 8 8 32 4 *1 general,all,save,restore eflags 9 9 36 4 i386_eflags general,all,save,restore cs 10 10 40 4 int32_t general,all,save,restore ss 11 11 44 4 int32_t general,all,save,restore ds 12 12 48 4 int32_t general,all,save,restore es 13 13 52 4 int32_t general,all,save,restore fs 14 14 56 4 int32_t general,all,save,restore gs 15 15 60 4 int32_t general,all,save,restore st0 16 16 64 10 _i387_ext float,all,save,restore st1 17 17 74 10 _i387_ext float,all,save,restore st2 18 18 84 10 _i387_ext float,all,save,restore st3 19 19 94 10 _i387_ext float,all,save,restore st4 20 20 104 10 _i387_ext float,all,save,restore st5 21 21 114 10 _i387_ext float,all,save,restore st6 22 22 124 10 _i387_ext float,all,save,restore st7 23 23 134 10 _i387_ext float,all,save,restore fctrl 24 24 144 4 long float,all,save,restore fstat 25 25 148 4 long float,all,save,restore ftag 26 26 152 4 long float,all,save,restore fiseg 27 27 156 4 long float,all,save,restore fioff 28 28 160 4 long float,all,save,restore foseg 29 29 164 4 long float,all,save,restore fooff 30 30 168 4 long float,all,save,restore fop 31 31 172 4 long float,all,save,restore '' 32 32 176 0 int0_t general '' 33 33 176 0 int0_t general '' 34 34 176 0 int0_t general '' 35 35 176 0 int0_t general '' 36 36 176 0 int0_t general '' 37 37 176 0 int0_t general '' 38 38 176 0 int0_t general '' 39 39 176 0 int0_t general '' 40 40 176 0 int0_t general '' 41 41 176 0 int0_t general '' 42 42 176 0 int0_t general '' 43 43 176 0 int0_t general '' 44 44 176 0 int0_t general '' 45 45 176 0 int0_t general '' 46 46 176 0 int0_t general '' 47 47 176 0 int0_t general '' 48 48 176 0 int0_t general al 49 0 176 1 int8_t cl 50 1 177 1 int8_t dl 51 2 178 1 int8_t bl 52 3 179 1 int8_t ah 53 4 180 1 int8_t ch 54 5 181 1 int8_t dh 55 6 182 1 int8_t bh 56 7 183 1 int8_t ax 57 8 184 2 int16_t cx 58 9 186 2 int16_t dx 59 10 188 2 int16_t bx 60 11 190 2 int16_t '' 61 12 192 2 int16_t bp 62 13 194 2 int16_t si 63 14 196 2 int16_t di 64 15 198 2 int16_t mm0 65 16 200 8 _vec64i mmx,all,vector mm1 66 17 208 8 _vec64i mmx,all,vector mm2 67 18 216 8 _vec64i mmx,all,vector mm3 68 19 224 8 _vec64i mmx,all,vector mm4 69 20 232 8 _vec64i mmx,all,vector mm5 70 21 240 8 _vec64i mmx,all,vector mm6 71 22 248 8 _vec64i mmx,all,vector mm7 72 23 256 8 _vec64i mmx,all,vector *1: Register type's name NULL. There are two oddities here: the void * type are not nicely reported, and the missing registers are in the general group. ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <000c01cad75a$b751a490$25f4edb0$%muller@ics-cnrs.unistra.fr>]
* Re: PATCH: Support i386 without SSE [not found] ` <000c01cad75a$b751a490$25f4edb0$%muller@ics-cnrs.unistra.fr> @ 2010-04-08 21:37 ` Eli Zaretskii 2010-04-08 22:29 ` H.J. Lu 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2010-04-08 21:37 UTC (permalink / raw) To: Pierre Muller; +Cc: mark.kettenis, hjl.tools, gdb-patches > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr> > Cc: <gdb-patches@sourceware.org> > Date: Thu, 8 Apr 2010 22:33:12 +0200 > > > > This patch supports i386 without SSE. Any comments/suggestions? > > > > Eli, Pierre, can you test wether this fixes the issues on Go32? > > I tested the patch and it does > indeed fix the two problems that I > reported. Thanks for testing. > Nevertheless, there are still strange things: > if you use 'maint print register-groups' > you will find out that > the SSE xmmX registers are still present as registers 32 to 40 > and the ymmX as 41 to 48, but with empty names and a strange int0_t type. H.J., could this be fixed? (I assume it's also part of one of your latest patches; apologies if that's not true.) Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: PATCH: Support i386 without SSE 2010-04-08 21:37 ` Eli Zaretskii @ 2010-04-08 22:29 ` H.J. Lu 2010-04-09 7:41 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: H.J. Lu @ 2010-04-08 22:29 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Pierre Muller, mark.kettenis, gdb-patches On Thu, Apr 8, 2010 at 2:36 PM, Eli Zaretskii <eliz@gnu.org> wrote: >> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr> >> Cc: <gdb-patches@sourceware.org> >> Date: Thu, 8 Apr 2010 22:33:12 +0200 >> >> > > This patch supports i386 without SSE. Any comments/suggestions? >> > >> > Eli, Pierre, can you test wether this fixes the issues on Go32? >> >> I tested the patch and it does >> indeed fix the two problems that I >> reported. > > Thanks for testing. I will check in my patch. >> Nevertheless, there are still strange things: >> if you use 'maint print register-groups' >> you will find out that >> the SSE xmmX registers are still present as registers 32 to 40 >> and the ymmX as 41 to 48, but with empty names and a strange int0_t type. I think those are expected as they are reserved internally and not visible to user. > H.J., could this be fixed? (I assume it's also part of one of your > latest patches; apologies if that's not true.) > I will post a patch to remove "general" from missing registers. As for void * registers, we always print (top-gdb) maint print register-groups Name Nr Rel Offset Size Type Groups eax 0 0 0 4 int general,all,save,restore ecx 1 1 4 4 int general,all,save,restore edx 2 2 8 4 int general,all,save,restore ebx 3 3 12 4 int general,all,save,restore esp 4 4 16 4 *1 general,all,save,restore ebp 5 5 20 4 *1 general,all,save,restore esi 6 6 24 4 int general,all,save,restore edi 7 7 28 4 int general,all,save,restore eip 8 8 32 4 *1 general,all,save,restore -- H.J. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: PATCH: Support i386 without SSE 2010-04-08 22:29 ` H.J. Lu @ 2010-04-09 7:41 ` Eli Zaretskii 2010-04-09 13:16 ` H.J. Lu 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2010-04-09 7:41 UTC (permalink / raw) To: H.J. Lu; +Cc: pierre.muller, mark.kettenis, gdb-patches > Date: Thu, 8 Apr 2010 15:28:56 -0700 > From: "H.J. Lu" <hjl.tools@gmail.com> > Cc: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>, mark.kettenis@xs4all.nl, > gdb-patches@sourceware.org > > >> > Eli, Pierre, can you test wether this fixes the issues on Go32? > >> > >> Â I tested the patch and it does > >> indeed fix the two problems that I > >> reported. > > > > Thanks for testing. > > I will check in my patch. Thanks. > >> Â Nevertheless, there are still strange things: > >> Â if you use 'maint print register-groups' > >> you will find out that > >> the SSE xmmX registers are still present as registers 32 to 40 > >> and the ymmX as 41 to 48, but with empty names and a strange int0_t type. > > I think those are expected as they are reserved internally > and not visible to user. If this is a general feature, it's fine with me, but perhaps we should add a note about that to where 'maint print register-groups' is described in the manual, saying that it could also show registers which are not really supported by the target. Just so that it doesn't cause confusion. Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: PATCH: Support i386 without SSE 2010-04-09 7:41 ` Eli Zaretskii @ 2010-04-09 13:16 ` H.J. Lu 2010-04-09 15:08 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: H.J. Lu @ 2010-04-09 13:16 UTC (permalink / raw) To: Eli Zaretskii; +Cc: pierre.muller, mark.kettenis, gdb-patches On Fri, Apr 9, 2010 at 12:39 AM, Eli Zaretskii <eliz@gnu.org> wrote: >> Date: Thu, 8 Apr 2010 15:28:56 -0700 >> From: "H.J. Lu" <hjl.tools@gmail.com> >> Cc: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>, mark.kettenis@xs4all.nl, >> gdb-patches@sourceware.org >> >> >> > Eli, Pierre, can you test wether this fixes the issues on Go32? >> >> >> >> I tested the patch and it does >> >> indeed fix the two problems that I >> >> reported. >> > >> > Thanks for testing. >> >> I will check in my patch. > > Thanks. > >> >> Nevertheless, there are still strange things: >> >> if you use 'maint print register-groups' >> >> you will find out that >> >> the SSE xmmX registers are still present as registers 32 to 40 >> >> and the ymmX as 41 to 48, but with empty names and a strange int0_t type. >> >> I think those are expected as they are reserved internally >> and not visible to user. > > If this is a general feature, it's fine with me, but perhaps we should > add a note about that to where 'maint print register-groups' is > described in the manual, saying that it could also show registers > which are not really supported by the target. Just so that it doesn't > cause confusion. > > Thanks. > How about this patch? -- H.J. -- 2010-04-09 H.J. Lu <hongjiu.lu@intel.com> * gdb.texinfo (maint print registers): Mention unavailable and invisible registers. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index bd2b441..6629526 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -29082,8 +29082,9 @@ Print @value{GDBN}'s internal register data structures. The command @code{maint print raw-registers} includes the contents of the raw register cache; the command @code{maint print cooked-registers} -includes the (cooked) value of all registers; and the command -@code{maint print register-groups} includes the groups that each +includes the (cooked) value of all registers, including registers which +aren't available on the target nor visible to user; and the +command @code{maint print register-groups} includes the groups that each register is a member of. @xref{Registers,, Registers, gdbint, @value{GDBN} Internals}. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: PATCH: Support i386 without SSE 2010-04-09 13:16 ` H.J. Lu @ 2010-04-09 15:08 ` Eli Zaretskii 0 siblings, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2010-04-09 15:08 UTC (permalink / raw) To: H.J. Lu; +Cc: pierre.muller, mark.kettenis, gdb-patches > Date: Fri, 9 Apr 2010 06:15:58 -0700 > From: "H.J. Lu" <hjl.tools@gmail.com> > Cc: pierre.muller@ics-cnrs.unistra.fr, mark.kettenis@xs4all.nl, > gdb-patches@sourceware.org > > >> I think those are expected as they are reserved internally > >> and not visible to user. > > > > If this is a general feature, it's fine with me, but perhaps we should > > add a note about that to where 'maint print register-groups' is > > described in the manual, saying that it could also show registers > > which are not really supported by the target. Â Just so that it doesn't > > cause confusion. > > > > Thanks. > > > > How about this patch? It's fine; thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-04-09 15:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-07 20:05 PATCH: Support i386 without SSE H.J. Lu
2010-04-07 20:12 ` H.J. Lu
2010-04-07 20:31 ` Eli Zaretskii
2010-04-08 19:08 ` Mark Kettenis
2010-04-08 20:33 ` Pierre Muller
[not found] ` <000c01cad75a$b751a490$25f4edb0$%muller@ics-cnrs.unistra.fr>
2010-04-08 21:37 ` Eli Zaretskii
2010-04-08 22:29 ` H.J. Lu
2010-04-09 7:41 ` Eli Zaretskii
2010-04-09 13:16 ` H.J. Lu
2010-04-09 15:08 ` Eli Zaretskii
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox