gdb: Fix build failure with GCC 7
[deliverable/binutils-gdb.git] / gdb / i387-tdep.c
index b0c48e4423bc35e7056533db5c4cb6d1166bfa78..574914cab78f6b62a720a08e6a70de5b171d92ef 100644 (file)
@@ -341,8 +341,9 @@ i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
   if (i386_fp_regnum_p (gdbarch, regnum))
     {
       /* Floating point registers must be converted unless we are
-        accessing them in their hardware type.  */
-      if (type == i387_ext_type (gdbarch))
+        accessing them in their hardware type or TYPE is not float.  */
+      if (type == i387_ext_type (gdbarch)
+         || TYPE_CODE (type) != TYPE_CODE_FLT)
        return 0;
       else
        return 1;
@@ -374,7 +375,8 @@ i387_register_to_value (struct frame_info *frame, int regnum,
     }
 
   /* Convert to TYPE.  */
-  if (!get_frame_register_bytes (frame, regnum, 0, TYPE_LENGTH (type),
+  if (!get_frame_register_bytes (frame, regnum, 0,
+                                register_size (gdbarch, regnum),
                                 from, optimizedp, unavailablep))
     return 0;
 
@@ -912,7 +914,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
   const gdb_byte *regs = (const gdb_byte *) xsave;
   int i;
   ULONGEST clear_bv;
-  static const gdb_byte zero[MAX_REGISTER_SIZE] = { 0 };
+  static const gdb_byte zero[I386_MAX_REGISTER_SIZE] = { 0 };
   enum
     {
       none = 0x0,
@@ -1860,3 +1862,20 @@ i387_return_value (struct gdbarch *gdbarch, struct regcache *regcache)
   regcache_raw_write_unsigned (regcache, I387_FTAG_REGNUM (tdep), 0x3fff);
 
 }
+
+/* See i387-tdep.h.  */
+
+void
+i387_reset_bnd_regs (struct gdbarch *gdbarch, struct regcache *regcache)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (I387_BND0R_REGNUM (tdep) > 0)
+    {
+      gdb_byte bnd_buf[16];
+
+      memset (bnd_buf, 0, 16);
+      for (int i = 0; i < I387_NUM_BND_REGS; i++)
+       regcache_raw_write (regcache, I387_BND0R_REGNUM (tdep) + i, bnd_buf);
+    }
+}
This page took 0.029401 seconds and 4 git commands to generate.