Add AVX512 registers support to GDB and GDBserver.
[deliverable/binutils-gdb.git] / gdb / i386-linux-tdep.c
index fc9de622babfb4d962466da88074ca38e2d61a46..8ab8954183ba8bfaa6de845de164f05115949cab 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for GNU/Linux i386.
 
-   Copyright (C) 2000-2013 Free Software Foundation, Inc.
+   Copyright (C) 2000-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,7 +27,7 @@
 #include "osabi.h"
 #include "reggroups.h"
 #include "dwarf2-frame.h"
-#include "gdb_string.h"
+#include <string.h>
 
 #include "i386-tdep.h"
 #include "i386-linux-tdep.h"
@@ -50,7 +50,9 @@
 
 #include "features/i386/i386-linux.c"
 #include "features/i386/i386-mmx-linux.c"
+#include "features/i386/i386-mpx-linux.c"
 #include "features/i386/i386-avx-linux.c"
+#include "features/i386/i386-avx512-linux.c"
 
 /* Supported register note sections.  */
 static struct core_regset_section i386_linux_regset_sections[] =
@@ -569,7 +571,11 @@ int i386_linux_gregset_reg_offset[] =
   -1, -1, -1, -1, -1, -1, -1, -1,
   -1,
   -1, -1, -1, -1, -1, -1, -1, -1,
-  11 * 4                       /* "orig_eax" */
+  -1, -1, -1, -1,                /* MPX registers BND0 ... BND3.  */
+  -1, -1,                        /* MPX registers BNDCFGU, BNDSTATUS.  */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512)  */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512)  */
+  11 * 4,                        /* "orig_eax"  */
 };
 
 /* Mapping between the general-purpose registers in `struct
@@ -599,8 +605,7 @@ static int i386_linux_sc_reg_offset[] =
 /* Get XSAVE extended state xcr0 from core dump.  */
 
 uint64_t
-i386_linux_core_read_xcr0 (struct gdbarch *gdbarch,
-                          struct target_ops *target, bfd *abfd)
+i386_linux_core_read_xcr0 (bfd *abfd)
 {
   asection *xstate = bfd_get_section_by_name (abfd, ".reg-xstate");
   uint64_t xcr0;
@@ -642,9 +647,15 @@ i386_linux_core_read_description (struct gdbarch *gdbarch,
                                  bfd *abfd)
 {
   /* Linux/i386.  */
-  uint64_t xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
-  switch ((xcr0 & I386_XSTATE_AVX_MASK))
+  uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd);
+
+  switch ((xcr0 & I386_XSTATE_ALL_MASK))
     {
+    case I386_XSTATE_MPX_AVX512_MASK:
+    case I386_XSTATE_AVX512_MASK:
+      return tdesc_i386_avx512_linux;
+    case I386_XSTATE_MPX_MASK:
+      return tdesc_i386_mpx_linux;
     case I386_XSTATE_AVX_MASK:
       return tdesc_i386_avx_linux;
     case I386_XSTATE_SSE_MASK:
@@ -940,7 +951,8 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
                                              svr4_fetch_objfile_link_map);
 
   /* Install supported register note sections.  */
-  if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"))
+  if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx512")
+      || tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"))
     set_gdbarch_core_regset_sections (gdbarch, i386_linux_avx_regset_sections);
   else if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"))
     set_gdbarch_core_regset_sections (gdbarch, i386_linux_sse_regset_sections);
@@ -980,4 +992,6 @@ _initialize_i386_linux_tdep (void)
   initialize_tdesc_i386_linux ();
   initialize_tdesc_i386_mmx_linux ();
   initialize_tdesc_i386_avx_linux ();
+  initialize_tdesc_i386_mpx_linux ();
+  initialize_tdesc_i386_avx512_linux ();
 }
This page took 0.039558 seconds and 4 git commands to generate.