From patchwork Tue Jul 28 09:59:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 7890 Received: (qmail 77099 invoked by alias); 28 Jul 2015 10:00:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 76983 invoked by uid 89); 28 Jul 2015 10:00:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f174.google.com Received: from mail-pd0-f174.google.com (HELO mail-pd0-f174.google.com) (209.85.192.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 28 Jul 2015 10:00:07 +0000 Received: by pdjr16 with SMTP id r16so69488967pdj.3 for ; Tue, 28 Jul 2015 03:00:05 -0700 (PDT) X-Received: by 10.70.1.7 with SMTP id 7mr80214002pdi.38.1438077605695; Tue, 28 Jul 2015 03:00:05 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id fc3sm34350634pab.16.2015.07.28.03.00.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jul 2015 03:00:05 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 3/4] Use regcache->tdesc instead of arm_hwcap Date: Tue, 28 Jul 2015 10:59:51 +0100 Message-Id: <1438077592-15356-4-git-send-email-yao.qi@linaro.org> In-Reply-To: <1438077592-15356-1-git-send-email-yao.qi@linaro.org> References: <1438077592-15356-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes arm_hwcap is a global variable, and we should avoid using it as much as we can. Instead of checking arm_hwcap, we can check whether regcache->tdesc is a certain kind of target description. This is what this patch does. gdb/gdbserver: 2015-07-28 Yao Qi * linux-arm-low.c (arm_fill_wmmxregset): Don't use arm_hwcap. Use regcache->tdesc instead. (arm_store_wmmxregset): Likewise. (arm_fill_vfpregset): Likewise. (arm_store_vfpregset): Likewise. --- gdb/gdbserver/linux-arm-low.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 0a34379..02a1c08 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -185,7 +185,7 @@ arm_fill_wmmxregset (struct regcache *regcache, void *buf) { int i; - if (!(arm_hwcap & HWCAP_IWMMXT)) + if (regcache->tdesc != tdesc_arm_with_iwmmxt) return; for (i = 0; i < 16; i++) @@ -202,7 +202,7 @@ arm_store_wmmxregset (struct regcache *regcache, const void *buf) { int i; - if (!(arm_hwcap & HWCAP_IWMMXT)) + if (regcache->tdesc != tdesc_arm_with_iwmmxt) return; for (i = 0; i < 16; i++) @@ -219,13 +219,13 @@ arm_fill_vfpregset (struct regcache *regcache, void *buf) { int i, num, base; - if (!(arm_hwcap & HWCAP_VFP)) - return; - - if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3) + if (regcache->tdesc == tdesc_arm_with_neon + || regcache->tdesc == tdesc_arm_with_vfpv3) num = 32; - else + else if (regcache->tdesc == tdesc_arm_with_vfpv2) num = 16; + else + return; base = find_regno (regcache->tdesc, "d0"); for (i = 0; i < num; i++) @@ -239,13 +239,13 @@ arm_store_vfpregset (struct regcache *regcache, const void *buf) { int i, num, base; - if (!(arm_hwcap & HWCAP_VFP)) - return; - - if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3) + if (regcache->tdesc == tdesc_arm_with_neon + || regcache->tdesc == tdesc_arm_with_vfpv3) num = 32; - else + else if (regcache->tdesc == tdesc_arm_with_vfpv2) num = 16; + else + return; base = find_regno (regcache->tdesc, "d0"); for (i = 0; i < num; i++)