[PATCH v2 0/7] s390: Optionally print instruction description in disassembly
Jens Remus
jremus@linux.ibm.com
Fri Dec 15 14:36:09 GMT 2023
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
More information about the Binutils
mailing list