summaryrefslogtreecommitdiff
path: root/opcodes/arm-dis.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-03-06 22:33:47 +0000
committerNick Clifton <nickc@redhat.com>2001-03-06 22:33:47 +0000
commit75c7733ef6a3ac3c0592214ac0f36572695c0ce9 (patch)
tree3e04c0fd5ee3df4d39aff13ae2b24c0d6af6acc9 /opcodes/arm-dis.c
parent2752a5b96e27254507b2bb5289a2f601bea85872 (diff)
downloadgdb-75c7733ef6a3ac3c0592214ac0f36572695c0ce9.tar.gz
Fix BLX(1) for Thumb
Diffstat (limited to 'opcodes/arm-dis.c')
-rw-r--r--opcodes/arm-dis.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 686b18a1a91..0681758de99 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -668,15 +668,32 @@ print_insn_thumb (pc, info, given)
/* Special processing for Thumb 2 instruction BL sequence: */
if (!*c) /* Check for empty (not NULL) assembler string. */
{
+ long offset;
+
info->bytes_per_chunk = 4;
info->bytes_per_line = 4;
+
+ offset = BDISP23 (given);
if ((given & 0x10000000) == 0)
- func (stream, "blx\t");
+ {
+ func (stream, "blx\t");
+
+ /* The spec says that bit 1 of the branch's destination
+ address comes from bit 1 of the instruction's
+ address and not from the offset in the instruction. */
+ if (offset & 0x1)
+ {
+ /* func (stream, "*malformed!* "); */
+ offset &= ~ 0x1;
+ }
+
+ offset |= ((pc & 0x2) >> 1);
+ }
else
- func (stream, "bl\t");
-
- info->print_address_func (BDISP23 (given) * 2 + pc + 4, info);
+ func (stream, "bl\t");
+
+ info->print_address_func (offset * 2 + pc + 4, info);
return 4;
}
else