summary refs log tree commit diff stats
path: root/disas/m68k.c
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2018-06-25 22:35:59 +0200
committerLaurent Vivier <laurent@vivier.eu>2018-07-02 12:02:00 +0200
commitd9345f1e1b1936b9ed7026b83091cf701f7ce07e (patch)
tree036f38274edcecdd5a7f03efe65fcd23e92b6099 /disas/m68k.c
parent281bd281222776229d5dbf84d1a5c6d8d9d2a34b (diff)
downloadfocaccia-qemu-d9345f1e1b1936b9ed7026b83091cf701f7ce07e.tar.gz
focaccia-qemu-d9345f1e1b1936b9ed7026b83091cf701f7ce07e.zip
target/m68k: correctly disassemble move16
"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>
Diffstat (limited to 'disas/m68k.c')
-rw-r--r--disas/m68k.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/disas/m68k.c b/disas/m68k.c
index 61b689ef3e..a687df437c 100644
--- a/disas/m68k.c
+++ b/disas/m68k.c
@@ -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;