x86: make I disassembler macro available for new use

Message ID 7a56d450-e91f-b22d-48b8-ac4f113af819@suse.com
State New
Headers show
Series
  • x86: make I disassembler macro available for new use
Related show

Commit Message

Jan Beulich June 25, 2020, 1:08 p.m.
The {Q|Q} construct on lgdt/lidt and the slightly different {Q|IQ}
struck me as odd when encountering. Realizing they both have the same
effect, let's free up the I macro by using the former form of construct
where needed (there aren't that many uses overall).

With there now being several multi-character macros also re-do "alt"
handling slightly: Terminate it when finding the closing brace, rather
than after the next single character. Also set the flag only when
actually in Intel syntax mode.

opcodes/
2020-06-XX  Jan Beulich  <jbeulich@suse.com>

	* i386-dis.c: Adjust description of I macro.
	(x86_64_table): Drop use of I.
	(float_mem): Replace use of I.
	(putop): Remove handling of I. Adjust setting/clearing of "alt".

Comments

Alan Modra via Binutils June 25, 2020, 1:24 p.m. | #1
On Thu, Jun 25, 2020 at 6:08 AM Jan Beulich <jbeulich@suse.com> wrote:
>

> The {Q|Q} construct on lgdt/lidt and the slightly different {Q|IQ}

> struck me as odd when encountering. Realizing they both have the same

> effect, let's free up the I macro by using the former form of construct

> where needed (there aren't that many uses overall).

>

> With there now being several multi-character macros also re-do "alt"

> handling slightly: Terminate it when finding the closing brace, rather

> than after the next single character. Also set the flag only when

> actually in Intel syntax mode.

>

> opcodes/

> 2020-06-XX  Jan Beulich  <jbeulich@suse.com>

>

>         * i386-dis.c: Adjust description of I macro.

>         (x86_64_table): Drop use of I.

>         (float_mem): Replace use of I.

>         (putop): Remove handling of I. Adjust setting/clearing of "alt".

>


OK.

Thanks.

-- 
H.J.

Patch

--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -2250,8 +2250,7 @@  struct dis386 {
    'F' => print 'w' or 'l' depending on address size prefix (loop insns)
    'G' => print 'w' or 'l' depending on operand size prefix (i/o insns)
    'H' => print ",pt" or ",pn" branch hint
-   'I' => honor following macro letter even in Intel mode (implemented only
-	  for some of the macro letters)
+   'I' unused.
    'J' unused.
    'K' => print 'd' or 'q' if rex prefix is present.
    'L' => print 'l' if suffix_always is true
@@ -6918,13 +6917,13 @@  static const struct dis386 x86_64_table[
 
   /* X86_64_0F01_REG_0 */
   {
-    { "sgdt{Q|IQ}", { M }, 0 },
+    { "sgdt{Q|Q}", { M }, 0 },
     { "sgdt", { M }, 0 },
   },
 
   /* X86_64_0F01_REG_1 */
   {
-    { "sidt{Q|IQ}", { M }, 0 },
+    { "sidt{Q|Q}", { M }, 0 },
     { "sidt", { M }, 0 },
   },
 
@@ -12323,9 +12322,9 @@  static const char *float_mem[] = {
   "(bad)",
   "fst{s|}",
   "fstp{s|}",
-  "fldenvIC",
+  "fldenv{C|C}",
   "fldcw",
-  "fNstenvIC",
+  "fNstenv{C|C}",
   "fNstcw",
   /* da */
   "fiadd{l|}",
@@ -12359,9 +12358,9 @@  static const char *float_mem[] = {
   "fisttp{ll|}",
   "fst{l||}",
   "fstp{l|}",
-  "frstorIC",
+  "frstor{C|C}",
   "(bad)",
-  "fNsaveIC",
+  "fNsave{C|C}",
   "fNstsw",
   /* de */
   "fiadd{s|}",
@@ -12735,11 +12734,9 @@  putop (const char *in_template, int size
 	      while (*++p != '|')
 		if (*p == '}' || *p == '\0')
 		  abort ();
+	      alt = 1;
 	    }
-	  /* Fall through.  */
-	case 'I':
-	  alt = 1;
-	  continue;
+	  break;
 	case '|':
 	  while (*++p != '}')
 	    {
@@ -12748,6 +12745,7 @@  putop (const char *in_template, int size
 	    }
 	  break;
 	case '}':
+	  alt = 0;
 	  break;
 	case 'A':
 	  if (intel_syntax)
@@ -13283,7 +13281,6 @@  putop (const char *in_template, int size
 	    }
 	  break;
 	}
-      alt = 0;
     }
   *obufp = 0;
   mnemonicendp = obufp;