From patchwork Tue May 26 15:31:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 6921 Received: (qmail 68209 invoked by alias); 26 May 2015 15:31:42 -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 68177 invoked by uid 89); 26 May 2015 15:31:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f51.google.com Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 26 May 2015 15:31:38 +0000 Received: by pacwv17 with SMTP id wv17so95305085pac.2 for ; Tue, 26 May 2015 08:31:36 -0700 (PDT) X-Received: by 10.70.133.170 with SMTP id pd10mr50024224pdb.127.1432654296449; Tue, 26 May 2015 08:31:36 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id mb4sm13433622pdb.63.2015.05.26.08.31.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 May 2015 08:31:35 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 2/2] Remove global variable arm_linux_has_wmmx_registers in arm-linux-nat.c Date: Tue, 26 May 2015 16:31:31 +0100 Message-Id: <1432654291-25436-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1432654291-25436-1-git-send-email-yao.qi@linaro.org> References: <1432654291-25436-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes This patch is to remove the global variable arm_linux_has_wmmx_registers in arm-linux-nat.c, and add a new field have_wmmx_registers in 'struct gdbarch_tdep'. gdb: 2015-05-26 Yao Qi * arm-linux-nat.c (arm_linux_has_wmmx_registers): Remove. (arm_linux_fetch_inferior_registers): Use tdep->have_wmmx_registers instead of arm_linux_has_wmmx_registers. (arm_linux_store_inferior_registers): Likewise. (arm_linux_read_description): Don't set arm_linux_has_wmmx_registers. * arm-tdep.c (arm_gdbarch_init): Set tdep->have_wmmx_registers according target descriptions. * arm-tdep.h (struct gdbarch_tdep) : New field. --- gdb/arm-linux-nat.c | 17 +++++------------ gdb/arm-tdep.c | 4 ++++ gdb/arm-tdep.h | 1 + 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 5c0ede6..7352841 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -61,9 +61,6 @@ #define PTRACE_SETHBPREGS 30 #endif -/* A flag for whether the WMMX registers are available. */ -static int arm_linux_has_wmmx_registers; - extern int arm_apcs_32; /* On GNU/Linux, threads are implemented as pseudo-processes, in which @@ -526,7 +523,7 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops, { fetch_regs (regcache); fetch_fpregs (regcache); - if (arm_linux_has_wmmx_registers) + if (tdep->have_wmmx_registers) fetch_wmmx_regs (regcache); if (tdep->vfp_register_count > 0) fetch_vfp_regs (regcache); @@ -537,7 +534,7 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops, fetch_register (regcache, regno); else if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM) fetch_fpregister (regcache, regno); - else if (arm_linux_has_wmmx_registers + else if (tdep->have_wmmx_registers && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM) fetch_wmmx_regs (regcache); else if (tdep->vfp_register_count > 0 @@ -562,7 +559,7 @@ arm_linux_store_inferior_registers (struct target_ops *ops, { store_regs (regcache); store_fpregs (regcache); - if (arm_linux_has_wmmx_registers) + if (tdep->have_wmmx_registers) store_wmmx_regs (regcache); if (tdep->vfp_register_count > 0) store_vfp_regs (regcache); @@ -573,7 +570,7 @@ arm_linux_store_inferior_registers (struct target_ops *ops, store_register (regcache, regno); else if ((regno >= ARM_F0_REGNUM) && (regno <= ARM_FPS_REGNUM)) store_fpregister (regcache, regno); - else if (arm_linux_has_wmmx_registers + else if (tdep->have_wmmx_registers && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM) store_wmmx_regs (regcache); else if (tdep->vfp_register_count > 0 @@ -636,7 +633,6 @@ static const struct target_desc * arm_linux_read_description (struct target_ops *ops) { CORE_ADDR arm_hwcap = 0; - arm_linux_has_wmmx_registers = 0; if (target_auxv_search (ops, AT_HWCAP, &arm_hwcap) != 1) { @@ -644,10 +640,7 @@ arm_linux_read_description (struct target_ops *ops) } if (arm_hwcap & HWCAP_IWMMXT) - { - arm_linux_has_wmmx_registers = 1; - return tdesc_arm_with_iwmmxt; - } + return tdesc_arm_with_iwmmxt; if (arm_hwcap & HWCAP_VFP) { diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 1d755e5..e451e05 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9915,6 +9915,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) struct tdesc_arch_data *tdesc_data = NULL; int i, is_m = 0; int vfp_register_count = 0, have_vfp_pseudos = 0, have_neon_pseudos = 0; + int have_wmmx_registers = 0; int have_neon = 0; int have_fpa_registers = 1; const struct target_desc *tdesc = info.target_desc; @@ -10178,6 +10179,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdesc_data_cleanup (tdesc_data); return NULL; } + + have_wmmx_registers = 1; } /* If we have a VFP unit, check whether the single precision registers @@ -10289,6 +10292,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->fp_model = fp_model; tdep->is_m = is_m; tdep->have_fpa_registers = have_fpa_registers; + tdep->have_wmmx_registers = have_wmmx_registers; gdb_assert (vfp_register_count == 0 || vfp_register_count == 16 || vfp_register_count == 32); diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h index 06658a0..f81679a 100644 --- a/gdb/arm-tdep.h +++ b/gdb/arm-tdep.h @@ -161,6 +161,7 @@ struct gdbarch_tdep enum arm_float_model fp_model; /* Floating point calling conventions. */ int have_fpa_registers; /* Does the target report the FPA registers? */ + int have_wmmx_registers; /* Does the target report the WMMX registers? */ /* The number of VFP registers reported by the target. It is zero if VFP registers are not supported. */ int vfp_register_count;