aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-04-08 22:32:38 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-04-08 22:32:38 +0000
commit3a13a53b432d732be258d677b6afca969ce0d65f (patch)
treef2a54acc965c20fe324ffb9100e698313b474f46 /gdb/i386-tdep.c
parent080017175b5248f1e5b0d48a55a06634244db459 (diff)
downloadgdb-3a13a53b432d732be258d677b6afca969ce0d65f.zip
gdb-3a13a53b432d732be258d677b6afca969ce0d65f.tar.gz
gdb-3a13a53b432d732be258d677b6afca969ce0d65f.tar.bz2
Support i386 without SSE.
gdb/ 2010-04-08 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-08 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-08 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.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9e0f61f..22854bd 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,
@@ -6649,13 +6650,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");
@@ -6664,6 +6664,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. */
@@ -6679,19 +6683,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;
}
@@ -6732,15 +6744,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;
@@ -7039,6 +7043,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. */