Skip to content

Commit

Permalink
target/m68k: correctly disassemble move16
Browse files Browse the repository at this point in the history
"move16 %a0@+,%a1@" and "fmovel (cpid=3) %a0@-,%fpcr"
share the same opcode.

To fix that, backport the fix from binutils:

  2005-11-10  Andreas Schwab  <schwab@suse.de>

     * m68k-dis.c (print_insn_m68k): Only match FPU insns with
     coprocessor ID 1.

Reported-by: Thomas Huth <huth@tuxfamily.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Tested-by: Thomas Huth <huth@tuxfamily.org>
Message-Id: <20180625203559.21370-2-laurent@vivier.eu>
  • Loading branch information
vivier committed Jul 2, 2018
1 parent 281bd28 commit d9345f1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions disas/m68k.c
Expand Up @@ -2017,6 +2017,20 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
}
}

/* Don't match FPU insns with non-default coprocessor ID. */
if (*d == '\0')
{
for (d = opc->args; *d; d += 2)
{
if (d[0] == 'I')
{
val = fetch_arg (buffer, 'd', 3, info);
if (val != 1)
break;
}
}
}

if (*d == '\0')
if ((val = match_insn_m68k (memaddr, info, opc, & priv)))
return val;
Expand Down

0 comments on commit d9345f1

Please sign in to comment.