From patchwork Mon May 26 16:36:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 1154 Received: (qmail 7225 invoked by alias); 26 May 2014 16:37:02 -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 7032 invoked by uid 89); 26 May 2014 16:37:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp10.uk.ibm.com Received: from e06smtp10.uk.ibm.com (HELO e06smtp10.uk.ibm.com) (195.75.94.106) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 26 May 2014 16:36:57 +0000 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 May 2014 17:36:54 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 26 May 2014 17:36:51 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1AAD01B0804B for ; Mon, 26 May 2014 17:37:11 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4QGapDO1245544 for ; Mon, 26 May 2014 16:36:51 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s4QGapED021384 for ; Mon, 26 May 2014 10:36:51 -0600 Received: from br87z6lw.ibm.com (sig-9-78-93-212.uk.ibm.com [9.78.93.212]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s4QGanit021342; Mon, 26 May 2014 10:36:50 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Richard Henderson Subject: [PATCH 04/12] ALPHA Linux: Fill 'collect_regset' in regset structures. Date: Mon, 26 May 2014 18:36:40 +0200 Message-Id: <1401122208-2481-5-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1401122208-2481-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1401122208-2481-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14052616-4966-0000-0000-000000289789 X-IsSubscribed: yes gdb/ * alpha-linux-tdep.c (alpha_linux_supply_gregset): Replace logic by call to alpha_supply_int_regs. (alpha_linux_collect_gregset): New function. (alpha_linux_supply_fpregset): Replace logic by call to alpha_supply_fp_regs. (alpha_linux_collect_fpregset): New function. (alpha_linux_gregset, alpha_linux_fpregset): Add collect method. --- gdb/alpha-linux-tdep.c | 56 +++++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c index 52f19d0..51bce4f 100644 --- a/gdb/alpha-linux-tdep.c +++ b/gdb/alpha-linux-tdep.c @@ -166,21 +166,27 @@ alpha_linux_supply_gregset (const struct regset *regset, int regnum, const void *gregs, size_t len) { const gdb_byte *regs = gregs; - int i; + gdb_assert (len >= 32 * 8); + alpha_supply_int_regs (regcache, regnum, regs, regs + 31 * 8, + len >= 33 * 8 ? regs + 32 * 8 : NULL); +} - for (i = 0; i < ALPHA_ZERO_REGNUM; i++) - { - if (regnum == i || regnum == -1) - regcache_raw_supply (regcache, i, regs + i * 8); - } +/* Collect register REGNUM from the register cache REGCACHE and store + it in the buffer specified by GREGS and LEN as described by the + general-purpose register set REGSET. If REGNUM is -1, do this for + all registers in REGSET. */ - if (regnum == ALPHA_PC_REGNUM || regnum == -1) - regcache_raw_supply (regcache, ALPHA_PC_REGNUM, regs + 31 * 8); +static void +alpha_linux_collect_gregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *gregs, size_t len) +{ + gdb_byte *regs = gregs; - if (regnum == ALPHA_UNIQUE_REGNUM || regnum == -1) - regcache_raw_supply (regcache, ALPHA_UNIQUE_REGNUM, - len >= 33 * 8 ? regs + 32 * 8 : NULL); + gdb_assert (len >= 32 * 8); + alpha_fill_int_regs (regcache, regnum, regs, regs + 31 * 8, + len >= 33 * 8 ? regs + 32 * 8 : NULL); } /* Supply register REGNUM from the buffer specified by FPREGS and LEN @@ -193,29 +199,37 @@ alpha_linux_supply_fpregset (const struct regset *regset, int regnum, const void *fpregs, size_t len) { const gdb_byte *regs = fpregs; - int i; + gdb_assert (len >= 32 * 8); + alpha_supply_fp_regs (regcache, regnum, regs, regs + 31 * 8); +} - for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; i++) - { - if (regnum == i || regnum == -1) - regcache_raw_supply (regcache, i, regs + (i - ALPHA_FP0_REGNUM) * 8); - } +/* Collect register REGNUM from the register cache REGCACHE and store + it in the buffer specified by FPREGS and LEN as described by the + general-purpose register set REGSET. If REGNUM is -1, do this for + all registers in REGSET. */ - if (regnum == ALPHA_FPCR_REGNUM || regnum == -1) - regcache_raw_supply (regcache, ALPHA_FPCR_REGNUM, regs + 31 * 8); +static void +alpha_linux_collect_fpregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *fpregs, size_t len) +{ + gdb_byte *regs = fpregs; + + gdb_assert (len >= 32 * 8); + alpha_fill_fp_regs (regcache, regnum, regs, regs + 31 * 8); } static const struct regset alpha_linux_gregset = { NULL, - alpha_linux_supply_gregset + alpha_linux_supply_gregset, alpha_linux_collect_gregset }; static const struct regset alpha_linux_fpregset = { NULL, - alpha_linux_supply_fpregset + alpha_linux_supply_fpregset, alpha_linux_collect_fpregset }; /* Return the appropriate register set for the core section identified