From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41076 invoked by alias); 16 May 2018 14:04:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 40298 invoked by uid 89); 16 May 2018 14:04:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=associates, areas X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 May 2018 14:04:11 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4GDuWGY136357 for ; Wed, 16 May 2018 10:04:09 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j0n28ke8p-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 16 May 2018 10:04:08 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 16 May 2018 15:04:06 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 16 May 2018 15:04:05 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4GE44b14653368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 May 2018 14:04:04 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 99BEF11C050; Wed, 16 May 2018 14:55:19 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81EF311C05C; Wed, 16 May 2018 14:55:19 +0100 (BST) Received: from oc3748833570.ibm.com (unknown [9.152.213.77]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 16 May 2018 14:55:19 +0100 (BST) Received: by oc3748833570.ibm.com (Postfix, from userid 1000) id C603FD80322; Wed, 16 May 2018 16:04:03 +0200 (CEST) Subject: Re: [PATCH 5/8] [PowerPC] Fix access to VSCR in linux targets To: pedromfc@linux.vnet.ibm.com (Pedro Franco de Carvalho) Date: Wed, 16 May 2018 14:06:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20180510195840.17734-6-pedromfc@linux.vnet.ibm.com> from "Pedro Franco de Carvalho" at May 10, 2018 04:58:37 PM MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18051614-0044-0000-0000-0000055317DE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051614-0045-0000-0000-000028948624 Message-Id: <20180516140403.C603FD80322@oc3748833570.ibm.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-16_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805160141 X-SW-Source: 2018-05/txt/msg00335.txt.bz2 Pedro Franco de Carvalho wrote: > gdb/ChangeLog: > yyyy-mm-dd Pedro Franco de Carvalho > > * ppc-linux-tdep.c (ppc_linux_collect_vrregset): New function. > (ppc_linux_vrregset) : New function. > (ppc32_le_linux_vrregmap, ppc32_be_linux_vrregmap) > (ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): New globals. > (ppc32_linux_vrregset): Remove. > (ppc_linux_iterate_over_regset_sections): Call ppc_linux_vrregset > and use result instead of ppc32_linux_vrregset. > * ppc-linux-tdep.h (ppc_linux_vrregset): New declaration. > * ppc-linux-nat.c: Include regset.h. > (gdb_vrregset_t): Adjust comment to account for little-endian > mode. > (supply_vrregset, fill_vrregset): Remove. > (fetch_altivec_register, store_altivec_register): Remove. > (fetch_altivec_registers): Add regno parameter. Get regset using > ppc_linux_vrregset. Use regset to supply registers. > (store_altivec_registers): Add regno parameter. Get regset using > ppc_linux_vrregset. Use regset to collect registers. > (fetch_register): Call fetch_altivec_registers instead of > fetch_altivec_register. > (store_register): Call store_altivec_registers instead of > store_altivec_register. > (fetch_ppc_registers): Call fetch_altivec_registers with -1 for > the new regno parameter. > (store_ppc_registers): Call store_altivec_registers with -1 for > the new regno parameter. > > gdb/gdbserver/ChangeLog: > yyyy-mm-dd Pedro Franco de Carvalho > > * linux-ppc-low.c (ppc_fill_vrregset): Add vscr_offset variable. > Set vscr_offset to 0 in little-endian mode and 12 in big-endian > mode. Call collect_register_by_name with vscr using > vscr_offset. Zero-pad vscr and vrsave fields in collector buffer. > (ppc_store_vrregset): Add and set vscr_offset variable as in > ppc_fill_vrregset. Call supply_register_by_name with vscr using > vscr_offset. I agree with the general direction of this patch. A few comments: > + vrregset->supply_regset(vrregset, regcache, regno, ®s, > + PPC_LINUX_SIZEOF_VRREGSET); Formatting (space before '('). > +static void > +ppc_linux_collect_vrregset (const struct regset *regset, > + const struct regcache *regcache, > + int regnum, void *buf, size_t len) > +{ > + gdb_byte *vrregs = (gdb_byte *) buf; > + > + /* Zero-pad the unused bytes in the fields for vscr and vrsave > + in case they get displayed somewhere (e.g. in core files). */ > + if (regnum == PPC_VSCR_REGNUM || regnum == -1) > + memset (&vrregs[32 * 16], 0, 16); > + > + if (regnum == PPC_VRSAVE_REGNUM || regnum == -1) > + memset (&vrregs[33 * 16], 0, 16); > + > + regcache_collect_regset (regset, regcache, regnum, buf, len); > +} I'm wondering if we shouldn't have the common regcache_collect_regset routine zero out areas covered by REGCACHE_MAP_SKIP? Then we wouldn't need this extra routine here. > -static const struct regset ppc32_linux_vrregset = { > - &ppc32_linux_reg_offsets, > - ppc_supply_vrregset, > - ppc_collect_vrregset This removes all users of ppc_supply_vrregset / ppc_collect_vrregset, right? Then those functions should go away as well, together with all their associates data, in particular the v*_offset fields in struct ppc_reg_offsets ... > +static const struct regcache_map_entry ppc32_le_linux_vrregmap[] = > + { > + { 32, PPC_VR0_REGNUM, 16 }, > + { 1, PPC_VSCR_REGNUM, 16 }, > + { 1, PPC_VRSAVE_REGNUM, 16 }, > + { 0 } > + }; > + > +static const struct regcache_map_entry ppc32_be_linux_vrregmap[] = > + { > + { 32, PPC_VR0_REGNUM, 16 }, > + { 1, REGCACHE_MAP_SKIP, 12}, > + { 1, PPC_VSCR_REGNUM, 4 }, > + { 1, PPC_VRSAVE_REGNUM, 16 }, > + { 0 } > + }; This looks weirdly asymmetric ... shouldn't we then use REGCACHE_MAP_SKIP for both LE and BE cases? In fact, it would probably make sense to make VRSAVE also a 4-byte field + skip. Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com