2011-02-28 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / i387-tdep.c
index 4c32e09ce5870c809c6ee50b7b04dcab4d59b191..122bd83a397a3b1d4899fdc1a439a4321876a1d1 100644 (file)
@@ -1,7 +1,7 @@
 /* Intel 387 floating point stuff.
 
    Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -205,7 +205,6 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
                       struct frame_info *frame, const char *args)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
-  gdb_byte buf[4];
   ULONGEST fctrl;
   ULONGEST fstat;
   ULONGEST ftag;
@@ -254,7 +253,8 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
          break;
        }
 
-      get_frame_register (frame, (fpreg + 8 - top) % 8 + I387_ST0_REGNUM (tdep),
+      get_frame_register (frame,
+                         (fpreg + 8 - top) % 8 + I387_ST0_REGNUM (tdep),
                          raw);
 
       fputs_filtered ("0x", file);
@@ -288,7 +288,8 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
    needs any special handling.  */
 
 int
-i387_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
+i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
+                        struct type *type)
 {
   if (i386_fp_regnum_p (gdbarch, regnum))
     {
@@ -586,9 +587,9 @@ i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
 
                    if (val[0] & (1 << fpreg))
                      {
-                       int regnum = (fpreg + 8 - top) % 8 
-                                      + I387_ST0_REGNUM (tdep);
-                       tag = i387_tag (FXSAVE_ADDR (tdep, regs, regnum));
+                       int thisreg = (fpreg + 8 - top) % 8 
+                                      + I387_ST0_REGNUM (tdep);
+                       tag = i387_tag (FXSAVE_ADDR (tdep, regs, thisreg));
                      }
                    else
                      tag = 3;          /* Empty */
@@ -881,9 +882,9 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
 
                    if (val[0] & (1 << fpreg))
                      {
-                       int regnum = (fpreg + 8 - top) % 8 
+                       int thisreg = (fpreg + 8 - top) % 8 
                                       + I387_ST0_REGNUM (tdep);
-                       tag = i387_tag (FXSAVE_ADDR (tdep, regs, regnum));
+                       tag = i387_tag (FXSAVE_ADDR (tdep, regs, thisreg));
                      }
                    else
                      tag = 3;          /* Empty */
@@ -958,7 +959,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
       gdb_byte raw[I386_MAX_REGISTER_SIZE];
       gdb_byte *xstate_bv_p = XSAVE_XSTATE_BV_ADDR (regs);
       unsigned int xstate_bv = 0;
-      /* The supported bits in `xstat_bv' are 1 byte. */
+      /* The supported bits in `xstat_bv' are 1 byte.  */
       unsigned int clear_bv = (~(*xstate_bv_p)) & tdep->xcr0;
       gdb_byte *p;
 
@@ -1033,68 +1034,70 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
          switch (regclass)
            {
            default:
-                 abort ();
-
-               case avxh:
-                 /* This is an upper YMM register.  */
-                 p = XSAVE_AVXH_ADDR (tdep, regs, regnum);
-                 if (memcmp (raw, p, 16))
-                   {
-                     xstate_bv |= I386_XSTATE_AVX;
-                     memcpy (p, raw, 16);
-                   }
-                 break;
-
-               case sse:
-                 /* This is an SSE register.  */
-                 p = FXSAVE_ADDR (tdep, regs, regnum);
-                 if (memcmp (raw, p, 16))
-                   {
-                     xstate_bv |= I386_XSTATE_SSE;
-                     memcpy (p, raw, 16);
-                   }
-                 break;
-
-               case x87:
-                 /* This is an x87 register.  */
-                 p = FXSAVE_ADDR (tdep, regs, regnum);
-                 if (memcmp (raw, p, 10))
-                   {
-                     xstate_bv |= I386_XSTATE_X87;
-                     memcpy (p, raw, 10);
-                   }
-                 break;
-               }
-           }
+             internal_error (__FILE__, __LINE__,
+                             _("invalid i387 regclass"));
 
-         /* Update the corresponding bits in `xstate_bv' if any SSE/AVX
-            registers are changed.  */
-         if (xstate_bv)
-           {
-             /* The supported bits in `xstat_bv' are 1 byte.  */
-             *xstate_bv_p |= (gdb_byte) xstate_bv;
-
-             switch (regclass)
+           case avxh:
+             /* This is an upper YMM register.  */
+             p = XSAVE_AVXH_ADDR (tdep, regs, regnum);
+             if (memcmp (raw, p, 16))
                {
-               default:
-                 abort ();
+                 xstate_bv |= I386_XSTATE_AVX;
+                 memcpy (p, raw, 16);
+               }
+             break;
 
-               case all:
-                 break;
+           case sse:
+             /* This is an SSE register.  */
+             p = FXSAVE_ADDR (tdep, regs, regnum);
+             if (memcmp (raw, p, 16))
+               {
+                 xstate_bv |= I386_XSTATE_SSE;
+                 memcpy (p, raw, 16);
+               }
+             break;
 
-               case x87:
-               case sse:
-               case avxh:
-                 /* Register REGNUM has been updated.  Return.  */
-                 return;
+           case x87:
+             /* This is an x87 register.  */
+             p = FXSAVE_ADDR (tdep, regs, regnum);
+             if (memcmp (raw, p, 10))
+               {
+                 xstate_bv |= I386_XSTATE_X87;
+                 memcpy (p, raw, 10);
                }
+             break;
            }
-         else
+       }
+
+      /* Update the corresponding bits in `xstate_bv' if any SSE/AVX
+        registers are changed.  */
+      if (xstate_bv)
+       {
+         /* The supported bits in `xstat_bv' are 1 byte.  */
+         *xstate_bv_p |= (gdb_byte) xstate_bv;
+
+         switch (regclass)
            {
-             /* Return if REGNUM isn't changed.  */
-             if (regclass != all)
-               return;
+           default:
+             internal_error (__FILE__, __LINE__,
+                             _("invalid i387 regclass"));
+
+           case all:
+             break;
+
+           case x87:
+           case sse:
+           case avxh:
+             /* Register REGNUM has been updated.  Return.  */
+             return;
            }
+       }
+      else
+       {
+         /* Return if REGNUM isn't changed.  */
+         if (regclass != all)
+           return;
+       }
     }
 
   /* Only handle x87 control registers.  */
@@ -1113,7 +1116,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
            if (i == I387_FOP_REGNUM (tdep))
              {
                /* The opcode occupies only 11 bits.  Make sure we
-                   don't touch the other bits.  */
+                  don't touch the other bits.  */
                buf[1] &= ((1 << 3) - 1);
                buf[1] |= ((FXSAVE_ADDR (tdep, regs, i))[1] & ~((1 << 3) - 1));
              }
This page took 0.025754 seconds and 4 git commands to generate.