#include "dis-asm.h"
#include "disasm.h"
#include "remote.h"
-#include "exceptions.h"
-#include "gdb_assert.h"
-#include <string.h>
-
#include "i386-tdep.h"
#include "i387-tdep.h"
-#include "i386-xstate.h"
+#include "x86-xstate.h"
#include "record.h"
#include "record-full.h"
i387_collect_fsave (regcache, regnum, fpregs);
}
-/* Similar to i386_supply_fpregset, but use XSAVE extended state. */
-
-static void
-i386_supply_xstateregset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *xstateregs, size_t len)
-{
- i387_supply_xsave (regcache, regnum, xstateregs);
-}
-
-/* Similar to i386_collect_fpregset , but use XSAVE extended state. */
-
-static void
-i386_collect_xstateregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *xstateregs, size_t len)
-{
- i387_collect_xsave (regcache, regnum, xstateregs, 1);
-}
-
/* Register set definitions. */
const struct regset i386_gregset =
NULL, i386_supply_gregset, i386_collect_gregset
};
-static const struct regset i386_fpregset =
+const struct regset i386_fpregset =
{
NULL, i386_supply_fpregset, i386_collect_fpregset
};
-static const struct regset i386_xstateregset =
- {
- NULL, i386_supply_xstateregset, i386_collect_xstateregset
- };
+/* Default iterator over core file register note sections. */
-/* Return the appropriate register set for the core section identified
- by SECT_NAME and SECT_SIZE. */
-
-const struct regset *
-i386_regset_from_core_section (struct gdbarch *gdbarch,
- const char *sect_name, size_t sect_size)
+void
+i386_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
- return &i386_gregset;
-
- if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
- || (strcmp (sect_name, ".reg-xfp") == 0
- && sect_size == I387_SIZEOF_FXSAVE))
- return &i386_fpregset;
-
- if (strcmp (sect_name, ".reg-xstate") == 0)
- return &i386_xstateregset;
-
- return NULL;
+ cb (".reg", tdep->sizeof_gregset, &i386_gregset, NULL, cb_data);
+ if (tdep->sizeof_fpregset)
+ cb (".reg2", tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
}
\f
ymm_avx512_regnum_p = i386_ymm_avx512_regnum_p (gdbarch, regnum);
zmm_regnum_p = i386_zmm_regnum_p (gdbarch, regnum);
- avx512_p = ((tdep->xcr0 & I386_XSTATE_AVX512_MASK)
- == I386_XSTATE_AVX512_MASK);
- avx_p = ((tdep->xcr0 & I386_XSTATE_AVX512_MASK)
- == I386_XSTATE_AVX_MASK) && !avx512_p;
- sse_p = ((tdep->xcr0 & I386_XSTATE_AVX512_MASK)
- == I386_XSTATE_SSE_MASK) && !avx512_p && ! avx_p;
+ avx512_p = ((tdep->xcr0 & X86_XSTATE_AVX512_MASK)
+ == X86_XSTATE_AVX512_MASK);
+ avx_p = ((tdep->xcr0 & X86_XSTATE_AVX512_MASK)
+ == X86_XSTATE_AVX_MASK) && !avx512_p;
+ sse_p = ((tdep->xcr0 & X86_XSTATE_AVX512_MASK)
+ == X86_XSTATE_SSE_MASK) && !avx512_p && ! avx_p;
if (group == vector_reggroup)
return (mmx_regnum_p
bnd_regnum_p = i386_bnd_regnum_p (gdbarch, regnum);
if (group == all_reggroup
- && ((bnd_regnum_p && (tdep->xcr0 & I386_XSTATE_MPX_MASK))))
+ && ((bnd_regnum_p && (tdep->xcr0 & X86_XSTATE_MPX_MASK))))
return bnd_regnum_p;
bndr_regnum_p = i386_bndr_regnum_p (gdbarch, regnum);
if (group == all_reggroup
- && ((bndr_regnum_p && (tdep->xcr0 & I386_XSTATE_MPX_MASK))))
+ && ((bndr_regnum_p && (tdep->xcr0 & X86_XSTATE_MPX_MASK))))
return 0;
mpx_ctrl_regnum_p = i386_mpx_ctrl_regnum_p (gdbarch, regnum);
if (group == all_reggroup
- && ((mpx_ctrl_regnum_p && (tdep->xcr0 & I386_XSTATE_MPX_MASK))))
+ && ((mpx_ctrl_regnum_p && (tdep->xcr0 & X86_XSTATE_MPX_MASK))))
return mpx_ctrl_regnum_p;
if (group == general_reggroup)
if (!feature_avx)
return 0;
- tdep->xcr0 = I386_XSTATE_MPX_AVX512_MASK;
+ tdep->xcr0 = X86_XSTATE_MPX_AVX512_MASK;
/* It may have been set by OSABI initialization function. */
if (tdep->k0_regnum < 0)
return 0;
if (!feature_avx512)
- tdep->xcr0 = I386_XSTATE_AVX_MASK;
+ tdep->xcr0 = X86_XSTATE_AVX_MASK;
/* It may have been set by OSABI initialization function. */
if (tdep->num_ymm_regs == 0)
tdep->ymmh_register_names[i]);
}
else if (feature_sse)
- tdep->xcr0 = I386_XSTATE_SSE_MASK;
+ tdep->xcr0 = X86_XSTATE_SSE_MASK;
else
{
- tdep->xcr0 = I386_XSTATE_X87_MASK;
+ tdep->xcr0 = X86_XSTATE_X87_MASK;
tdep->num_xmm_regs = 0;
}
if (feature_mpx)
{
- tdep->xcr0 |= I386_XSTATE_MPX_MASK;
+ tdep->xcr0 |= X86_XSTATE_MPX_MASK;
if (tdep->bnd0r_regnum < 0)
{
/* Floating-point registers. */
tdep->sizeof_fpregset = I387_SIZEOF_FSAVE;
+ tdep->fpregset = &i386_fpregset;
/* The default settings include the FPU registers, the MMX registers
and the SSE registers. This can be overridden for a specific ABI
/* If we have a register mapping, enable the generic core file
support, unless it has already been enabled. */
if (tdep->gregset_reg_offset
- && !gdbarch_regset_from_core_section_p (gdbarch))
- set_gdbarch_regset_from_core_section (gdbarch,
- i386_regset_from_core_section);
+ && !gdbarch_iterate_over_regset_sections_p (gdbarch))
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, i386_iterate_over_regset_sections);
set_gdbarch_skip_permanent_breakpoint (gdbarch,
i386_skip_permanent_breakpoint);