gdb/testsuite/
[binutils-gdb.git] / opcodes / i386-dis.c
index 34dcd103fb10a1f5a4168188c90075495ae3f851..fef9185e5f20e3b64d3c2a9b582d9e217391bb14 100644 (file)
@@ -1,6 +1,6 @@
 /* Print i386 instructions for GDB, the GNU debugger.
    Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
@@ -114,7 +114,6 @@ static void CRC32_Fixup (int, int);
 static void FXSAVE_Fixup (int, int);
 static void OP_LWPCB_E (int, int);
 static void OP_LWP_E (int, int);
-static void OP_LWP_I (int, int);
 static void OP_Vex_2src_1 (int, int);
 static void OP_Vex_2src_2 (int, int);
 
@@ -2744,8 +2743,8 @@ static const struct dis386 reg_table[][8] = {
   },
   /* REG_XOP_LWP */
   {
-    { "lwpins", { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
-    { "lwpval",        { { OP_LWP_E, 0 }, Ed, { OP_LWP_I, 0 } } },
+    { "lwpins", { { OP_LWP_E, 0 }, Ed, Iq } },
+    { "lwpval",        { { OP_LWP_E, 0 }, Ed, Iq } },
   },
 };
 
@@ -11059,7 +11058,8 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
       switch ((*codep & 0x1f))
        {
        default:
-         BadOp ();
+         dp = &bad_opcode;
+         return dp;
        case 0x8:
          vex_table_index = XOP_08;
          break;
@@ -11078,7 +11078,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
       vex.register_specifier = (~(*codep >> 3)) & 0xf;
       if (address_mode != mode_64bit
          && vex.register_specifier > 0x7)
-       BadOp ();
+       {
+         dp = &bad_opcode;
+         return dp;
+       }
 
       vex.length = (*codep & 0x4) ? 256 : 128;
       switch ((*codep & 0x3))
@@ -11116,7 +11119,8 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
       switch ((*codep & 0x1f))
        {
        default:
-         BadOp ();
+         dp = &bad_opcode;
+         return dp;
        case 0x1:
          vex_table_index = VEX_0F;
          break;
@@ -11135,7 +11139,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
       vex.register_specifier = (~(*codep >> 3)) & 0xf;
       if (address_mode != mode_64bit
          && vex.register_specifier > 0x7)
-       BadOp ();
+       {
+         dp = &bad_opcode;
+         return dp;
+       }
 
       vex.length = (*codep & 0x4) ? 256 : 128;
       switch ((*codep & 0x3))
@@ -11177,7 +11184,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
       vex.register_specifier = (~(*codep >> 3)) & 0xf;
       if (address_mode != mode_64bit
          && vex.register_specifier > 0x7)
-       BadOp ();
+       {
+         dp = &bad_opcode;
+         return dp;
+       }
 
       vex.w = 0;
 
@@ -11243,7 +11253,6 @@ print_insn (bfd_vma pc, disassemble_info *info)
   int sizeflag;
   const char *p;
   struct dis_private priv;
-  unsigned char op;
   int prefix_length;
   int default_prefixes;
 
@@ -11448,8 +11457,6 @@ print_insn (bfd_vma pc, disassemble_info *info)
       return 1;
     }
 
-  op = 0;
-
   if (*codep == 0x0f)
     {
       unsigned char threebyte;
@@ -13533,7 +13540,6 @@ static void
 OP_sI (int bytemode, int sizeflag)
 {
   bfd_signed_vma op;
-  bfd_signed_vma mask = -1;
 
   switch (bytemode)
     {
@@ -13542,7 +13548,6 @@ OP_sI (int bytemode, int sizeflag)
       op = *codep++;
       if ((op & 0x80) != 0)
        op -= 0x100;
-      mask = 0xffffffff;
       break;
     case v_mode:
       USED_REX (REX_W);
@@ -13553,11 +13558,9 @@ OP_sI (int bytemode, int sizeflag)
          if (sizeflag & DFLAG)
            {
              op = get32s ();
-             mask = 0xffffffff;
            }
          else
            {
-             mask = 0xffffffff;
              op = get16 ();
              if ((op & 0x8000) != 0)
                op -= 0x10000;
@@ -13567,7 +13570,6 @@ OP_sI (int bytemode, int sizeflag)
       break;
     case w_mode:
       op = get16 ();
-      mask = 0xffffffff;
       if ((op & 0x8000) != 0)
        op -= 0x10000;
       break;
@@ -14977,10 +14979,8 @@ OP_LWPCB_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
 
   if (vex.w)
     names = names64;
-  else if (vex.length == 256)
-    names = names32;
   else
-    names = names16;
+    names = names32;
 
   reg = modrm.rm;
   USED_REX (REX_B);
@@ -14997,20 +14997,9 @@ OP_LWP_E (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
 
   if (vex.w)
     names = names64;
-  else if (vex.length == 256)
-    names = names32;
   else
-    names = names16;
+    names = names32;
 
   oappend (names[vex.register_specifier]);
 }
 
-static void
-OP_LWP_I (int bytemode ATTRIBUTE_UNUSED, int sizeflag)
-{
-  if (vex.w || vex.length == 256)
-    OP_I (q_mode, sizeflag);
-  else
-    OP_I (w_mode, sizeflag);
-}
-