Add MPX support to gdbserver.
2013-05-22 Walfred Tedeschi <walfred.tedeschi@intel.com> gdbserver/ * Makefile.in: Add i386-mpx.c, i386-mpx-linux.c, amd64-mpx.c, amd64-mpx-linux.c, x32-mpx.c and x32-mpx-linux.c generation. * configure.srv (srv_i386_regobj): Add i386-mpx.o. (srv_i386_linux_regobj): Add i386-mpx-linux.o. (srv_amd64_regobj): Add amd64-mpx.o. (srv_amd64_linux_regobj): Add amd64-mpx-linux.o. (srv_i386_32bit_xmlfiles): Add i386/32bit-mpx.xml. (srv_i386_64bit_xmlfiles): Add i386/64bit-mpx.xml. * i387-fp.c (num_pl_bnd_register) Added constant. (num_pl_bnd_cfg_registers) Added constant. (struct i387_xsave) Added reserved area and MPX fields. (i387_cache_to_xsave, i387_xsave_to_cache) Add MPX. * linux-x86-low.c (init_registers_i386_mpx_linux): Declare new function. (tdesc_i386_mpx_linux): Add MPX amd64 target. (init_registers_amd64_mpx_linux): Declare new function. (tdesc_amd64_mpx_linux): Add MPX amd64 target. (x86_64_regmap): Add MPX registers. (x86_linux_read_description): Add MPX case. (initialize_low_arch): Initialize MPX targets. Change-Id: I394d81afa76d11375ce792cefad0ceb9825fb379 Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
This commit is contained in:
parent
e43e105e0d
commit
a196ebeb91
5 changed files with 197 additions and 26 deletions
|
@ -43,6 +43,10 @@ extern const struct target_desc *tdesc_amd64_linux;
|
|||
void init_registers_amd64_avx_linux (void);
|
||||
extern const struct target_desc *tdesc_amd64_avx_linux;
|
||||
|
||||
/* Defined in auto-generated file amd64-mpx-linux.c. */
|
||||
void init_registers_amd64_mpx_linux (void);
|
||||
extern const struct target_desc *tdesc_amd64_mpx_linux;
|
||||
|
||||
/* Defined in auto-generated file x32-linux.c. */
|
||||
void init_registers_x32_linux (void);
|
||||
extern const struct target_desc *tdesc_x32_linux;
|
||||
|
@ -50,6 +54,7 @@ extern const struct target_desc *tdesc_x32_linux;
|
|||
/* Defined in auto-generated file x32-avx-linux.c. */
|
||||
void init_registers_x32_avx_linux (void);
|
||||
extern const struct target_desc *tdesc_x32_avx_linux;
|
||||
|
||||
#endif
|
||||
|
||||
/* Defined in auto-generated file i386-linux.c. */
|
||||
|
@ -64,6 +69,10 @@ extern const struct target_desc *tdesc_i386_mmx_linux;
|
|||
void init_registers_i386_avx_linux (void);
|
||||
extern const struct target_desc *tdesc_i386_avx_linux;
|
||||
|
||||
/* Defined in auto-generated file i386-mpx-linux.c. */
|
||||
void init_registers_i386_mpx_linux (void);
|
||||
extern const struct target_desc *tdesc_i386_mpx_linux;
|
||||
|
||||
#ifdef __x86_64__
|
||||
static struct target_desc *tdesc_amd64_linux_no_xml;
|
||||
#endif
|
||||
|
@ -163,8 +172,11 @@ static const int x86_64_regmap[] =
|
|||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
ORIG_RAX * 8
|
||||
-1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
ORIG_RAX * 8,
|
||||
-1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
|
||||
-1, -1 /* MPX registers BNDCFGU, BNDSTATUS. */
|
||||
};
|
||||
|
||||
#define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0]))
|
||||
|
@ -1233,7 +1245,7 @@ x86_linux_read_description (void)
|
|||
{
|
||||
unsigned int machine;
|
||||
int is_elf64;
|
||||
int avx;
|
||||
int xcr0_features;
|
||||
int tid;
|
||||
static uint64_t xcr0;
|
||||
struct regset_info *regset;
|
||||
|
@ -1312,36 +1324,69 @@ x86_linux_read_description (void)
|
|||
}
|
||||
|
||||
/* Check the native XCR0 only if PTRACE_GETREGSET is available. */
|
||||
avx = (have_ptrace_getregset
|
||||
&& (xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK);
|
||||
xcr0_features = (have_ptrace_getregset
|
||||
&& (xcr0 & I386_XSTATE_ALL_MASK));
|
||||
|
||||
/* AVX is the highest feature we support. */
|
||||
if (avx)
|
||||
if (xcr0_features)
|
||||
x86_xcr0 = xcr0;
|
||||
|
||||
if (machine == EM_X86_64)
|
||||
{
|
||||
#ifdef __x86_64__
|
||||
if (avx)
|
||||
if (is_elf64)
|
||||
{
|
||||
if (!is_elf64)
|
||||
return tdesc_x32_avx_linux;
|
||||
if (xcr0_features)
|
||||
{
|
||||
switch (xcr0 & I386_XSTATE_ALL_MASK)
|
||||
{
|
||||
case I386_XSTATE_MPX_MASK:
|
||||
return tdesc_amd64_mpx_linux;
|
||||
|
||||
case I386_XSTATE_AVX_MASK:
|
||||
return tdesc_amd64_avx_linux;
|
||||
|
||||
default:
|
||||
return tdesc_amd64_linux;
|
||||
}
|
||||
}
|
||||
else
|
||||
return tdesc_amd64_avx_linux;
|
||||
return tdesc_amd64_linux;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!is_elf64)
|
||||
return tdesc_x32_linux;
|
||||
if (xcr0_features)
|
||||
{
|
||||
switch (xcr0 & I386_XSTATE_ALL_MASK)
|
||||
{
|
||||
case I386_XSTATE_MPX_MASK: /* No MPX on x32. */
|
||||
case I386_XSTATE_AVX_MASK:
|
||||
return tdesc_x32_avx_linux;
|
||||
|
||||
default:
|
||||
return tdesc_x32_linux;
|
||||
}
|
||||
}
|
||||
else
|
||||
return tdesc_amd64_linux;
|
||||
return tdesc_x32_linux;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (avx)
|
||||
return tdesc_i386_avx_linux;
|
||||
if (xcr0_features)
|
||||
{
|
||||
switch (xcr0 & I386_XSTATE_ALL_MASK)
|
||||
{
|
||||
case (I386_XSTATE_MPX_MASK):
|
||||
return tdesc_i386_mpx_linux;
|
||||
|
||||
case (I386_XSTATE_AVX_MASK):
|
||||
return tdesc_i386_avx_linux;
|
||||
|
||||
default:
|
||||
return tdesc_i386_linux;
|
||||
}
|
||||
}
|
||||
else
|
||||
return tdesc_i386_linux;
|
||||
}
|
||||
|
@ -3338,6 +3383,8 @@ initialize_low_arch (void)
|
|||
#ifdef __x86_64__
|
||||
init_registers_amd64_linux ();
|
||||
init_registers_amd64_avx_linux ();
|
||||
init_registers_amd64_mpx_linux ();
|
||||
|
||||
init_registers_x32_linux ();
|
||||
init_registers_x32_avx_linux ();
|
||||
|
||||
|
@ -3348,6 +3395,7 @@ initialize_low_arch (void)
|
|||
init_registers_i386_linux ();
|
||||
init_registers_i386_mmx_linux ();
|
||||
init_registers_i386_avx_linux ();
|
||||
init_registers_i386_mpx_linux ();
|
||||
|
||||
tdesc_i386_linux_no_xml = xmalloc (sizeof (struct target_desc));
|
||||
copy_target_description (tdesc_i386_linux_no_xml, tdesc_i386_linux);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue