X-Git-Url: https://oss.titaniummirror.com/gitweb?p=msp430-binutils.git;a=blobdiff_plain;f=opcodes%2Fcr16-dis.c;fp=opcodes%2Fcr16-dis.c;h=3a31d926b95332080c10dd4bbb84c160b5876f7b;hp=ad0c586f5d38674427840cb94ba1484af4689a23;hb=88750007d7869f178f0ba528f41efd3b74c424cf;hpb=6df9443a374e2b81278c61b8afc0a1eef7db280b diff --git a/opcodes/cr16-dis.c b/opcodes/cr16-dis.c index ad0c586..3a31d92 100644 --- a/opcodes/cr16-dis.c +++ b/opcodes/cr16-dis.c @@ -1,5 +1,5 @@ /* Disassembler code for CR16. - Copyright 2007 Free Software Foundation, Inc. + Copyright 2007, 2008, 2009 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. @@ -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; } @@ -317,7 +322,7 @@ match_opcode (void) { unsigned long mask; /* The instruction 'constant' opcode doewsn't exceed 32 bits. */ - unsigned long doubleWord = words[1] + (words[0] << 16); + unsigned long doubleWord = (words[1] + (words[0] << 16)) & 0xffffffff; /* Start searching from end of instruction table. */ instruction = &cr16_instruction[NUMOPCODES - 2]; @@ -326,6 +331,10 @@ match_opcode (void) while (instruction >= cr16_instruction) { mask = build_mask (); + /* Adjust mask for bcond with 32-bit size instruction */ + if ((IS_INSN_MNEMONIC("b") && instruction->size == 2)) + mask = 0xff0f0000; + if ((doubleWord & mask) == BIN (instruction->match, instruction->match_bits)) return 1; @@ -669,7 +678,9 @@ print_arg (argument *a, bfd_vma memaddr, struct disassemble_info *info) if ((!IS_INSN_TYPE (CSTBIT_INS)) && (!IS_INSN_TYPE (LD_STOR_INS))) (sign_flag) ? func (stream, "%s", "*-"): func (stream, "%s","*+"); - func (stream, "%s", "0x"); + /* PR 10173: Avoid printing the 0x prefix twice. */ + if (info->num_symbols > 0) + func (stream, "%s", "0x"); number = ((relative ? memaddr : 0) + (sign_flag ? ((- a->constant) & 0xffffffe) : a->constant));