aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-06-03 12:03:09 +0930
committerAlan Modra <amodra@gmail.com>2021-06-03 13:05:57 +0930
commita38d139645fe557563c3c513b9175e07ceb5f5f8 (patch)
treefaaa1bca3ca9dae09e76d8ae0241c6f857c8d838 /opcodes
parent9ef5bfdad99255158b5911b098ebcf5788f6ea64 (diff)
downloadfsf-binutils-gdb-a38d139645fe557563c3c513b9175e07ceb5f5f8.zip
fsf-binutils-gdb-a38d139645fe557563c3c513b9175e07ceb5f5f8.tar.gz
fsf-binutils-gdb-a38d139645fe557563c3c513b9175e07ceb5f5f8.tar.bz2
PR1202, mcore disassembler: wrong address loopt
Fixes a 16 year old bug report, which even came with a patch. opcodes/ PR 1202 * mcore-dis.c (print_insn_mcore): Correct loopt disassembly. Use unsigned int for inst. gas/ PR 1202 * testsuite/gas/mcore/allinsn.d: Correct loopt expected output.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog6
-rw-r--r--opcodes/mcore-dis.c8
2 files changed, 10 insertions, 4 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index fc3dd08..6419ee8 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2021-06-03 Alan Modra <amodra@gmail.com>
+
+ PR 1202
+ * mcore-dis.c (print_insn_mcore): Correct loopt disassembly.
+ Use unsigned int for inst.
+
2021-06-02 Shahab Vahedi <shahab@synopsys.com>
* arc-dis.c (arc_option_arg_t): New enumeration.
diff --git a/opcodes/mcore-dis.c b/opcodes/mcore-dis.c
index 0ee2e60..c359ee0 100644
--- a/opcodes/mcore-dis.c
+++ b/opcodes/mcore-dis.c
@@ -95,7 +95,7 @@ print_insn_mcore (bfd_vma memaddr,
unsigned char ibytes[4];
fprintf_ftype print_func = info->fprintf_func;
void *stream = info->stream;
- unsigned short inst;
+ unsigned int inst;
unsigned int i;
int status;
@@ -215,10 +215,10 @@ print_insn_mcore (bfd_vma memaddr,
case BL:
{
- uint32_t val = inst & 0x000F;
+ uint32_t val = memaddr + 2 + ((inst | ~0xF) << 1);
+
(*print_func) (stream, "\t%s, 0x%x",
- grname[(inst >> 4) & 0xF],
- (uint32_t) (memaddr - (val << 1)));
+ grname[(inst >> 4) & 0xF], val);
}
break;