From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6169 invoked by alias); 4 Dec 2010 00:42:20 -0000 Received: (qmail 6161 invoked by uid 22791); 4 Dec 2010 00:42:18 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 X-Spam-Check-By: sourceware.org Received: from spoon.guft.org (HELO mail.splitstring.com) (63.224.205.130) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Dec 2010 00:42:13 +0000 Received: (qmail 28655 invoked by uid 210); 4 Dec 2010 00:42:06 -0000 Received: from fluffy.superlucidity.net by spoon (envelope-from , uid 201) with qmail-scanner-2.05st (clamdscan: 0.96.3/12354. spamassassin: 3.3.1. perlscan: 2.05st. Clear:RC:1(63.224.205.132):. Processed in 0.033133 secs); 04 Dec 2010 00:42:06 -0000 Received: from fluffy.superlucidity.net (63.224.205.132) by spoon.guft.org with QMQP; 4 Dec 2010 00:42:06 -0000 From: Zachary T Welch To: binutils@sourceware.org Cc: Zachary T Welch Subject: [PATCH] Decode all ARM unwind instructions in readelf Date: Sat, 04 Dec 2010 00:42:00 -0000 Message-Id: <1291423323-31258-1-git-send-email-zwelch@codesourcery.com> Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00166.txt.bz2 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 * 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