From patchwork Mon Apr 28 09:56:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 711 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id 70D3B36007C for ; Mon, 28 Apr 2014 02:56:44 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 1FF03138EB41; Mon, 28 Apr 2014 02:56:44 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id EF6E4138EB0B for ; Mon, 28 Apr 2014 02:56:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=cxavf kJhD6/G06rHSIWjtvzyDndLw/+lcIr+p25l1/I/rkQGXXQrhTUhfzChOYAe9vk4c lrSYW/CnWtwZzI9qqIdDqJQieEOCBMks0Cr/EsM616qKXLoMfasvNvovBxjjTTTS 6j0cN1jCizL+jNAkscqjMO5DGqelzwArUsCZng= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=Z3gdVT59Vjb Ep7Oe5RsQoonLpTo=; b=Y47VJBPWGFHUEcPQBo0o9/DWHYxcEInbkZ9he3wtE5J CTCAm7aXyVIR/gaQVyx+QC1Ym2r+bhEvc0RaI+afHmojCvQA4Ny2KiuokuUDHiIH ARYAXFeDR0yAunFEZGIBpwl5DmsGrbJgAAWyl4JmWk/6QxDorDvxfu77JrxKb4T8 = Received: (qmail 10885 invoked by alias); 28 Apr 2014 09:56: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 10862 invoked by uid 89); 28 Apr 2014 09:56:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp16.uk.ibm.com Received: from e06smtp16.uk.ibm.com (HELO e06smtp16.uk.ibm.com) (195.75.94.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 28 Apr 2014 09:56:41 +0000 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Apr 2014 10:56:38 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 28 Apr 2014 10:56:35 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id BFC5A2190063 for ; Mon, 28 Apr 2014 10:56:26 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s3S9uYnk60031218 for ; Mon, 28 Apr 2014 09:56:34 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s3S9uXap025584 for ; Mon, 28 Apr 2014 03:56:34 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-188.boeblingen.de.ibm.com [9.152.212.188]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s3S9uWFH025504; Mon, 28 Apr 2014 03:56:32 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Richard Henderson Subject: [RFC 15/23] ALPHA Linux: Fill 'collect_regset' in regset structures References: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> Date: Mon, 28 Apr 2014 11:56:32 +0200 In-Reply-To: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> (Andreas Arnez's message of "Mon, 28 Apr 2014 11:35:33 +0200") Message-ID: <87iopt3hgv.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042809-3548-0000-0000-000008E00302 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in 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