From patchwork Fri Dec 15 14:36:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 18134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9321255dys; Fri, 15 Dec 2023 06:36:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHysWal8yOIU0A/tX2CGm9y5EpIZafASbefkWo6Y/KKeB5qFevFJ/a2+eMPJkTwXjfiZaM5 X-Received: by 2002:a05:6214:cca:b0:67f:356:5731 with SMTP id 10-20020a0562140cca00b0067f03565731mr4969415qvx.44.1702650993680; Fri, 15 Dec 2023 06:36:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702650993; cv=pass; d=google.com; s=arc-20160816; b=ZhRDQ9ssuLQVSecvtJxuuGppCX7d4Gr5lYD/rbmdLK4fdmytsWZkogmonjI9fKV+Iu r7dKoBo9CTvFO7ZOtfekxwIXhCzsAskfmWdGtmVNxwgLqpNiVe8OYi+H3mBehcf0CoqF etSnt70mzuCryT5tg113I/8ZxzVDnl5KN+Zn8S0Dui3xLA7rymDdlMPnAejjfkck9HKj b7xtnRYkdNGlvDiOPlbNl6BWlmWp/ihskdIwvuf5OpXPo8HOVG1HQrtVm5SAAtTbeuJl 5+XEWXvzNz9bZ7TmjHvREzIVBWLlewWBkCszsFMGz2xgh8Yqb6BdOoaYtk2Nd9Q9V2+d DVGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=0h9pzGmrM8MMlbdIKiQp0BtxsI8vCqwYbRb8khb9lXE=; fh=lE3HXkiifBSVPU+f05x++3qNjjxlDvLZxwnRCBzavKo=; b=VeBqQgB6jr7a2MKdXoKh/stpPU2kgjJCU3eU4jWO9bn5DIpC5PZijYj5is0d9w/AyM G5V1Rp7f6IxOQvTwor3o03DfvAhPoXQFcaVaDw+dPSjyoRMBzmbGobVN81u/DS35CxlB g8IQmAg/uQ4sPaZvr3f5IMG8mPFVyNvKRF2cGCYeSNs4iWTYyL1an1ypx68YySCCgWOI PQLY9+sbR56HZmbukfhtRjChVCgSxf6x1v/LvOxc6sdEgyNwLgFn3dRzXmyu0jzcWroT s/Y9kwA9WGstiRPbYQA5imJXHBkz0igqFnG5IIlGqVLJ6kE0Bjpygb39GB7uWuH2Im0I B7Wg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VsqEJW5e; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id p13-20020a0cfd8d000000b0067eff8c7f47si5273599qvr.224.2023.12.15.06.36.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 06:36:33 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VsqEJW5e; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DC68B384DED8 for ; Fri, 15 Dec 2023 14:36:31 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id B7BBE385AC33 for ; Fri, 15 Dec 2023 14:36:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7BBE385AC33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B7BBE385AC33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702650986; cv=none; b=KZjrtV1ybhG/XR+QVZVbxM2oaIZJlk/M9LOWHrGksjIpWZA5fFACzO51u/yonCVjhSx1S3HyXpzW8HMlftzOYD0t6y48E0p0sO46868vCBMd1anBSSSo1e9/dWtJ0K608XYwjbAifZ2ArGuGCKcoIeDXZLVq0gMe2VeF9sGz5k8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702650986; c=relaxed/simple; bh=S9727BDZ2PI6cndEgCjmRK3JfwM+Pv6t7X4dxq0fApM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Q/IsrYbQ4xRGOJTtYEtVa4Ci7cJsDPcNjgVhAfLks38s8V79GdeNH9SWeiiak00FeOgTxMab5X3YjU0j7QLFoJ+SrEeoGLHhwxqcFeAwgkh2NNHju9m6L33iczdy97+lk2KHYahnYDSi4UDVsExlt9psLcIfc0AKhpQT28Y+QqQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BFEGsDL005831 for ; Fri, 15 Dec 2023 14:36:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=0h9pzGmrM8MMlbdIKiQp0BtxsI8vCqwYbRb8khb9lXE=; b=VsqEJW5epa0j4pX2qxlxxThdHcCmY8HP2cyBOGvoJ3ViU5NTM7ToWgsGsCAHnTk0TyP/ 1hjWrUvfGFr1O0eWEUCbG2ePm9J0oS85xJIkTZqO3TH/vQZfCDApT0ZYm3l+xl7bc3aK R5q7oMnN3/FhunWD9Xuzz/8J0g6CyoeYJaV3nsWghhYFi9+gv1QBfSGjpi7AiCVvGk08 Qej/VMB2YWz8fD47VSE4u76zv9avk2c1+8EcNIKWr2uLUdBtjQuMABF6ZJRDpTy5oy5K mXIw0gMXhBvikR3ApELgkHHSVYR/rWBiG7kf86+ZtzjQ3a812arkGBHDldPsmu+Ofego IA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3v0re1ggtr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Dec 2023 14:36:23 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3BFEISKp011686 for ; Fri, 15 Dec 2023 14:36:22 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3v0re1ggte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 14:36:22 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3BFCn8Uo013886; Fri, 15 Dec 2023 14:36:21 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uw592r2py-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 14:36:21 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BFEaIwE41550208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Dec 2023 14:36:18 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A481A20043; Fri, 15 Dec 2023 14:36:18 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7781320040; Fri, 15 Dec 2023 14:36:18 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 15 Dec 2023 14:36:18 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org Cc: Jens Remus , Andreas Krebbel , Nick Clifton Subject: [PATCH v2 0/7] s390: Optionally print instruction description in disassembly Date: Fri, 15 Dec 2023 15:36:09 +0100 Message-Id: <20231215143616.820185-1-jremus@linux.ibm.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: BW5t0Ii96W1Hdqg2080axUJjgNungMBI X-Proofpoint-GUID: k8KkvUjptNpwhOY8wHSJW1Z0X3VpvKvn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-15_08,2023-12-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=387 impostorscore=0 bulkscore=0 clxscore=1015 phishscore=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312150100 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785358968189033388 X-GMAIL-MSGID: 1785358968189033388 With this patch series the s390 disassembler optionally prints the instruction descriptions as comment in the disassembly. This is enabled by specifying the new s390-specific disassembler option "insndesc". Patches 2-5 are preparatory cleanup/enhancement patches that patch 6 builds upon. Patch 1 is a cleanup in the s390-mkopc build, that I stumbled upon. New: Patch 2 is a cleanup of the letter case of instruction descriptions as preparation for patch 6. New: Patch 3 provides the IBM z16 instruction descriptions as preparation for patch 6. New: Patch 4 enhances the error handling in s390-mkopc. New: Patch 5 is a general cleanup to use strncpy() and snprintf() instead of strcpy() and strcat() and to use length macros for strings in s390-mkopc. Updated: Patch 6 (formerly 2) allows to optionally print the instruction descriptions as comments using the s390-specific disassembler option "insndesc". It now uses strncpy() instead of strcpy() as well as a length macro for the instruction description string. New: Patch 7 suffixes the instruction descriptions of conditional branch extended mnemonics with their condition (e.g. "on A high"). This complements patch 6. Example output: $ objdump -d -M insndesc test ... 0000000000000620 : 620: c0 10 00 00 0d 5c larl %r1,20d8 <__TMC_END__> # load address relative long 626: c0 20 00 00 0d 59 larl %r2,20d8 <__TMC_END__> # load address relative long 62c: ec 12 00 0a 80 64 cgrje %r1,%r2,640 # compare and branch relative (64) on A equal B 632: c4 18 00 00 0c d7 lgrl %r1,1fe0 <_ITM_deregisterTMCloneTable@Base> # load relative long (64) 638: ec 18 00 04 00 7c cgije %r1,0,640 # compare immediate and branch relative (64<8) on A equal B 63e: 07 f1 br %r1 # unconditional branch 640: 07 fe br %r14 # unconditional branch Note that the readability can be enhanced by using a filter such as "expand": $ objdump -d -M insndesc test | expand -t 8,16,24,32,40,80 ... 0000000000000620 : 620: c0 10 00 00 0d 5c larl %r1,20d8 <__TMC_END__> # load address relative long 626: c0 20 00 00 0d 59 larl %r2,20d8 <__TMC_END__> # load address relative long 62c: ec 12 00 0a 80 64 cgrje %r1,%r2,640 # compare and branch relative (64) on A equal B 632: c4 18 00 00 0c d7 lgrl %r1,1fe0 <_ITM_deregisterTMCloneTable@Base> # load relative long (64) 638: ec 18 00 04 00 7c cgije %r1,0,640 # compare immediate and branch relative (64<8) on A equal B 63e: 07 f1 br %r1 # unconditional branch 640: 07 fe br %r14 # unconditional branch Regards, Jens Jens Remus (7): s390: Fix build when using EXEEXT_FOR_BUILD s390: Align letter case of instruction descriptions s390: Provide IBM z16 (arch14) instruction descriptions s390: Enhance error handling in s390-mkopc s390: Use safe string functions and length macros in s390-mkopc s390: Optionally print instruction description in disassembly s390: Add suffix to conditional branch instruction descriptions binutils/NEWS | 5 + gas/testsuite/gas/s390/s390.exp | 1 + gas/testsuite/gas/s390/zarch-insndesc.d | 19 ++ gas/testsuite/gas/s390/zarch-insndesc.s | 12 ++ include/opcode/s390.h | 5 +- opcodes/Makefile.am | 7 +- opcodes/Makefile.in | 7 +- opcodes/s390-dis.c | 13 +- opcodes/s390-mkopc.c | 219 +++++++++++++++--------- opcodes/s390-opc.c | 62 +++---- opcodes/s390-opc.txt | 98 ++++++----- 11 files changed, 289 insertions(+), 159 deletions(-) create mode 100644 gas/testsuite/gas/s390/zarch-insndesc.d create mode 100644 gas/testsuite/gas/s390/zarch-insndesc.s