From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13180 invoked by alias); 21 May 2018 20:46:16 -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 13017 invoked by uid 89); 21 May 2018 20:45:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,NO_DNS_FOR_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Signal, 1747, consolidate, Consolidate 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; Mon, 21 May 2018 20:45:54 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4LKiEID062040 for ; Mon, 21 May 2018 16:45:53 -0400 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j44kw9rhj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 21 May 2018 16:45:52 -0400 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 May 2018 16:45:51 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 21 May 2018 16:45:49 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4LKjlE249741994 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 May 2018 20:45:47 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F3BD4AC03F; Mon, 21 May 2018 16:47:17 -0400 (EDT) Received: from pedro.localdomain (unknown [9.18.235.153]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id C7862AC043; Mon, 21 May 2018 16:47:17 -0400 (EDT) Received: by pedro.localdomain (Postfix, from userid 1000) id 6907E3C03DE; Mon, 21 May 2018 17:45:45 -0300 (-03) From: Pedro Franco de Carvalho To: gdb-patches@sourceware.org Cc: uweigand@de.ibm.com Subject: [PATCH v2 4/8] [PowerPC] Consolidate linux vector regset sizes Date: Mon, 21 May 2018 20:46:00 -0000 In-Reply-To: <20180521204458.19070-1-pedromfc@linux.vnet.ibm.com> References: <20180510195840.17734-1-pedromfc@linux.vnet.ibm.com> <20180521204458.19070-1-pedromfc@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18052120-0044-0000-0000-00000417B00F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009062; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000261; SDB=6.01035688; UDB=6.00529761; IPR=6.00814816; MB=3.00021228; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-21 20:45:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052120-0045-0000-0000-00000849CACB Message-Id: <20180521204458.19070-4-pedromfc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-21_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 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-1805210246 X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00510.txt.bz2 This patch defines constants for the sizes of the two vector regsets (vector-scalar registers and regular vector registers). The native, gdbserver and core file targets are changed to use these constants. The Linux ptrace calls return (or read) a smaller regset than the one found in core files for vector registers, because ptrace uses a single 4-byte quantity for vrsave at the end of the regset, while the core-file regset uses a full 16-byte field for vrsave. For simplicity, the larger size is used in both cases, and so a buffer with 12 unused additional bytes is passed to ptrace in the native target. gdb/ChangeLog: yyyy-mm-dd Pedro Franco de Carvalho * arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_VRREGSET) (PPC_LINUX_SIZEOF_VSXREGSET): Define. * ppc-linux-nat.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove. (gdb_vrregset_t): Change array type size to PPC_LINUX_SIZEOF_VRREGSET. (gdb_vsxregset_t): Change array type size to PPC_LINUX_SIZEOF_VSXREGSET. * ppc-linux-tdep.c (ppc_linux_iterate_over_regset_sections): Change integer literals to PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET. gdb/gdbserver/ChangeLog: yyyy-mm-dd Pedro Franco de Carvalho * linux-ppc-low.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove. (ppc_arch_setup): Change SIZEOF_VRREGS and SIZEOF_VSXREGS to PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET. --- gdb/arch/ppc-linux-common.h | 9 +++++++++ gdb/gdbserver/linux-ppc-low.c | 8 ++------ gdb/ppc-linux-nat.c | 8 ++------ gdb/ppc-linux-tdep.c | 6 ++++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/gdb/arch/ppc-linux-common.h b/gdb/arch/ppc-linux-common.h index b82adc49d2..798781cbf7 100644 --- a/gdb/arch/ppc-linux-common.h +++ b/gdb/arch/ppc-linux-common.h @@ -22,6 +22,15 @@ struct target_desc; +/* The core file VMX regset has 34 16-byte fields (32 16-byte vector + registers, plus two fields containing 4-byte registers, VSCR and + VRSAVE), while the ptrace calls return or read 33 16-byte fields + plus a 4-byte field for VRSAVE. For simplicity we use the longer + length for both cases. */ +#define PPC_LINUX_SIZEOF_VRREGSET 544 + +#define PPC_LINUX_SIZEOF_VSXREGSET 256 + /* Check if the hwcap auxv entry indicates that isa205 is supported. */ bool ppc_linux_has_isa205 (unsigned long hwcap); diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index b440b0e0a7..367851836e 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -459,8 +459,6 @@ static void ppc_fill_gregset (struct regcache *regcache, void *buf) ppc_collect_ptrace_register (regcache, i, (char *) buf + ppc_regmap[i]); } -#define SIZEOF_VSXREGS 32*8 - static void ppc_fill_vsxregset (struct regcache *regcache, void *buf) { @@ -483,8 +481,6 @@ ppc_store_vsxregset (struct regcache *regcache, const void *buf) supply_register (regcache, base + i, ®set[i * 8]); } -#define SIZEOF_VRREGS 33*16+4 - static void ppc_fill_vrregset (struct regcache *regcache, void *buf) { @@ -660,10 +656,10 @@ ppc_arch_setup (void) switch (regset->get_request) { case PTRACE_GETVRREGS: - regset->size = features.altivec ? SIZEOF_VRREGS : 0; + regset->size = features.altivec ? PPC_LINUX_SIZEOF_VRREGSET : 0; break; case PTRACE_GETVSXREGS: - regset->size = features.vsx ? SIZEOF_VSXREGS : 0; + regset->size = features.vsx ? PPC_LINUX_SIZEOF_VSXREGSET : 0; break; case PTRACE_GETEVRREGS: if (ppc_hwcap & PPC_FEATURE_HAS_SPE) diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 7e96032d4c..a8f202dd33 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -174,9 +174,7 @@ struct ppc_hw_breakpoint */ /* *INDENT-ON* */ -#define SIZEOF_VRREGS 33*16+4 - -typedef char gdb_vrregset_t[SIZEOF_VRREGS]; +typedef char gdb_vrregset_t[PPC_LINUX_SIZEOF_VRREGSET]; /* This is the layout of the POWER7 VSX registers and the way they overlap with the existing FPR and VMX registers. @@ -210,9 +208,7 @@ typedef char gdb_vrregset_t[SIZEOF_VRREGS]; the FP registers (doubleword 0) and hence extend them with additional 64 bits (doubleword 1). The other 32 regs overlap with the VMX registers. */ -#define SIZEOF_VSXREGS 32*8 - -typedef char gdb_vsxregset_t[SIZEOF_VSXREGS]; +typedef char gdb_vsxregset_t[PPC_LINUX_SIZEOF_VSXREGSET]; /* On PPC processors that support the Signal Processing Extension (SPE) APU, the general-purpose registers are 64 bits long. diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 1d3b019c30..344069d752 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -557,10 +557,12 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, cb (".reg2", 264, &ppc32_linux_fpregset, NULL, cb_data); if (have_altivec) - cb (".reg-ppc-vmx", 544, &ppc32_linux_vrregset, "ppc Altivec", cb_data); + cb (".reg-ppc-vmx", PPC_LINUX_SIZEOF_VRREGSET, &ppc32_linux_vrregset, + "ppc Altivec", cb_data); if (have_vsx) - cb (".reg-ppc-vsx", 256, &ppc32_linux_vsxregset, "POWER7 VSX", cb_data); + cb (".reg-ppc-vsx", PPC_LINUX_SIZEOF_VSXREGSET, + &ppc32_linux_vsxregset, "POWER7 VSX", cb_data); } static void -- 2.13.6