I've now managed to get my version to successfully run against around 7000 files (basically any ELF object in /usr/bin, /usr/lib, /kernel, /platform/sun4u) with a few caveats (explained below). Success was defined as producting the same output as the closed source disassembler, with the following exceptions:
-- Any differences in locations that don't have a symbol+offset are ignored (assumed to be data). For example: Orig: 0x100bc88: 20 52 65 63 bn,a,pn %xcc, +0x9958c <0x10a5214> New: 0x100bc88: 20 52 65 63 0x20526563 -- A minor discrepency with some of the ASR names: Orig: setvecint_tl1+0xa8: a9 80 40 00 mov %g1, %set_softint New: setvecint_tl1+0xa8: a9 80 40 00 mov %g1, %softint_set Orig: wr_clr_softint+0x4: ab 82 00 00 mov %o0, %clear_softint New: wr_clr_softint+0x4: ab 82 00 00 mov %o0, %softint_clr %softint_set and %softint_clr are given in the US2005 manual -- if this needs to change, this is trivial to do. -- The stda syntax is assumed to be: stda %Frd, [%rs1 + %rs2] immasi i.e. stda %d0, [%l1 + %l2] 0x80 The closed library at least under certain circumstances does something like: stda %Frd, [%rs1] %rs2, immasi -- i.e. stda %f0, [%l1] %l2, 0x80 -- The closed source version has a number of issues with floating point registers. When it decodes a double register name, it still prepends %f to the resulting number (i.e. %f0) instead of %d. As a temporary workaround, I've done something similar (but easy to change). However, it also often uses single-precision register names in instruction arguments when it should be double precision (you can tell because double register values are encoded slightly differently -- a value of '1' in a register field meant for doubles actually means %d32 for example). I've found this on fxtos, fstox, fdtoi, fitod, fmul8x16, fmul8ulx16, fmul8sux16, fcmpgt32, fcmple16, fcmple32, fcmpgt16, fcmpeq16, and fcmpeq32. In the script I used to compare the outputs (included in the repo), I correct the closed source output and then compare the results. As a reminder, the source can be obtained from http://hg.genunix.org/libdisasm.hg In it, I included libdisasm.[ch] and libdisasm_impl.h so that one didn't need a bunch of stuff to build the library. compare.pl is the script used to compare the outputs, and files.txt is the list of files I've been using for validation. _______________________________________________ tools-discuss mailing list tools-discuss@opensolaris.org