X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=opcodes%2Ftic6x-dis.c;h=45a1e98f2a26cb6d57e32e98c5177978beb9d0be;hb=d0801dd8f22a3e739c6a7d126d45829df981794d;hp=e02734059e1cdefaf7e19bdb11beccce90c08a30;hpb=b90efa5b79ac1524ec260f8eb89d1be37e0219a7;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/tic6x-dis.c b/opcodes/tic6x-dis.c index e02734059e..45a1e98f2a 100644 --- a/opcodes/tic6x-dis.c +++ b/opcodes/tic6x-dis.c @@ -1,5 +1,5 @@ /* TI C6X disassembler. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010-2019 Free Software Foundation, Inc. Contributed by Joseph Myers Bernd Schmidt @@ -21,7 +21,7 @@ MA 02110-1301, USA. */ #include "sysdep.h" -#include "dis-asm.h" +#include "disassemble.h" #include "opcode/tic6x.h" #include "libiberty.h" @@ -163,9 +163,9 @@ static unsigned int tic6x_extract_32 (unsigned char *p, struct disassemble_info *info) { if (info->endian == BFD_ENDIAN_LITTLE) - return (p[0]) | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); + return p[0] | (p[1] << 8) | (p[2] << 16) | ((unsigned) p[3] << 24); else - return (p[3]) | (p[2] << 8) | (p[1] << 16) | (p[0] << 24); + return p[3] | (p[2] << 8) | (p[1] << 16) | ((unsigned) p[0] << 24); } /* Extract a 16-bit value read from the instruction stream. */ @@ -249,6 +249,9 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info) fp_offset = addr & 0x1f; fp_addr = addr - fp_offset; + /* Read in a block of instructions. Since there might be a + symbol in the middle of this block, disable stop_vma. */ + info->stop_vma = 0; status = info->read_memory_func (fp_addr, fp, 32, info); if (status) { @@ -313,7 +316,7 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info) const char *parallel; const char *cond = ""; const char *func_unit; - char func_unit_buf[7]; + char func_unit_buf[8]; unsigned int func_unit_side = 0; unsigned int func_unit_data_side = 0; unsigned int func_unit_cross = 0; @@ -507,8 +510,17 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info) prev_header_based = tic6x_check_fetch_packet_header (fp_prev, &prev_header, info); - if (prev_header_based && prev_header.word_compact[6]) - p_bit = prev_header.p_bits[13]; + if (prev_header_based) + { + if (prev_header.word_compact[6]) + p_bit = prev_header.p_bits[13]; + else + { + unsigned int prev_opcode = tic6x_extract_32 (fp_prev + 24, + info); + p_bit = (prev_opcode & 0x1) ? TRUE : FALSE; + } + } else { unsigned int prev_opcode = tic6x_extract_32 (fp_prev + 28, @@ -691,8 +703,9 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info) if (opc->flags & TIC6X_FLAG_INSN16_BSIDE && func_unit_side == 1) func_unit_cross = 1; - snprintf (func_unit_buf, 7, " .%c%u%s%s", func_unit_char, - func_unit_side, (func_unit_cross ? "X" : ""), data_str); + snprintf (func_unit_buf, sizeof func_unit_buf, " .%c%u%s%s", + func_unit_char, func_unit_side, + (func_unit_cross ? "X" : ""), data_str); func_unit = func_unit_buf; } @@ -1072,6 +1085,7 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info) case tic6x_coding_mem_offset_minus_one_noscale: case tic6x_coding_mem_offset_minus_one: fld_val += 1; + /* Fall through. */ case tic6x_coding_mem_offset_noscale: case tic6x_coding_mem_offset: mem_offset = fld_val;