public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jens Remus <jremus@linux.ibm.com>
To: binutils@sourceware.org
Cc: Jens Remus <jremus@linux.ibm.com>,
	Andreas Krebbel <krebbel@linux.ibm.com>,
	Nick Clifton <nickc@redhat.com>
Subject: [PATCH v2 0/7] s390: Optionally print instruction description in disassembly
Date: Fri, 15 Dec 2023 15:36:09 +0100	[thread overview]
Message-ID: <20231215143616.820185-1-jremus@linux.ibm.com> (raw)

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 <deregister_tm_clones>:
 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 <deregister_tm_clones+0x20> # 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 <deregister_tm_clones+0x20>   # 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 <deregister_tm_clones>:
 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 <deregister_tm_clones+0x20> # 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 <deregister_tm_clones+0x20>   # 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

-- 
2.40.1


             reply	other threads:[~2023-12-15 14:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 14:36 Jens Remus [this message]
2023-12-15 14:36 ` [PATCH v2 1/7] s390: Fix build when using EXEEXT_FOR_BUILD Jens Remus
2023-12-15 14:36 ` [PATCH v2 2/7] s390: Align letter case of instruction descriptions Jens Remus
2023-12-15 14:36 ` [PATCH v2 3/7] s390: Provide IBM z16 (arch14) " Jens Remus
2023-12-15 14:36 ` [PATCH v2 4/7] s390: Enhance error handling in s390-mkopc Jens Remus
2023-12-15 14:36 ` [PATCH v2 5/7] s390: Use safe string functions and length macros " Jens Remus
2023-12-15 14:36 ` [PATCH v2 6/7] s390: Optionally print instruction description in disassembly Jens Remus
2023-12-15 14:36 ` [PATCH v2 7/7] s390: Add suffix to conditional branch instruction descriptions Jens Remus
2023-12-18 12:14 ` [PATCH v2 0/7] s390: Optionally print instruction description in disassembly Nick Clifton
2023-12-20 10:56 ` Andreas Krebbel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231215143616.820185-1-jremus@linux.ibm.com \
    --to=jremus@linux.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=krebbel@linux.ibm.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).