X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Fcris-dis.c;h=64e55e239ab0f9a0f22f46a1fecbf434aa96b1cf;hb=bd2e25575ca4a83f509c2d6ea3c55d93eada210c;hp=3d248b74b75ab6b9d6b6a7cf0f9e8ff39bb94289;hpb=0fd3a4776c8f607cc778cde80f9215089d36387e;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/cris-dis.c b/opcodes/cris-dis.c index 3d248b74b7..64e55e239a 100644 --- a/opcodes/cris-dis.c +++ b/opcodes/cris-dis.c @@ -1,19 +1,20 @@ /* Disassembler code for CRIS. - Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. Contributed by Axis Communications AB, Lund, Sweden. Written by Hans-Peter Nilsson. - This file is part of the GNU binutils and GDB, the GNU debugger. + This file is part of the GNU opcodes library. - 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) any later - version. + This library 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 - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software @@ -651,7 +652,8 @@ format_sup_reg (unsigned int regno, static unsigned bytes_to_skip (unsigned int insn, const struct cris_opcode *matchedp, - enum cris_disass_family distype) + enum cris_disass_family distype, + const struct cris_opcode *prefix_matchedp) { /* Each insn is a word plus "immediate" operands. */ unsigned to_skip = 2; @@ -660,7 +662,8 @@ bytes_to_skip (unsigned int insn, for (s = template; *s; s++) if ((*s == 's' || *s == 'N' || *s == 'Y') - && (insn & 0x400) && (insn & 15) == 15) + && (insn & 0x400) && (insn & 15) == 15 + && prefix_matchedp == NULL) { /* Immediate via [pc+], so we have to check the size of the operand. */ @@ -781,7 +784,7 @@ print_with_operands (const struct cris_opcode *opcodep, better way). */ if (opcodep->name[0] == 'j') { - if (strncmp (opcodep->name, "jsr", 3) == 0) + if (CONST_STRNEQ (opcodep->name, "jsr")) /* It's "jsr" or "jsrc". */ info->insn_type = dis_jsr; else @@ -880,7 +883,7 @@ print_with_operands (const struct cris_opcode *opcodep, case 'S': case 's': /* Any "normal" memory operand. */ - if ((insn & 0x400) && (insn & 15) == 15) + if ((insn & 0x400) && (insn & 15) == 15 && prefix_opcodep == NULL) { /* We're looking at [pc+], i.e. we need to output an immediate number, where the size can depend on different things. */ @@ -1358,16 +1361,16 @@ print_with_operands (const struct cris_opcode *opcodep, itself or in a "move.d const,rN, sub.d rN,rM"-like sequence. */ if (TRACE_CASE && case_offset_counter == 0) { - if (strncmp (opcodep->name, "sub", 3) == 0) + if (CONST_STRNEQ (opcodep->name, "sub")) case_offset = last_immediate; /* It could also be an "add", if there are negative case-values. */ - else if (strncmp (opcodep->name, "add", 3) == 0) + else if (CONST_STRNEQ (opcodep->name, "add")) /* The first case is the negated operand to the add. */ case_offset = -last_immediate; /* A bound insn will tell us the number of cases. */ - else if (strncmp (opcodep->name, "bound", 5) == 0) + else if (CONST_STRNEQ (opcodep->name, "bound")) no_of_case_offsets = last_immediate + 1; /* A jump or jsr or branch breaks the chain of insns for a @@ -1495,7 +1498,7 @@ print_insn_cris_generic (bfd_vma memaddr, /* If it's a prefix, put it into the prefix vars and get the main insn. */ prefix_size = bytes_to_skip (prefix_insn, matchedp, - disdata->distype); + disdata->distype, NULL); prefix_opcodep = matchedp; insn = bufp[prefix_size] + bufp[prefix_size + 1] * 256; @@ -1527,7 +1530,9 @@ print_insn_cris_generic (bfd_vma memaddr, } else { - advance += bytes_to_skip (insn, matchedp, disdata->distype); + advance + += bytes_to_skip (insn, matchedp, disdata->distype, + prefix_opcodep); /* The info_type and assorted fields will be set according to the operands. */