X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=opcodes%2Fcris-dis.c;h=8f2a77700c48a065dd26d4304ed7625ff507372f;hb=bb651e8b7fc7904b06031a665138e9e6ae79adf3;hp=64e55e239ab0f9a0f22f46a1fecbf434aa96b1cf;hpb=9b201bb5e5daa9b4f783e6ece9cbfbdbf9f1d6f4;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/cris-dis.c b/opcodes/cris-dis.c index 64e55e239a..8f2a77700c 100644 --- a/opcodes/cris-dis.c +++ b/opcodes/cris-dis.c @@ -1,6 +1,5 @@ /* Disassembler code for CRIS. - Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. Contributed by Axis Communications AB, Lund, Sweden. Written by Hans-Peter Nilsson. @@ -21,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "dis-asm.h" #include "sysdep.h" +#include "dis-asm.h" #include "opcode/cris.h" #include "libiberty.h" @@ -581,7 +580,10 @@ static char * format_dec (long number, char *outbuffer, int signedp) { last_immediate = number; - sprintf (outbuffer, signedp ? "%ld" : "%lu", number); + if (signedp) + sprintf (outbuffer, "%ld", number); + else + sprintf (outbuffer, "%lu", (unsigned long) number); return outbuffer + strlen (outbuffer); } @@ -657,17 +659,17 @@ bytes_to_skip (unsigned int insn, { /* Each insn is a word plus "immediate" operands. */ unsigned to_skip = 2; - const char *template = matchedp->args; + const char *template_name = (const char *) matchedp->args; const char *s; - for (s = template; *s; s++) + for (s = template_name; *s; s++) if ((*s == 's' || *s == 'N' || *s == 'Y') && (insn & 0x400) && (insn & 15) == 15 && prefix_matchedp == NULL) { /* Immediate via [pc+], so we have to check the size of the operand. */ - int mode_size = 1 << ((insn >> 4) & (*template == 'z' ? 1 : 3)); + int mode_size = 1 << ((insn >> 4) & (*template_name == 'z' ? 1 : 3)); if (matchedp->imm_oprnd_size == SIZE_FIX_32) to_skip += 4; @@ -811,7 +813,7 @@ print_with_operands (const struct cris_opcode *opcodep, *tp++ = 'c'; *tp++ = 'r'; break; - + case '[': case ']': case ',': @@ -848,9 +850,8 @@ print_with_operands (const struct cris_opcode *opcodep, case 'n': { /* Like N but pc-relative to the start of the insn. */ - unsigned long number - = (buffer[2] + buffer[3] * 256 + buffer[4] * 65536 - + buffer[5] * 0x1000000 + addr); + int32_t number = (buffer[2] + buffer[3] * 256 + buffer[4] * 65536 + + buffer[5] * 0x1000000u); /* Finish off and output previous formatted bytes. */ *tp = 0; @@ -858,14 +859,14 @@ print_with_operands (const struct cris_opcode *opcodep, (*info->fprintf_func) (info->stream, "%s", temp); tp = temp; - (*info->print_address_func) ((bfd_vma) number, info); + (*info->print_address_func) (addr + number, info); } break; case 'u': { /* Like n but the offset is bits <3:0> in the instruction. */ - unsigned long number = (buffer[0] & 0xf) * 2 + addr; + unsigned int number = (buffer[0] & 0xf) * 2; /* Finish off and output previous formatted bytes. */ *tp = 0; @@ -873,7 +874,7 @@ print_with_operands (const struct cris_opcode *opcodep, (*info->fprintf_func) (info->stream, "%s", temp); tp = temp; - (*info->print_address_func) ((bfd_vma) number, info); + (*info->print_address_func) (addr + number, info); } break; @@ -887,7 +888,7 @@ print_with_operands (const struct cris_opcode *opcodep, { /* We're looking at [pc+], i.e. we need to output an immediate number, where the size can depend on different things. */ - long number; + int32_t number; int signedp = ((*cs == 'z' && (insn & 0x20)) || opcodep->match == BDAP_QUICK_OPCODE); @@ -938,9 +939,8 @@ print_with_operands (const struct cris_opcode *opcodep, break; case 4: - number - = buffer[2] + buffer[3] * 256 + buffer[4] * 65536 - + buffer[5] * 0x1000000; + number = (buffer[2] + buffer[3] * 256 + buffer[4] * 65536 + + buffer[5] * 0x1000000u); break; default: @@ -1040,10 +1040,10 @@ print_with_operands (const struct cris_opcode *opcodep, { /* It's [pc+]. This cannot possibly be anything but an address. */ - unsigned long number - = prefix_buffer[2] + prefix_buffer[3] * 256 - + prefix_buffer[4] * 65536 - + prefix_buffer[5] * 0x1000000; + int32_t number = (prefix_buffer[2] + + prefix_buffer[3] * 256 + + prefix_buffer[4] * 65536 + + prefix_buffer[5] * 0x1000000u); info->target = (bfd_vma) number; @@ -1129,7 +1129,7 @@ print_with_operands (const struct cris_opcode *opcodep, if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15) { - long number; + int32_t number; unsigned int nbytes; /* It's a value. Get its size. */ @@ -1155,10 +1155,9 @@ print_with_operands (const struct cris_opcode *opcodep, break; case 4: - number - = prefix_buffer[2] + prefix_buffer[3] * 256 - + prefix_buffer[4] * 65536 - + prefix_buffer[5] * 0x1000000; + number = (prefix_buffer[2] + prefix_buffer[3] * 256 + + prefix_buffer[4] * 65536 + + prefix_buffer[5] * 0x1000000u); break; default: