public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] s390: Optionally print instruction description in disassembly
@ 2023-12-15 14:36 Jens Remus
  2023-12-15 14:36 ` [PATCH v2 1/7] s390: Fix build when using EXEEXT_FOR_BUILD Jens Remus
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Jens Remus @ 2023-12-15 14:36 UTC (permalink / raw)
  To: binutils; +Cc: Jens Remus, Andreas Krebbel, Nick Clifton

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-20 10:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15 14:36 [PATCH v2 0/7] s390: Optionally print instruction description in disassembly Jens Remus
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

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).