Rename 32- and 64-bit Intel files from "i386" to "x86"
[deliverable/binutils-gdb.git] / gdb / i386-linux-tdep.c
index f96fc816b6b9c5be5cbe570dc96833d490b8f2a3..b3707f7a7ea2ef2d8b9cfbfb8151cddb83ebd6b8 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,8 +27,6 @@
 #include "osabi.h"
 #include "reggroups.h"
 #include "dwarf2-frame.h"
-#include "gdb_string.h"
-
 #include "i386-tdep.h"
 #include "i386-linux-tdep.h"
 #include "linux-tdep.h"
@@ -39,7 +37,7 @@
 #include "xml-syscall.h"
 
 #include "i387-tdep.h"
-#include "i386-xstate.h"
+#include "x86-xstate.h"
 
 /* The syscall's XML filename for i386.  */
 #define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml"
@@ -50,7 +48,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[] =
@@ -70,7 +70,7 @@ static struct core_regset_section i386_linux_sse_regset_sections[] =
 static struct core_regset_section i386_linux_avx_regset_sections[] =
 {
   { ".reg", 68, "general-purpose" },
-  { ".reg-xstate", I386_XSTATE_MAX_SIZE, "XSAVE extended state" },
+  { ".reg-xstate", X86_XSTATE_MAX_SIZE, "XSAVE extended state" },
   { NULL, 0 }
 };
 
@@ -370,23 +370,23 @@ i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 static int
 i386_all_but_ip_registers_record (struct regcache *regcache)
 {
-  if (record_arch_list_add_reg (regcache, I386_EAX_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EAX_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_ECX_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_ECX_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_EDX_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EDX_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_EBX_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EBX_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_ESP_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_ESP_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_EBP_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EBP_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_ESI_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_ESI_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_EDI_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EDI_REGNUM))
     return -1;
-  if (record_arch_list_add_reg (regcache, I386_EFLAGS_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EFLAGS_REGNUM))
     return -1;
 
   return 0;
@@ -450,7 +450,7 @@ i386_linux_intx80_sysenter_syscall_record (struct regcache *regcache)
     return ret;
 
   /* Record the return value of the system call.  */
-  if (record_arch_list_add_reg (regcache, I386_EAX_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EAX_REGNUM))
     return -1;
 
   return 0;
@@ -469,7 +469,7 @@ i386_linux_record_signal (struct gdbarch *gdbarch,
   if (i386_all_but_ip_registers_record (regcache))
     return -1;
 
-  if (record_arch_list_add_reg (regcache, I386_EIP_REGNUM))
+  if (record_full_arch_list_add_reg (regcache, I386_EIP_REGNUM))
     return -1;
 
   /* Record the change in the stack.  */
@@ -480,11 +480,11 @@ i386_linux_record_signal (struct gdbarch *gdbarch,
   /* This is for frame_size.
      sp -= sizeof (struct rt_sigframe);  */
   esp -= I386_LINUX_frame_size;
-  if (record_arch_list_add_mem (esp,
-                                I386_LINUX_xstate + I386_LINUX_frame_size))
+  if (record_full_arch_list_add_mem (esp,
+                                    I386_LINUX_xstate + I386_LINUX_frame_size))
     return -1;
 
-  if (record_arch_list_add_end ())
+  if (record_full_arch_list_add_end ())
     return -1;
 
   return 0;
@@ -569,7 +569,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 +603,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;
@@ -610,8 +613,8 @@ i386_linux_core_read_xcr0 (struct gdbarch *gdbarch,
       size_t size = bfd_section_size (abfd, xstate);
 
       /* Check extended state size.  */
-      if (size < I386_XSTATE_AVX_SIZE)
-       xcr0 = I386_XSTATE_SSE_MASK;
+      if (size < X86_XSTATE_AVX_SIZE)
+       xcr0 = X86_XSTATE_SSE_MASK;
       else
        {
          char contents[8];
@@ -642,14 +645,20 @@ 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 & X86_XSTATE_ALL_MASK))
     {
-    case I386_XSTATE_AVX_MASK:
+    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;
-    case I386_XSTATE_SSE_MASK:
+    case X86_XSTATE_SSE_MASK:
       return tdesc_i386_linux;
-    case I386_XSTATE_X87_MASK:
+    case X86_XSTATE_X87_MASK:
       return tdesc_i386_mmx_linux;
     default:
       break;
@@ -940,7 +949,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 +990,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.025881 seconds and 4 git commands to generate.