diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2010-04-07 18:46:50 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2010-04-07 18:46:50 +0000 |
commit | a055a18785d694f50a4ebc8d36579ed20ffd3069 (patch) | |
tree | a10bec1357e03752dcbd479658e33b87ba98cd21 /gdb/amd64-linux-tdep.c | |
parent | 31aeac7844e6e347a01fa69178fd1014e69578c0 (diff) | |
download | gdb-a055a18785d694f50a4ebc8d36579ed20ffd3069.zip gdb-a055a18785d694f50a4ebc8d36579ed20ffd3069.tar.gz gdb-a055a18785d694f50a4ebc8d36579ed20ffd3069.tar.bz2 |
Support amd64 AVX.
gdb/
2010-04-07 H.J. Lu <hongjiu.lu@intel.com>
* amd64-linux-nat.c: Include "regset.h", "elf/common.h",
<sys/uio.h> and "i386-xstate.h".
(PTRACE_GETREGSET): New.
(PTRACE_SETREGSET): Likewise.
(have_ptrace_getregset): Likewise.
(amd64_linux_gregset64_reg_offset): Include 16 upper YMM
registers.
(amd64_linux_gregset32_reg_offset): Include 8 upper YMM
registers.
(amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS.
(amd64_linux_store_inferior_registers): Likewise.
(amd64_linux_read_description): Check and enable AVX target
descriptions.
* amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h"
and "features/i386/amd64-avx-linux.c".
(amd64_linux_regset_sections): New.
(amd64_linux_core_read_description): Check and enable AVX
target description.
(amd64_linux_init_abi): Set xsave_xcr0_offset. Call
set_gdbarch_core_regset_sections.
(_initialize_amd64_linux_tdep): Call
initialize_tdesc_amd64_avx_linux.
* amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace
AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM.
(tdesc_amd64_avx_linux): New.
(amd64_linux_update_xstateregset): Likewise.
* amd64-tdep.c: Include "features/i386/amd64-avx.c".
(amd64_ymm_names): New.
(amd64_ymmh_names): Likewise.
(amd64_register_name): Likewise.
(amd64_supply_xstateregset): Likewise.
(amd64_collect_xstateregset): Likewise.
(amd64_supply_xsave): Likewise.
(amd64_collect_xsave): Likewise.
(AMD64_NUM_REGS): Removed.
(amd64_dwarf_reg_to_regnum): Return %ymmN register number for
%xmmN if AVX is available.
(amd64_pseudo_register_name): Support pseudo YMM registers.
(amd64_regset_from_core_section): Support .reg-xstate section.
(amd64_init_abi): Set ymmh_register_names, num_ymm_regs
and ymm0h_regnum. Call set_gdbarch_register_name.
(amd64_init_abi): Call initialize_tdesc_amd64_avx.
* amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and
AMD64_YMM15H_REGNUM.
(AMD64_NUM_REGS): New.
(amd64_supply_xsave): Likewise.
(amd64_collect_xsave): Likewise.
(amd64_register_name): Removed.
(amd64_register_type): Likewise.
gdb/testsuite/
2010-04-07 H.J. Lu <hongjiu.lu@intel.com>
* gdb.arch/i386-avx.c: New.
* gdb.arch/i386-avx.exp: Likewise.
* gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
Diffstat (limited to 'gdb/amd64-linux-tdep.c')
-rw-r--r-- | gdb/amd64-linux-tdep.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 4ad6dc9..1205e31 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -28,8 +28,11 @@ #include "symtab.h" #include "gdbtypes.h" #include "reggroups.h" +#include "regset.h" #include "amd64-linux-tdep.h" +#include "i386-linux-tdep.h" #include "linux-tdep.h" +#include "i386-xstate.h" #include "gdb_string.h" @@ -38,6 +41,7 @@ #include "xml-syscall.h" #include "features/i386/amd64-linux.c" +#include "features/i386/amd64-avx-linux.c" /* The syscall's XML filename for i386. */ #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" @@ -45,6 +49,15 @@ #include "record.h" #include "linux-record.h" +/* Supported register note sections. */ +static struct core_regset_section amd64_linux_regset_sections[] = +{ + { ".reg", 144, "general-purpose" }, + { ".reg2", 512, "floating-point" }, + { ".reg-xstate", I386_XSTATE_MAX_SIZE, "XSAVE extended state" }, + { NULL, 0 } +}; + /* Mapping between the general-purpose registers in `struct user' format and GDB's register cache layout. */ @@ -1250,12 +1263,17 @@ amd64_linux_core_read_description (struct gdbarch *gdbarch, bfd *abfd) { asection *section = bfd_get_section_by_name (abfd, ".reg2"); + uint64_t xcr0; if (section == NULL) return NULL; /* Linux/x86-64. */ - return tdesc_amd64_linux; + xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); + if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) + return tdesc_amd64_avx_linux; + else + return tdesc_amd64_linux; } static void @@ -1297,6 +1315,8 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->sc_reg_offset = amd64_linux_sc_reg_offset; tdep->sc_num_regs = ARRAY_SIZE (amd64_linux_sc_reg_offset); + tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; + /* GNU/Linux uses SVR4-style shared libraries. */ set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); @@ -1318,6 +1338,9 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* GNU/Linux uses SVR4-style shared libraries. */ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); + /* Install supported register note sections. */ + set_gdbarch_core_regset_sections (gdbarch, amd64_linux_regset_sections); + set_gdbarch_core_read_description (gdbarch, amd64_linux_core_read_description); @@ -1517,4 +1540,5 @@ _initialize_amd64_linux_tdep (void) /* Initialize the Linux target description */ initialize_tdesc_amd64_linux (); + initialize_tdesc_amd64_avx_linux (); } |