From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 2ECB13858403 for ; Wed, 13 Oct 2021 21:55:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2ECB13858403 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19DK8k5Q008987 for ; Wed, 13 Oct 2021 17:55:47 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bnpf3r9s6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 13 Oct 2021 17:55:47 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19DLrUH1010102 for ; Wed, 13 Oct 2021 21:55:47 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma05wdc.us.ibm.com with ESMTP id 3bk2qc2wcv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 13 Oct 2021 21:55:46 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19DLtiE453281154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Oct 2021 21:55:44 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9FF42C6061; Wed, 13 Oct 2021 21:55:44 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 516F3C6057; Wed, 13 Oct 2021 21:55:44 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.42.145]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 13 Oct 2021 21:55:44 +0000 (GMT) Message-ID: <0395c04977602476887fec6bdff16f1148d72ffd.camel@us.ibm.com> Subject: Re: [PATCH] Powerpc: Add support for openat and fstatat syscalls From: Carl Love To: gdb-patches@sourceware.org, Rogerio Alves , will schmidt , Ulrich Weigand Date: Wed, 13 Oct 2021 14:55:43 -0700 In-Reply-To: References: <22a9ea816266f1b9e6948a396a1dc45cb5f8f153.camel@us.ibm.com> <287929e6460980eb4e0d12a52593689ebf4f309a.camel@us.ibm.com> <9bf3148807544fd7b83ec9334e9c18cf7b9bee81.camel@us.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-16.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 4zcQu9KkSfSqmX8W3_qIGODSwfmoOEmh X-Proofpoint-ORIG-GUID: 4zcQu9KkSfSqmX8W3_qIGODSwfmoOEmh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-13_08,2021-10-13_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=932 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110130129 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2021 21:55:49 -0000 Ulrich: On Wed, 2021-10-13 at 15:08 +0200, Ulrich Weigand wrot > > The two syscalls are similar, but not identical. In particular, they > differ in the amount of memory that is accessed: > > sys_newfstatat accesses a "struct stat" > (144 bytes on 64-bit / 88 bytes on 32-bit) > sys_fstatat64 accesses a "struct stat64" > (104 bytes on both 64-bit and 32-bit) > > Since this affects the memory being recorded, it would actually be > preferable to use the correct system call depending on ABI. > > Note that in general, there are more cases of syscall numbers > refering > to different system calls depending on the ABI (64-bit vs. 32-bit), > so it would make sense to add support for that in general. > > As an example, you may want to look s390_canonicalize_syscall, > which does make the distinction between 64-bit and 32-bit ABI Thanks for the additional info and pointers. I added a word size argument to ppc_canonicalize_syscall. The argument is then used to select the correct 64-bit or 32-bit syscall. The updated patch has been retested on Power 10. Please let me know if it looks OK now. Thanks. Carl -------------------------------------------------------- Powerpc: Add support for openat and fstatat syscalls [gdb] update ppc-linux-tdep.c Add argument to ppc_canonicalize_syscall for the wordsize. Add syscall entries for the openat and fstatat system calls. --- gdb/ppc-linux-tdep.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index ea8e3b98fa4..1e0e9a0268a 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1371,7 +1371,7 @@ static struct linux_record_tdep ppc64_linux_record_tdep; SYSCALL. */ static enum gdb_syscall -ppc_canonicalize_syscall (int syscall) +ppc_canonicalize_syscall (int syscall, int wordsize) { int result = -1; @@ -1391,6 +1391,13 @@ ppc_canonicalize_syscall (int syscall) result = syscall += 259 - 240; else if (syscall >= 250 && syscall <= 251) /* tgkill */ result = syscall + 270 - 250; + else if (syscall == 286) + result = gdb_sys_openat; + else if (syscall == 291) + if (wordsize == 64) + result = gdb_sys_newfstatat; + else + result = gdb_sys_fstatat64; else if (syscall == 336) result = gdb_sys_recv; else if (syscall == 337) @@ -1414,7 +1421,7 @@ ppc_linux_syscall_record (struct regcache *regcache) int ret; regcache_raw_read_unsigned (regcache, tdep->ppc_gp0_regnum, &scnum); - syscall_gdb = ppc_canonicalize_syscall (scnum); + syscall_gdb = ppc_canonicalize_syscall (scnum, tdep->wordsize); if (syscall_gdb < 0) { -- 2.30.2