This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v1 2/3] Add AVX512 register support to gdbserver.


2013-09-11  Michael Sturm  <michael.sturm@mintel.com>
            Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdbserver/
     * Makefile.in: Added rules to handle new files
     i386-avx512.c i386-avx512-linux.c amd64-avx512.c
     amd64-avx512-linux.c x32-avx512.c x32-avx512-linux.c.
     * configure.srv (srv_i386_regobj): Add i386-avx512.o.
     (srv_i386_linux_regobj): Add i386-avx512-linux.o.
     (srv_amd64_regobj): Add amd64-avx512.o and x32-avx512.o.
     (srv_amd64_linux_regobj): Add amd64-avx512-linux.o and
     x32-avx512-linux.o.
     (srv_i386_32bit_xmlfiles): Add i386/32bit-avx512.xml.
     (srv_i386_64bit_xmlfiles): Add i386/64bit-avx512.xml.
     (srv_amd64_xmlfiles): Add i386/amd64-avx512.xml and
     i386/x32-avx512.xml.
     (srv_i386_linux_xmlfiles): Add i386/i386-avx512-linux.xml.
     (srv_amd64_linux_xmlfiles): Add i386/amd64-avx512-linux.xml and
     i386/x32-avx512-linux.xml.
     * i387-fp.c (num_avx512_k_registers): New constant for number
     of K registers.
     (num_avx512_zmmh_low_registers): New constant for number of
     lower ZMM registers (0-15).
     (num_avx512_zmmh_high_registers): New constant for number of
     higher ZMM registers (16-31).
     (num_avx512_ymmh_registers): New contant for number of higher
     YMM registers (ymm16-31 added by avx521 on x86_64).
     (num_avx512_xmm_registers): New constant for number of higher
     XMM registers (xmm16-31 added by AVX512 on x86_64).
     (struct i387_xsave): Add space for AVX512 registers.
     (i387_cache_to_xsave): Change raw buffer size to 64 characters.
     Add code to handle AVX512 registers.
     (i387_xsave_to_cache): Add code to handle AVX512 registers.
     * linux-x86-low.c (init_registers_amd64_avx512_linux): New
     prototypei from generated file.
     (tdesc_amd64_avx512_linux): Likewise.
     (init_registers_x32_avx512_linux): Likewise.
     (tdesc_x32_avx512_linux): Likewise.
     (init_registers_i386_avx512_linux): Likewise.
     (tdesc_i386_avx512_linux): Likewise.
     (x86_64_regmap): Add AVX512 registers.
     (x86_linux_read_description): Add code to handle AVX512 XSTATE
     mask.
     (initialize_low_arch): Add code to initialize AVX512 registers.

---
 gdb/gdbserver/Makefile.in     |  19 ++++-
 gdb/gdbserver/configure.srv   |  20 ++---
 gdb/gdbserver/i387-fp.c       | 182 +++++++++++++++++++++++++++++++++++++++++-
 gdb/gdbserver/linux-x86-low.c |  35 +++++++-
 4 files changed, 242 insertions(+), 14 deletions(-)

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 641ea17..a80763b 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -343,11 +343,14 @@ clean:
 	rm -f xml-builtin.c stamp-xml
 	rm -f i386-avx.c i386-avx-linux.c
 	rm -f i386-mpx.c i386-mpx-linux.c
+	rm -f i386-avx512.c i386-avx512-linux.c
 	rm -f amd64-avx.c amd64-avx-linux.c
 	rm -f amd64-mpx.c amd64-mpx-linux.c
+	rm -f amd64-avx512.c amd64-avx512-linux.c
 	rm -f i386-mmx.c i386-mmx-linux.c
 	rm -f x32.c x32-linux.c
 	rm -f x32-avx.c x32-avx-linux.c
+	rm -f x32-avx512.c x32-avx512-linux.c
 	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
 
 maintainer-clean realclean distclean: clean
@@ -570,6 +573,10 @@ i386-avx.c : $(srcdir)/../regformats/i386/i386-avx.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx.dat i386-avx.c
 i386-avx-linux.c : $(srcdir)/../regformats/i386/i386-avx-linux.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx-linux.dat i386-avx-linux.c
+i386-avx512.c : $(srcdir)/../regformats/i386/i386-avx512.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx512.dat i386-avx.c
+i386-avx512-linux.c : $(srcdir)/../regformats/i386/i386-avx512-linux.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx512-linux.dat i386-avx512-linux.c
 i386-mpx.c : $(srcdir)/../regformats/i386/i386-mpx.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-mpx.dat i386-mpx.c
 i386-mpx-linux.c : $(srcdir)/../regformats/i386/i386-mpx-linux.dat $(regdat_sh)
@@ -670,10 +677,14 @@ amd64-linux.c : $(srcdir)/../regformats/i386/amd64-linux.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-linux.dat amd64-linux.c
 amd64-avx.c : $(srcdir)/../regformats/i386/amd64-avx.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx.dat amd64-avx.c
-amd64-mpx.c : $(srcdir)/../regformats/i386/amd64-mpx.dat $(regdat_sh)
-	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-mpx.dat amd64-mpx.c
 amd64-avx-linux.c : $(srcdir)/../regformats/i386/amd64-avx-linux.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c
+amd64-avx512.c : $(srcdir)/../regformats/i386/amd64-avx512.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx512.dat amd64-avx512.c
+amd64-avx512-linux.c : $(srcdir)/../regformats/i386/amd64-avx512-linux.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx512-linux.dat amd64-avx512-linux.c
+amd64-mpx.c : $(srcdir)/../regformats/i386/amd64-mpx.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-mpx.dat amd64-mpx.c
 amd64-mpx-linux.c : $(srcdir)/../regformats/i386/amd64-mpx-linux.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-mpx-linux.dat amd64-mpx-linux.c
 x32.c : $(srcdir)/../regformats/i386/x32.dat $(regdat_sh)
@@ -684,6 +695,10 @@ x32-avx.c : $(srcdir)/../regformats/i386/x32-avx.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32-avx.dat x32-avx.c
 x32-avx-linux.c : $(srcdir)/../regformats/i386/x32-avx-linux.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32-avx-linux.dat x32-avx-linux.c
+x32-avx512.c : $(srcdir)/../regformats/i386/x32-avx512.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32-avx512.dat x32-avx512.c
+x32-avx512-linux.c : $(srcdir)/../regformats/i386/x32-avx512-linux.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32-avx512-linux.dat x32-avx512-linux.c
 reg-xtensa.c : $(srcdir)/../regformats/reg-xtensa.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-xtensa.dat reg-xtensa.c
 reg-tilegx.c : $(srcdir)/../regformats/reg-tilegx.dat $(regdat_sh)
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 32d935a..097c7b4 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -24,20 +24,20 @@
 # Default hostio_last_error implementation
 srv_hostio_err_objs="hostio-errno.o"
 
-srv_i386_regobj="i386.o i386-avx.o i386-mpx.o i386-mmx.o"
-srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-mpx-linux.o i386-mmx-linux.o"
-srv_amd64_regobj="amd64.o amd64-avx.o amd64-mpx.o x32.o x32-avx.o"
-srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-mpx-linux.o x32-linux.o x32-avx-linux.o"
+srv_i386_regobj="i386.o i386-avx.o i386-avx512.o i386-mpx.o i386-mmx.o"
+srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx512-linux.o i386-mpx-linux.o i386-mmx-linux.o"
+srv_amd64_regobj="amd64.o amd64-avx.o amd64-avx512.o amd64-mpx.o x32.o x32-avx.o x32-avx512.o"
+srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx512-linux.o amd64-mpx-linux.o x32-linux.o x32-avx-linux.o x32-avx512-linux.o"
 
 ipa_i386_linux_regobj=i386-linux-ipa.o
 ipa_amd64_linux_regobj=amd64-linux-ipa.o
 
-srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml i386/32bit-mpx.xml"
-srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml i386/x32-core.xml i386/64bit-mpx.xml"
-srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml i386/i386-mpx.xml i386/i386-mmx.xml $srv_i386_32bit_xmlfiles"
-srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml i386/x32.xml i386/x32-avx.xml i386/amd64-mpx.xml $srv_i386_64bit_xmlfiles"
-srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/i386-mmx-linux.xml i386/32bit-linux.xml i386/i386-mpx-linux.xml $srv_i386_32bit_xmlfiles"
-srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/64bit-linux.xml i386/amd64-mpx-linux.xml i386/x32-linux.xml i386/x32-avx-linux.xml $srv_i386_64bit_xmlfiles"
+srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml i386/32bit-avx512.xml i386/32bit-mpx.xml"
+srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml i386/64bit-avx512.xml i386/x32-core.xml i386/64bit-mpx.xml"
+srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml i386/i386-avx512.xml i386/i386-mpx.xml i386/i386-mmx.xml $srv_i386_32bit_xmlfiles"
+srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml i386/amd64-avx512.xml i386/x32.xml i386/x32-avx.xml i386/x32-avx512.xml i386/amd64-mpx.xml $srv_i386_64bit_xmlfiles"
+srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/i386-avx512-linux.xml i386/i386-mmx-linux.xml i386/32bit-linux.xml i386/i386-mpx-linux.xml $srv_i386_32bit_xmlfiles"
+srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/amd64-avx512-linux.xml i386/64bit-linux.xml i386/amd64-mpx-linux.xml i386/x32-linux.xml i386/x32-avx-linux.xml i386/x32-avx512-linux.xml $srv_i386_64bit_xmlfiles"
 
 
 # Linux object files.  This is so we don't have to repeat
diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c
index 1240b67..7d0e084 100644
--- a/gdb/gdbserver/i387-fp.c
+++ b/gdb/gdbserver/i387-fp.c
@@ -22,6 +22,11 @@
 
 static const int num_mpx_bnd_registers = 4;
 static const int num_mpx_cfg_registers = 2;
+static const int num_avx512_k_registers = 8;
+static const int num_avx512_zmmh_low_registers = 16;
+static const int num_avx512_zmmh_high_registers = 16;
+static const int num_avx512_ymmh_registers = 16;
+static const int num_avx512_xmm_registers = 16;
 
 /* Note: These functions preserve the reserved bits in control registers.
    However, gdbserver promptly throws away that information.  */
@@ -120,6 +125,17 @@ struct i387_xsave {
   /* Space for 2 MPX configuration registers of 64 bits
      plus reserved space.  */
   unsigned char mpx_cfg_space[16];
+
+  unsigned char reserved5[48];
+
+  /* Space for 8 OpMask register values of 64 bits.  */
+  unsigned char k_space[64];
+
+  /* Space for 16 256-bit zmm0-15.  */
+  unsigned char zmmh_low_space[512];
+
+  /* Space for 16 512-bit zmm16-31 values.  */
+  unsigned char zmmh_high_space[1024];
 };
 
 void
@@ -259,7 +275,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
   unsigned long val, val2;
   unsigned int clear_bv;
   unsigned long long xstate_bv = 0;
-  char raw[16];
+  char raw[64];
   char *p;
   /* Amd64 has 16 xmm regs; I386 has 8 xmm regs.  */
   int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8;
@@ -291,6 +307,24 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
       if ((clear_bv & I386_XSTATE_BNDCFG))
 	for (i = 0; i < num_mpx_cfg_registers; i++)
 	  memset (((char *) &fp->mpx_cfg_space[0]) + i * 8, 0, 8);
+
+      if ((clear_bv & I386_XSTATE_K))
+	for (i = 0; i < num_avx512_k_registers; i++)
+	  memset (((char *) &fp->k_space[0]) + i * 8, 0, 8);
+
+      if ((clear_bv & I386_XSTATE_ZMM_H))
+	for (i = 0; i < num_avx512_zmmh_low_registers; i++)
+	  memset (((char *) &fp->zmmh_low_space[0]) + i * 32, 0, 32);
+
+      if ((clear_bv & I386_XSTATE_ZMM))
+	{
+	  for (i = 0; i < num_avx512_zmmh_high_registers; i++)
+	    memset (((char *) &fp->zmmh_low_space[0]) + 32 + i * 64, 0, 32);
+	  for (i = 0; i < num_avx512_xmm_registers; i++)
+	    memset (((char *) &fp->zmmh_high_space[0]) + i * 64, 0, 16);
+	  for (i = 0; i < num_avx512_ymmh_registers; i++)
+	    memset (((char *) &fp->zmmh_high_space[0]) + 16 + i * 64, 0, 16);
+	}
     }
 
   /* Check if any x87 registers are changed.  */
@@ -378,6 +412,91 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
 	}
     }
 
+  /* Check if any K registers are changed.  */
+  if ((x86_xcr0 & I386_XSTATE_K))
+    {
+      int k0_regnum = find_regno (regcache->tdesc, "k0");
+
+      for (i = 0; i < num_avx512_k_registers; i++)
+	{
+	  collect_register (regcache, i + k0_regnum, raw);
+	  p = ((char *) &fp->k_space[0]) + i * 8;
+	  if (memcmp (raw, p, 8))
+	    {
+	      xstate_bv |= I386_XSTATE_K;
+	      memcpy (p, raw, 8);
+	    }
+	}
+    }
+
+  /* Check if any of ZMM0H-ZMM15H registers are changed.  */
+  if ((x86_xcr0 & I386_XSTATE_ZMM_H))
+    {
+      int zmm0h_regnum = find_regno (regcache->tdesc, "zmm0h");
+
+      for (i = 0; i < num_avx512_zmmh_low_registers; i++)
+	{
+	  collect_register (regcache, i + zmm0h_regnum, raw);
+	  p = ((char *) &fp->zmmh_low_space[0]) + i * 32;
+	  if (memcmp (raw, p, 32))
+	    {
+	      xstate_bv |= I386_XSTATE_ZMM_H;
+	      memcpy (p, raw, 32);
+	    }
+	}
+    }
+
+  /* Check if any of ZMM16H-ZMM31H registers are changed.  */
+  if ((x86_xcr0 & I386_XSTATE_ZMM))
+    {
+      int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h");
+
+      for (i = 0; i < num_avx512_zmmh_high_registers; i++)
+	{
+	  collect_register (regcache, i + zmm16h_regnum, raw);
+	  p = ((char *) &fp->zmmh_low_space[0]) + 32 + i * 64;
+	  if (memcmp (raw, p, 32))
+	    {
+	      xstate_bv |= I386_XSTATE_ZMM;
+	      memcpy (p, raw, 32);
+	    }
+	}
+    }
+
+  /* Check if any XMM_AVX512 registers are changed.  */
+  if ((x86_xcr0 & I386_XSTATE_ZMM))
+    {
+      int xmm_avx512_regnum = find_regno (regcache->tdesc, "xmm16");
+
+      for (i = 0; i < num_avx512_xmm_registers; i++)
+	{
+	  collect_register (regcache, i + xmm_avx512_regnum, raw);
+	  p = ((char *) &fp->zmmh_high_space[0]) + i * 64;
+	  if (memcmp (raw, p, 16))
+	    {
+	      xstate_bv |= I386_XSTATE_ZMM;
+	      memcpy (p, raw, 16);
+	    }
+	}
+    }
+
+  /* Check if any YMMH_AVX512 registers are changed.  */
+  if ((x86_xcr0 & I386_XSTATE_ZMM))
+    {
+      int ymmh_avx512_regnum = find_regno (regcache->tdesc, "ymm16h");
+
+      for (i = 0; i < num_avx512_ymmh_registers; i++)
+	{
+	  collect_register (regcache, i + ymmh_avx512_regnum, raw);
+	  p = ((char *) &fp->zmmh_high_space[0]) + 16 + i * 64;
+	  if (memcmp (raw, p, 16))
+	    {
+	      xstate_bv |= I386_XSTATE_ZMM;
+	      memcpy (p, raw, 16);
+	    }
+	}
+    }
+
   /* Update the corresponding bits in xstate_bv if any SSE/AVX
      registers are changed.  */
   fp->xstate_bv |= xstate_bv;
@@ -621,6 +740,67 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
 	}
     }
 
+  if ((x86_xcr0 & I386_XSTATE_K) != 0)
+    {
+      int k0_regnum = find_regno (regcache->tdesc, "k0");
+
+      if ((clear_bv & I386_XSTATE_K) != 0)
+	{
+	  for (i = 0; i < num_avx512_k_registers; i++)
+	    supply_register_zeroed (regcache, i + k0_regnum);
+	}
+      else
+	{
+	  p = (gdb_byte *) &fp->k_space[0];
+	  for (i = 0; i < num_avx512_k_registers; i++)
+	    supply_register (regcache, i + k0_regnum, p + i * 8);
+	}
+    }
+
+  if ((x86_xcr0 & I386_XSTATE_ZMM_H) != 0)
+    {
+      int zmm0h_regnum = find_regno (regcache->tdesc, "zmm0h");
+
+      if ((clear_bv & I386_XSTATE_ZMM_H) != 0)
+	{
+	  for (i = 0; i < num_avx512_zmmh_low_registers; i++)
+	    supply_register_zeroed (regcache, i + zmm0h_regnum);
+	}
+      else
+	{
+	  p = (gdb_byte *) &fp->zmmh_low_space[0];
+	  for (i = 0; i < num_avx512_zmmh_low_registers; i++)
+	    supply_register (regcache, i + zmm0h_regnum, p + i * 32);
+	}
+    }
+
+  if ((x86_xcr0 & I386_XSTATE_ZMM) != 0)
+    {
+      int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h");
+      int ymm16h_regnum = find_regno (regcache->tdesc, "ymm16h");
+      int xmm16_regnum = find_regno (regcache->tdesc, "xmm16");
+
+      if ((clear_bv & I386_XSTATE_ZMM) != 0)
+	{
+	  for (i = 0; i < num_avx512_zmmh_high_registers; i++)
+	    supply_register_zeroed (regcache, i + zmm16h_regnum);
+	  for (i = 0; i < num_avx512_ymmh_registers; i++)
+	    supply_register_zeroed (regcache, i + ymm16h_regnum);
+	  for (i = 0; i < num_avx512_xmm_registers; i++)
+	    supply_register_zeroed (regcache, i + xmm16_regnum);
+	}
+      else
+	{
+	  p = (gdb_byte *) &fp->zmmh_high_space[0];
+	  for (i = 0; i < num_avx512_zmmh_high_registers; i++)
+	    supply_register (regcache, i + zmm16h_regnum, p + 32 + i * 64);
+	  for (i = 0; i < num_avx512_ymmh_registers; i++)
+	    supply_register (regcache, i + ymm16h_regnum, p + 16 + i * 64);
+	  for (i = 0; i < num_avx512_xmm_registers; i++)
+	    supply_register (regcache, i + xmm16_regnum, p + i * 64);
+	}
+    }
+
   supply_register_by_name (regcache, "fioff", &fp->fioff);
   supply_register_by_name (regcache, "fooff", &fp->fooff);
   supply_register_by_name (regcache, "mxcsr", &fp->mxcsr);
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index e8505bf..d30184b 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -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-avx512-linux.c.  */
+void init_registers_amd64_avx512_linux (void);
+extern const struct target_desc *tdesc_amd64_avx512_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;
@@ -55,6 +59,10 @@ extern const struct target_desc *tdesc_x32_linux;
 void init_registers_x32_avx_linux (void);
 extern const struct target_desc *tdesc_x32_avx_linux;
 
+/* Defined in auto-generated file x32-avx512-linux.c.  */
+void init_registers_x32_avx512_linux (void);
+extern const struct target_desc *tdesc_x32_avx512_linux;
+
 #endif
 
 /* Defined in auto-generated file i386-linux.c.  */
@@ -69,6 +77,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-avx512-linux.c.  */
+void init_registers_i386_avx512_linux (void);
+extern const struct target_desc *tdesc_i386_avx512_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;
@@ -176,7 +188,16 @@ static const int x86_64_regmap[] =
   -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.  */
+  -1, -1,				/* MPX registers BNDCFGU, BNDSTATUS.  */
+  -1, -1, -1, -1, -1, -1, -1, -1,       /* xmm16 ... xmm31 (AVX512)  */
+  -1, -1, -1, -1, -1, -1, -1, -1,
+  -1, -1, -1, -1, -1, -1, -1, -1,       /* ymm16 ... ymm31 (AVX512)  */
+  -1, -1, -1, -1, -1, -1, -1, -1,
+  -1, -1, -1, -1, -1, -1, -1, -1,       /* k0 ... k7 (AVX512)  */
+  -1, -1, -1, -1, -1, -1, -1, -1,       /* zmm0 ... zmm31 (AVX512)  */
+  -1, -1, -1, -1, -1, -1, -1, -1,
+  -1, -1, -1, -1, -1, -1, -1, -1,
+  -1, -1, -1, -1, -1, -1, -1, -1
 };
 
 #define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0]))
@@ -1339,6 +1360,9 @@ x86_linux_read_description (void)
 	    {
 	      switch (xcr0 & I386_XSTATE_ALL_MASK)
 	        {
+		case I386_XSTATE_AVX512_MASK:
+		  return tdesc_amd64_avx512_linux;
+
 		case I386_XSTATE_MPX_MASK:
 		  return tdesc_amd64_mpx_linux;
 
@@ -1358,6 +1382,9 @@ x86_linux_read_description (void)
 	    {
 	      switch (xcr0 & I386_XSTATE_ALL_MASK)
 	        {
+		case I386_XSTATE_AVX512_MASK:
+		  return tdesc_x32_avx512_linux;
+
 		case I386_XSTATE_MPX_MASK: /* No MPX on x32.  */
 		case I386_XSTATE_AVX_MASK:
 		  return tdesc_x32_avx_linux;
@@ -1377,6 +1404,9 @@ x86_linux_read_description (void)
 	{
 	  switch (xcr0 & I386_XSTATE_ALL_MASK)
 	    {
+	    case (I386_XSTATE_AVX512_MASK):
+	      return tdesc_i386_avx512_linux;
+
 	    case (I386_XSTATE_MPX_MASK):
 	      return tdesc_i386_mpx_linux;
 
@@ -3383,10 +3413,12 @@ initialize_low_arch (void)
 #ifdef __x86_64__
   init_registers_amd64_linux ();
   init_registers_amd64_avx_linux ();
+  init_registers_amd64_avx512_linux ();
   init_registers_amd64_mpx_linux ();
 
   init_registers_x32_linux ();
   init_registers_x32_avx_linux ();
+  init_registers_x32_avx512_linux ();
 
   tdesc_amd64_linux_no_xml = xmalloc (sizeof (struct target_desc));
   copy_target_description (tdesc_amd64_linux_no_xml, tdesc_amd64_linux);
@@ -3395,6 +3427,7 @@ initialize_low_arch (void)
   init_registers_i386_linux ();
   init_registers_i386_mmx_linux ();
   init_registers_i386_avx_linux ();
+  init_registers_i386_avx512_linux ();
   init_registers_i386_mpx_linux ();
 
   tdesc_i386_linux_no_xml = xmalloc (sizeof (struct target_desc));
-- 
1.8.4.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]