diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-03-18 23:10:19 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-03-18 23:10:19 -0700 |
commit | ed37aa8070cabf80de269508cbf022bc2b464d26 (patch) | |
tree | 73394bc04a59da69e9dac998c02fac2520675c40 /ndisasm.c | |
parent | d1174fb1a68a73b17010adb312f9329b4ce411eb (diff) | |
download | nasm-ed37aa8070cabf80de269508cbf022bc2b464d26.tar.gz nasm-ed37aa8070cabf80de269508cbf022bc2b464d26.tar.bz2 nasm-ed37aa8070cabf80de269508cbf022bc2b464d26.zip |
disasm: when no instruction is found, consider a naked prefix
If we can't find a matching instruction, rather than printing it as a
"db" literal, consider first if we can disassemble it as a naked prefix.
Diffstat (limited to 'ndisasm.c')
-rw-r--r-- | ndisasm.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -273,7 +273,8 @@ int main(int argc, char **argv) if ((nextsync || synclen) && (uint32_t)offset == nextsync) { if (synclen) { - fprintf(stdout, "%08"PRIX32" skipping 0x%"PRIX32" bytes\n", offset, synclen); + fprintf(stdout, "%08"PRIX32" skipping 0x%"PRIX32" bytes\n", + offset, synclen); offset += synclen; skip(synclen, fp); } @@ -282,12 +283,12 @@ int main(int argc, char **argv) } while (p > q && (p - q >= INSN_MAX || lenread == 0)) { lendis = - disasm((uint8_t *) q, outbuf, sizeof(outbuf), bits, offset, autosync, - prefer); + disasm((uint8_t *) q, outbuf, sizeof(outbuf), bits, + offset, autosync, prefer); if (!lendis || lendis > (p - q) || ((nextsync || synclen) && (uint32_t)lendis > nextsync - offset)) - lendis = eatbyte((uint8_t *) q, outbuf, sizeof(outbuf)); + lendis = eatbyte((uint8_t *) q, outbuf, sizeof(outbuf), bits); output_ins(offset, (uint8_t *) q, lendis, outbuf); q += lendis; offset += lendis; |