Centralize amd64-linux target descriptions
[deliverable/binutils-gdb.git] / gdb / x86-linux-nat.c
index fe52c1f2ecc2c045151c8c7e78eba7f72473ac60..46115270581e580aeb2a9fb662fb366798d8beb9 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for GNU/Linux x86 (i386 and x86-64).
 
-   Copyright (C) 1999-2015 Free Software Foundation, Inc.
+   Copyright (C) 1999-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "nat/x86-linux-dregs.h"
 #include "nat/linux-ptrace.h"
 
-/* Per-thread arch-specific data we want to keep.  */
-
-struct arch_lwp_info
-{
-  /* Non-zero if our copy differs from what's recorded in the thread.  */
-  int debug_registers_changed;
-};
-
-\f
-
 /* linux_nat_new_fork hook.   */
 
 static void
@@ -163,7 +153,7 @@ x86_linux_read_description (struct target_ops *ops)
        {
          have_ptrace_getfpxregs = 0;
          have_ptrace_getregset = TRIBOOL_FALSE;
-         return tdesc_i386_mmx_linux;
+         return i386_linux_read_description (X86_XSTATE_X87_MASK);
        }
     }
 #endif
@@ -202,46 +192,18 @@ x86_linux_read_description (struct target_ops *ops)
   if (is_64bit)
     {
 #ifdef __x86_64__
-      switch (xcr0_features_bits)
-       {
-       case X86_XSTATE_MPX_AVX512_MASK:
-       case X86_XSTATE_AVX512_MASK:
-         if (is_x32)
-           return tdesc_x32_avx512_linux;
-         else
-           return tdesc_amd64_avx512_linux;
-       case X86_XSTATE_MPX_MASK:
-         if (is_x32)
-           return tdesc_x32_avx_linux; /* No MPX on x32 using AVX.  */
-         else
-           return tdesc_amd64_mpx_linux;
-       case X86_XSTATE_AVX_MASK:
-         if (is_x32)
-           return tdesc_x32_avx_linux;
-         else
-           return tdesc_amd64_avx_linux;
-       default:
-         if (is_x32)
-           return tdesc_x32_linux;
-         else
-           return tdesc_amd64_linux;
-       }
+      return amd64_linux_read_description (xcr0_features_bits, is_x32);
 #endif
     }
   else
     {
-      switch (xcr0_features_bits)
-       {
-       case X86_XSTATE_MPX_AVX512_MASK:
-       case X86_XSTATE_AVX512_MASK:
-         return tdesc_i386_avx512_linux;
-       case X86_XSTATE_MPX_MASK:
-         return tdesc_i386_mpx_linux;
-       case X86_XSTATE_AVX_MASK:
-         return tdesc_i386_avx_linux;
-       default:
-         return tdesc_i386_linux;
-       }
+      const struct target_desc * tdesc
+       = i386_linux_read_description (xcr0_features_bits);
+
+      if (tdesc == NULL)
+       tdesc = i386_linux_read_description (X86_XSTATE_SSE_MASK);
+
+      return tdesc;
     }
 
   gdb_assert_not_reached ("failed to return tdesc");
@@ -255,7 +217,6 @@ x86_linux_enable_btrace (struct target_ops *self, ptid_t ptid,
                         const struct btrace_config *conf)
 {
   struct btrace_target_info *tinfo;
-  struct gdbarch *gdbarch;
 
   errno = 0;
   tinfo = linux_enable_btrace (ptid, conf);
@@ -264,12 +225,6 @@ x86_linux_enable_btrace (struct target_ops *self, ptid_t ptid,
     error (_("Could not enable branch tracing for %s: %s."),
           target_pid_to_str (ptid), safe_strerror (errno));
 
-  /* Fill in the size of a pointer in bits.  */
-  if (tinfo->ptr_bits == 0)
-    {
-      gdbarch = target_thread_architecture (ptid);
-      tinfo->ptr_bits = gdbarch_ptr_bit (gdbarch);
-    }
   return tinfo;
 }
 
@@ -357,15 +312,6 @@ x86_linux_get_thread_area (pid_t pid, void *addr, unsigned int *base_addr)
 }
 \f
 
-/* to_always_non_stop_p implementation.  */
-
-static int
-x86_linux_always_non_stop_p (struct target_ops *self)
-{
-  /* Enabling this breaks the btrace target.  */
-  return 0;
-}
-
 /* Create an x86 GNU/Linux target.  */
 
 struct target_ops *
@@ -398,8 +344,6 @@ x86_linux_create_target (void)
   t->to_read_btrace = x86_linux_read_btrace;
   t->to_btrace_conf = x86_linux_btrace_conf;
 
-  t->to_always_non_stop_p = x86_linux_always_non_stop_p;
-
   return t;
 }
 
This page took 0.026532 seconds and 4 git commands to generate.