aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog7
-rw-r--r--opcodes/i386-dis.c12
2 files changed, 15 insertions, 4 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index c57c0b1..f1b4273 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,10 @@
+2020-10-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/26705
+ * i386-dis.c (print_insn): Clear modrm if not needed.
+ (putop): Check need_modrm for modrm.mod != 3. Don't check
+ need_modrm for modrm.mod == 3.
+
2020-09-28 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
* aarch64-opc.c: Added ETMv4 system registers TRCACATRn, TRCACVRn,
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 67d5b6a..f4f35bc 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -9927,7 +9927,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
FETCH_DATA (info, codep + 1);
threebyte = *codep;
dp = &dis386_twobyte[threebyte];
- need_modrm = twobyte_has_modrm[*codep];
+ need_modrm = twobyte_has_modrm[threebyte];
codep++;
}
else
@@ -9954,6 +9954,8 @@ print_insn (bfd_vma pc, disassemble_info *info)
modrm.reg = (*codep >> 3) & 7;
modrm.rm = *codep & 7;
}
+ else
+ memset (&modrm, 0, sizeof (modrm));
need_vex = 0;
memset (&vex, 0, sizeof (vex));
@@ -10644,7 +10646,8 @@ putop (const char *in_template, int sizeflag)
case 'A':
if (intel_syntax)
break;
- if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
+ if ((need_modrm && modrm.mod != 3)
+ || (sizeflag & SUFFIX_ALWAYS))
*obufp++ = 'b';
break;
case 'B':
@@ -10796,7 +10799,7 @@ putop (const char *in_template, int sizeflag)
case 'P':
if (l == 0)
{
- if (((need_modrm && modrm.mod == 3) || !cond)
+ if ((modrm.mod == 3 || !cond)
&& !(sizeflag & SUFFIX_ALWAYS))
break;
/* Fall through. */
@@ -10840,7 +10843,8 @@ putop (const char *in_template, int sizeflag)
if (intel_syntax && !alt)
break;
USED_REX (REX_W);
- if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
+ if ((need_modrm && modrm.mod != 3)
+ || (sizeflag & SUFFIX_ALWAYS))
{
if (rex & REX_W)
*obufp++ = 'q';