From: Zachary T Welch <zwelch@codesourcery.com>
To: binutils@sourceware.org
Cc: Zachary T Welch <zwelch@codesourcery.com>
Subject: [PATCH] Decode all ARM unwind instructions in readelf
Date: Sat, 04 Dec 2010 00:42:00 -0000 [thread overview]
Message-ID: <1291423323-31258-1-git-send-email-zwelch@codesourcery.com> (raw)
This patch implements decoding of all remaining unwind instructions
specified by the Exception Handling ABI for ARM Architecture (IHI 0038A).
Implements decoding of ARM unwind instructions for ARM VFP/NEON (D0-D31)
and Intel Wireless MMX registers (wR0-wR15, wCGR0-wCGR4). All remaining
encodings are specified by the ARM ABI as spare or reserved instructions.
2010-12-03 Zachary T Welch <zwelch@codesourcery.com>
* readelf.c (decode_arm_unwind): Implement decoding of remaining
ARM unwind instructions (i.e. VFP/NEON and Intel Wireless MMX).
---
binutils/readelf.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index e34d6c4..2fcca13 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -6559,18 +6559,71 @@ decode_arm_unwind (struct arm_unw_aux_info *aux,
offset = offset * 4 + 0x204;
printf ("vsp = vsp + %ld", offset);
}
- else
+ else if (op == 0xb3 || op == 0xc8 || op == 0xc9)
{
- if (op == 0xb3 || op == 0xc6 || op == 0xc7 || op == 0xc8 || op == 0xc9)
- {
- GET_OP (op2);
- printf (_("[unsupported two-byte opcode]"));
- }
+ unsigned int first, last;
+ GET_OP (op2);
+ first = op2 >> 4;
+ last = op2 & 0x0f;
+ if (op == 0xc8)
+ first = first + 16;
+ printf ("pop {D%d", first);
+ if (last)
+ printf ("-D%d", first + last);
+ printf ("}");
+ }
+ else if ((op & 0xf8) == 0xb8 || (op & 0xf8) == 0xd0)
+ {
+ unsigned int count = op & 0x07;
+ printf ("pop {D8");
+ if (count)
+ printf ("-D%d", 8 + count);
+ printf ("}");
+ }
+ else if (op >= 0xc0 && op <= 0xc5)
+ {
+ unsigned int count = op & 0x07;
+ printf (" pop {wR10");
+ if (count)
+ printf ("-wR%d", 10 + count);
+ printf ("}");
+ }
+ else if (op == 0xc6)
+ {
+ unsigned int first, last;
+ GET_OP (op2);
+ first = op2 >> 4;
+ last = op2 & 0x0f;
+ printf ("pop {wR%d", first);
+ if (last)
+ printf ("-wR%d", first + last);
+ printf ("}");
+ }
+ else if (op == 0xc7)
+ {
+ GET_OP (op2);
+ if (op2 == 0 || (op2 & 0xf0) != 0)
+ printf (_("[Spare]"));
else
{
- printf (_(" [unsupported opcode]"));
+ unsigned int mask = op2 & 0x0f;
+ int first = 1;
+ int i;
+ printf ("pop {");
+ for (i = 0; i < 4; i++)
+ if (mask & (1 << i))
+ {
+ if (first)
+ first = 0;
+ else
+ printf (", ");
+ printf ("wCGR%d", i);
+ }
+ printf ("}");
}
}
+ else
+ printf (_(" [unsupported opcode]"));
printf ("\n");
}
--
1.7.1
next reply other threads:[~2010-12-04 0:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-04 0:42 Zachary T Welch [this message]
2010-12-30 17:28 ` Zach Welch
2011-01-06 10:31 ` Nick Clifton
2011-02-23 18:42 ` Zach Welch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291423323-31258-1-git-send-email-zwelch@codesourcery.com \
--to=zwelch@codesourcery.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).