nvdisasm can not dump disassembly for SM5X SM6X , cuobjdump works fine

Hello, folks,
I wrote a program to disassemble 64-bit binaries using nvdisasm. It works fine for SM1x, SM2X and SM3X. However, nvdisasm can only work partially right for SM5X and SM6X(SM5X and SM6X use same encodings). Is it a bug in nvdisasm?

I find nvdisasm changes between SM3X and SM5X

  1. SM5X requre four instructions alignment, however SM3X does not require
  2. SM5X and SM6X call nvdisasm once, SM3X call serveral times if a binary file contains more than one instructions

Error explain:
both "0xeedc200000070204"and “0xe30000000007000f” are valid encodings for SM5X.
0xeedc200000070204 => STG
0xe30000000007000f=> EXIT
However, nvdisasm can disassmble 0xeedc200000070204 on SM5X
but it can not disassemble 0xe30000000007000f.

cuobjdump works fine for both of the two cases, but require an ELF header instead of raw instruction binaries. So I wonder to know whether it is a bug in nvdisasm?

#########here is my program in python##########
import struct
import sys
import os
#MOV R1, c[0x0][0x20];
base=int(“0x4c10080005770203”, 16)
#EXIT;
base=int(“0xe30000000007000f”, 16)
#STG.E [R2], R4; /* 0xeedc200000070204 */
base=int(“0xeedc200000070204”, 16)
ff = ‘xx’
fout = open(ff, ‘wb’)
fout.write(struct.pack(’<Q’, base))
fout.write(struct.pack(’<Q’, base))
fout.write(struct.pack(’<Q’, base))
fout.write(struct.pack(’<Q’, base))
fout.close()
cmd = ‘echo %s’ % ff
cmd = ‘nvdisasm -b SM52 %s’ % ff
ret=os.system(cmd)

If you can demonstrate that nvdisasm works incorrectly on an object produced by the NVIDIA toolchain, then I think that would be a bug.

What I see here is simply that you don’t know how to build a correct SASS binary/object on your own, which is not surprising since neither the format nor the rules are completely described/specified.

You may want to study the maxas assembler project, since a lot of reverse-engineering was done there.

Thanks txbob for answering my question at first time.
I know maxas assembler project well.
In fact, I am building a tool to crack GPU ISA encoding automatically.
The tool works fine for SM1X, SM2X, SM3X by calling nvdisasm internally.
nvdisasm does not work fine for SM5X and SM6X, I use cuobjdump by modifying cubin to avoid this bug.
I will release my tool soon.

Thanks again.