From patchwork Wed Jun 25 16:49:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 1722 Received: (qmail 28588 invoked by alias); 25 Jun 2014 16:49:25 -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 28339 invoked by uid 89); 25 Jun 2014 16:49:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp15.uk.ibm.com Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 25 Jun 2014 16:49:20 +0000 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jun 2014 17:49:17 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Jun 2014 17:49:14 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 33BDF1B08040 for ; Wed, 25 Jun 2014 17:49:46 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5PGnD2v33554532 for ; Wed, 25 Jun 2014 16:49:13 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s5PGnCsO024931 for ; Wed, 25 Jun 2014 10:49:12 -0600 Received: from br87z6lw.boeblingen.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s5PGn9Gu024835; Wed, 25 Jun 2014 10:49:11 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Richard Henderson Subject: [PATCH v2 05/13] ALPHA Linux: Fill 'collect_regset' in regset structures. Date: Wed, 25 Jun 2014 18:49:01 +0200 Message-Id: <1403714949-28133-6-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1403714949-28133-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1403714949-28133-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14062516-0342-0000-0000-0000003C0D97 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