include/opcode/
[binutils-gdb.git] / opcodes / cr16-dis.c
index 724cb9bb89010492aacf3efaa189d181402bde94..de3eb753bf0f39c86aed8a94ee583d256f3ae0b2 100644 (file)
@@ -1,12 +1,12 @@
 /* Disassembler code for CR16.
-   Copyright 2007 Free Software Foundation, Inc.
+   Copyright 2007, 2008 Free Software Foundation, Inc.
    Contributed by M R Swami Reddy (MR.Swami.Reddy@nsc.com).
 
    This file is part of GAS, GDB and the GNU binutils.
 
-   This program is free software; you can redistribute it and/or modify it under
-   the terms of the GNU General Public License as published by the Free
-   Software Foundation; either version 2, or (at your option)
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful, but WITHOUT
@@ -172,7 +172,7 @@ getccstring (unsigned cc)
    string. This routine is used when disassembling the 'cinv' instruction. */
 
 static char *
-getcinvstring (char *str)
+getcinvstring (const char *str)
 {
   const cinv_entry *cinv;
 
@@ -307,6 +307,11 @@ static unsigned long
 build_mask (void)
 {
   unsigned long mask = SBM (instruction->match_bits);
+
+  /* Adjust mask for bcond with 32-bit size instruction.  */
+  if ((IS_INSN_MNEMONIC("b") && instruction->size == 2))
+    mask = 0xff0f0000;
+
   return mask;
 }
 
@@ -799,7 +804,7 @@ print_insn_cr16 (bfd_vma memaddr, struct disassemble_info *info)
   if (is_decoded > 0 && (words[0] << 16 || words[1]) != 0)
     {
       if (strneq (instruction->mnemonic, "cinv", 4))
-        info->fprintf_func (info->stream,"%s", getcinvstring ((char *)instruction->mnemonic));
+        info->fprintf_func (info->stream,"%s", getcinvstring (instruction->mnemonic));
       else
         info->fprintf_func (info->stream, "%s", instruction->mnemonic);