VirtualBox

source: vbox/trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp@ 41737

Last change on this file since 41737 was 41737, checked in by vboxsync, 13 years ago

DISOPCODE: s/opcode/uOpcode/

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 22.2 KB
Line 
1/* $Id: tstDisasm-2.cpp 41737 2012-06-15 01:01:49Z vboxsync $ */
2/** @file
3 * Testcase - Generic Disassembler Tool.
4 */
5
6/*
7 * Copyright (C) 2008 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include <VBox/dis.h>
22#include <VBox/err.h>
23#include <iprt/alloc.h>
24#include <iprt/assert.h>
25#include <iprt/initterm.h>
26#include <iprt/getopt.h>
27#include <iprt/file.h>
28#include <iprt/path.h>
29#include <iprt/stream.h>
30#include <iprt/string.h>
31#include <iprt/ctype.h>
32
33
34/*******************************************************************************
35* Structures and Typedefs *
36*******************************************************************************/
37typedef enum { kAsmStyle_Default, kAsmStyle_yasm, kAsmStyle_masm, kAsmStyle_gas, kAsmStyle_invalid } ASMSTYLE;
38typedef enum { kUndefOp_Fail, kUndefOp_All, kUndefOp_DefineByte, kUndefOp_End } UNDEFOPHANDLING;
39
40typedef struct MYDISSTATE
41{
42 DISCPUSTATE Cpu;
43 uint64_t uAddress; /**< The current instruction address. */
44 uint8_t *pbInstr; /**< The current instruction (pointer). */
45 uint32_t cbInstr; /**< The size of the current instruction. */
46 bool fUndefOp; /**< Whether the current instruction is really an undefined opcode.*/
47 UNDEFOPHANDLING enmUndefOp; /**< How to treat undefined opcodes. */
48 int rc; /**< Set if we hit EOF. */
49 size_t cbLeft; /**< The number of bytes left. (read) */
50 uint8_t *pbNext; /**< The next byte. (read) */
51 uint64_t uNextAddr; /**< The address of the next byte. (read) */
52 char szLine[256]; /**< The disassembler text output. */
53} MYDISSTATE;
54typedef MYDISSTATE *PMYDISSTATE;
55
56
57
58/**
59 * Default style.
60 *
61 * @param pState The disassembler state.
62 */
63static void MyDisasDefaultFormatter(PMYDISSTATE pState)
64{
65 RTPrintf("%s", pState->szLine);
66}
67
68
69/**
70 * Yasm style.
71 *
72 * @param pState The disassembler state.
73 */
74static void MyDisasYasmFormatter(PMYDISSTATE pState)
75{
76 char szTmp[256];
77#if 0
78 /* a very quick hack. */
79 strcpy(szTmp, RTStrStripL(strchr(pState->szLine, ':') + 1));
80
81 char *psz = strrchr(szTmp, '[');
82 *psz = '\0';
83 RTStrStripR(szTmp);
84
85 psz = strstr(szTmp, " ptr ");
86 if (psz)
87 memset(psz, ' ', 5);
88
89 char *pszEnd = strchr(szTmp, '\0');
90 while (pszEnd - &szTmp[0] < 71)
91 *pszEnd++ = ' ';
92 *pszEnd = '\0';
93
94#else
95 size_t cch = DISFormatYasmEx(&pState->Cpu, szTmp, sizeof(szTmp),
96 DIS_FMT_FLAGS_STRICT | DIS_FMT_FLAGS_ADDR_RIGHT | DIS_FMT_FLAGS_ADDR_COMMENT
97 | DIS_FMT_FLAGS_BYTES_RIGHT | DIS_FMT_FLAGS_BYTES_COMMENT | DIS_FMT_FLAGS_BYTES_SPACED,
98 NULL, NULL);
99 Assert(cch < sizeof(szTmp));
100 while (cch < 71)
101 szTmp[cch++] = ' ';
102 szTmp[cch] = '\0';
103#endif
104
105 RTPrintf(" %s ; %s", szTmp, pState->szLine);
106}
107
108
109/**
110 * Masm style.
111 *
112 * @param pState The disassembler state.
113 */
114static void MyDisasMasmFormatter(PMYDISSTATE pState)
115{
116 RTPrintf("masm not implemented: %s", pState->szLine);
117}
118
119
120/**
121 * This is a temporary workaround for catching a few illegal opcodes
122 * that the disassembler is currently letting thru, just enough to make
123 * the assemblers happy.
124 *
125 * We're too close to a release to dare mess with these things now as
126 * they may consequences for performance and let alone introduce bugs.
127 *
128 * @returns true if it's valid. false if it isn't.
129 *
130 * @param pCpu The disassembler output.
131 */
132static bool MyDisasIsValidInstruction(DISCPUSTATE const *pCpu)
133{
134 switch (pCpu->pCurInstr->uOpcode)
135 {
136 /* These doesn't take memory operands. */
137 case OP_MOV_CR:
138 case OP_MOV_DR:
139 case OP_MOV_TR:
140 if (pCpu->ModRM.Bits.Mod != 3)
141 return false;
142 break;
143
144 /* The 0x8f /0 variant of this instruction doesn't get its /r value verified. */
145 case OP_POP:
146 if ( pCpu->bOpCode == 0x8f
147 && pCpu->ModRM.Bits.Reg != 0)
148 return false;
149 break;
150
151 /* The 0xc6 /0 and 0xc7 /0 variants of this instruction don't get their /r values verified. */
152 case OP_MOV:
153 if ( ( pCpu->bOpCode == 0xc6
154 || pCpu->bOpCode == 0xc7)
155 && pCpu->ModRM.Bits.Reg != 0)
156 return false;
157 break;
158
159 default:
160 break;
161 }
162
163 return true;
164}
165
166
167/**
168 * Callback for reading bytes.
169 *
170 * @todo This should check that the disassembler doesn't do unnecessary reads,
171 * however the current doesn't do this and is just complicated...
172 */
173static DECLCALLBACK(int) MyDisasInstrRead(PDISCPUSTATE pDisState, uint8_t *pbDst, RTUINTPTR uSrcAddr, uint32_t cbToRead)
174{
175 PMYDISSTATE pState = (PMYDISSTATE)pDisState;
176 if (RT_LIKELY( pState->uNextAddr == uSrcAddr
177 && pState->cbLeft >= cbToRead))
178 {
179 /*
180 * Straight forward reading.
181 */
182 if (cbToRead == 1)
183 {
184 pState->cbLeft--;
185 *pbDst = *pState->pbNext++;
186 pState->uNextAddr++;
187 }
188 else
189 {
190 memcpy(pbDst, pState->pbNext, cbToRead);
191 pState->pbNext += cbToRead;
192 pState->cbLeft -= cbToRead;
193 pState->uNextAddr += cbToRead;
194 }
195 }
196 else
197 {
198 /*
199 * Jumping up the stream.
200 * This occurs when the byte sequence is added to the output string.
201 */
202 uint64_t offReq64 = uSrcAddr - pState->uAddress;
203 if (offReq64 < 32)
204 {
205 uint32_t offReq = offReq64;
206 uintptr_t off = pState->pbNext - pState->pbInstr;
207 if (off + pState->cbLeft <= offReq)
208 {
209 pState->pbNext += pState->cbLeft;
210 pState->uNextAddr += pState->cbLeft;
211 pState->cbLeft = 0;
212
213 memset(pbDst, 0xcc, cbToRead);
214 pState->rc = VERR_EOF;
215 return VERR_EOF;
216 }
217
218 /* reset the stream. */
219 pState->cbLeft += off;
220 pState->pbNext = pState->pbInstr;
221 pState->uNextAddr = pState->uAddress;
222
223 /* skip ahead. */
224 pState->cbLeft -= offReq;
225 pState->pbNext += offReq;
226 pState->uNextAddr += offReq;
227
228 /* do the reading. */
229 if (pState->cbLeft >= cbToRead)
230 {
231 memcpy(pbDst, pState->pbNext, cbToRead);
232 pState->cbLeft -= cbToRead;
233 pState->pbNext += cbToRead;
234 pState->uNextAddr += cbToRead;
235 }
236 else
237 {
238 if (pState->cbLeft > 0)
239 {
240 memcpy(pbDst, pState->pbNext, pState->cbLeft);
241 pbDst += pState->cbLeft;
242 cbToRead -= (uint32_t)pState->cbLeft;
243 pState->pbNext += pState->cbLeft;
244 pState->uNextAddr += pState->cbLeft;
245 pState->cbLeft = 0;
246 }
247 memset(pbDst, 0xcc, cbToRead);
248 pState->rc = VERR_EOF;
249 return VERR_EOF;
250 }
251 }
252 else
253 {
254 RTStrmPrintf(g_pStdErr, "Reading before current instruction!\n");
255 memset(pbDst, 0x90, cbToRead);
256 pState->rc = VERR_INTERNAL_ERROR;
257 return VERR_INTERNAL_ERROR;
258 }
259 }
260
261 return VINF_SUCCESS;
262}
263
264
265/**
266 * Disassembles a block of memory.
267 *
268 * @returns VBox status code.
269 * @param argv0 Program name (for errors and warnings).
270 * @param enmCpuMode The cpu mode to disassemble in.
271 * @param uAddress The address we're starting to disassemble at.
272 * @param uHighlightAddr The address of the instruction that should be
273 * highlighted. Pass UINT64_MAX to keep quiet.
274 * @param pbFile Where to start disassemble.
275 * @param cbFile How much to disassemble.
276 * @param enmStyle The assembly output style.
277 * @param fListing Whether to print in a listing like mode.
278 * @param enmUndefOp How to deal with undefined opcodes.
279 */
280static int MyDisasmBlock(const char *argv0, DISCPUMODE enmCpuMode, uint64_t uAddress,
281 uint64_t uHighlightAddr, uint8_t *pbFile, size_t cbFile,
282 ASMSTYLE enmStyle, bool fListing, UNDEFOPHANDLING enmUndefOp)
283{
284 /*
285 * Initialize the CPU context.
286 */
287 MYDISSTATE State;
288 State.uAddress = uAddress;
289 State.pbInstr = pbFile;
290 State.cbInstr = 0;
291 State.enmUndefOp = enmUndefOp;
292 State.rc = VINF_SUCCESS;
293 State.cbLeft = cbFile;
294 State.pbNext = pbFile;
295 State.uNextAddr = uAddress;
296
297 void (*pfnFormatter)(PMYDISSTATE pState);
298 switch (enmStyle)
299 {
300 case kAsmStyle_Default:
301 pfnFormatter = MyDisasDefaultFormatter;
302 break;
303
304 case kAsmStyle_yasm:
305 RTPrintf(" BITS %d\n", enmCpuMode == DISCPUMODE_16BIT ? 16 : enmCpuMode == DISCPUMODE_32BIT ? 32 : 64);
306 pfnFormatter = MyDisasYasmFormatter;
307 break;
308
309 case kAsmStyle_masm:
310 pfnFormatter = MyDisasMasmFormatter;
311 break;
312
313 default:
314 AssertFailedReturn(VERR_INTERNAL_ERROR);
315 }
316
317 /*
318 * The loop.
319 */
320 int rcRet = VINF_SUCCESS;
321 while (State.cbLeft > 0)
322 {
323 /*
324 * Disassemble it.
325 */
326 State.cbInstr = 0;
327 State.cbLeft += State.pbNext - State.pbInstr;
328 State.uNextAddr = State.uAddress;
329 State.pbNext = State.pbInstr;
330
331 int rc = DISInstrToStrWithReader(State.uAddress, enmCpuMode, MyDisasInstrRead, &State,
332 &State.Cpu, &State.cbInstr, State.szLine, sizeof(State.szLine));
333 if ( RT_SUCCESS(rc)
334 || ( ( rc == VERR_DIS_INVALID_OPCODE
335 || rc == VERR_DIS_GEN_FAILURE)
336 && State.enmUndefOp == kUndefOp_DefineByte))
337 {
338 State.fUndefOp = rc == VERR_DIS_INVALID_OPCODE
339 || rc == VERR_DIS_GEN_FAILURE
340 || State.Cpu.pCurInstr->uOpcode == OP_INVALID
341 || State.Cpu.pCurInstr->uOpcode == OP_ILLUD2
342 || ( State.enmUndefOp == kUndefOp_DefineByte
343 && !MyDisasIsValidInstruction(&State.Cpu));
344 if (State.fUndefOp && State.enmUndefOp == kUndefOp_DefineByte)
345 {
346 if (!State.cbInstr)
347 {
348 State.Cpu.abInstr[0] = 0;
349 State.Cpu.pfnReadBytes(&State.Cpu, &State.Cpu.abInstr[0], State.uAddress, 1);
350 State.cbInstr = 1;
351 }
352 RTPrintf(" db");
353 for (unsigned off = 0; off < State.cbInstr; off++)
354 RTPrintf(off ? ", %03xh" : " %03xh", State.Cpu.abInstr[off]);
355 RTPrintf(" ; %s\n", State.szLine);
356 }
357 else if (!State.fUndefOp && State.enmUndefOp == kUndefOp_All)
358 {
359 RTPrintf("%s: error at %#RX64: unexpected valid instruction (op=%d)\n", argv0, State.uAddress, State.Cpu.pCurInstr->uOpcode);
360 pfnFormatter(&State);
361 rcRet = VERR_GENERAL_FAILURE;
362 }
363 else if (State.fUndefOp && State.enmUndefOp == kUndefOp_Fail)
364 {
365 RTPrintf("%s: error at %#RX64: undefined opcode (op=%d)\n", argv0, State.uAddress, State.Cpu.pCurInstr->uOpcode);
366 pfnFormatter(&State);
367 rcRet = VERR_GENERAL_FAILURE;
368 }
369 else
370 {
371 /* Use db for odd encodings that we can't make the assembler use. */
372 if ( State.enmUndefOp == kUndefOp_DefineByte
373 && DISFormatYasmIsOddEncoding(&State.Cpu))
374 {
375 RTPrintf(" db");
376 for (unsigned off = 0; off < State.cbInstr; off++)
377 RTPrintf(off ? ", %03xh" : " %03xh", State.Cpu.abInstr[off]);
378 RTPrintf(" ; ");
379 }
380
381 pfnFormatter(&State);
382 }
383 }
384 else
385 {
386 State.cbInstr = State.pbNext - State.pbInstr;
387 if (!State.cbLeft)
388 RTPrintf("%s: error at %#RX64: read beyond the end (%Rrc)\n", argv0, State.uAddress, rc);
389 else if (State.cbInstr)
390 RTPrintf("%s: error at %#RX64: %Rrc cbInstr=%d\n", argv0, State.uAddress, rc, State.cbInstr);
391 else
392 {
393 RTPrintf("%s: error at %#RX64: %Rrc cbInstr=%d!\n", argv0, State.uAddress, rc, State.cbInstr);
394 if (rcRet == VINF_SUCCESS)
395 rcRet = rc;
396 break;
397 }
398 }
399
400 /* Highlight this instruction? */
401 if (uHighlightAddr - State.uAddress < State.cbInstr)
402 RTPrintf("; ^^^^^^^^^^^^^^^^^^^^^\n");
403
404 /* next */
405 State.uAddress += State.cbInstr;
406 State.pbInstr += State.cbInstr;
407 }
408
409 return rcRet;
410}
411
412/**
413 * Converts a hex char to a number.
414 *
415 * @returns 0..15 on success, -1 on failure.
416 * @param ch The character.
417 */
418static int HexDigitToNum(char ch)
419{
420 switch (ch)
421 {
422 case '0': return 0;
423 case '1': return 1;
424 case '2': return 2;
425 case '3': return 3;
426 case '4': return 4;
427 case '5': return 5;
428 case '6': return 6;
429 case '7': return 7;
430 case '8': return 8;
431 case '9': return 9;
432 case 'A':
433 case 'a': return 0xa;
434 case 'B':
435 case 'b': return 0xb;
436 case 'C':
437 case 'c': return 0xc;
438 case 'D':
439 case 'd': return 0xd;
440 case 'E':
441 case 'e': return 0xe;
442 case 'F':
443 case 'f': return 0xf;
444 default:
445 RTPrintf("error: Invalid hex digig '%c'\n", ch);
446 return -1;
447 }
448}
449
450/**
451 * Prints usage info.
452 *
453 * @returns 1.
454 * @param argv0 The program name.
455 */
456static int Usage(const char *argv0)
457{
458 RTStrmPrintf(g_pStdErr,
459"usage: %s [options] <file1> [file2..fileN]\n"
460" or: %s [options] <-x|--hex-bytes> <hex byte> [more hex..]\n"
461" or: %s <--help|-h>\n"
462"\n"
463"Options:\n"
464" --address|-a <address>\n"
465" The base address. Default: 0\n"
466" --max-bytes|-b <bytes>\n"
467" The maximum number of bytes to disassemble. Default: 1GB\n"
468" --cpumode|-c <16|32|64>\n"
469" The cpu mode. Default: 32\n"
470" --listing|-l, --no-listing|-L\n"
471" Enables or disables listing mode. Default: --no-listing\n"
472" --offset|-o <offset>\n"
473" The file offset at which to start disassembling. Default: 0\n"
474" --style|-s <default|yasm|masm>\n"
475" The assembly output style. Default: default\n"
476" --undef-op|-u <fail|all|db>\n"
477" How to treat undefined opcodes. Default: fail\n"
478 , argv0, argv0);
479 return 1;
480}
481
482
483int main(int argc, char **argv)
484{
485 RTR3InitExe(argc, &argv, 0);
486 const char * const argv0 = RTPathFilename(argv[0]);
487
488 /* options */
489 uint64_t uAddress = 0;
490 uint64_t uHighlightAddr = UINT64_MAX;
491 ASMSTYLE enmStyle = kAsmStyle_Default;
492 UNDEFOPHANDLING enmUndefOp = kUndefOp_Fail;
493 bool fListing = true;
494 DISCPUMODE enmCpuMode = DISCPUMODE_32BIT;
495 RTFOFF off = 0;
496 RTFOFF cbMax = _1G;
497 bool fHexBytes = false;
498
499 /*
500 * Parse arguments.
501 */
502 static const RTGETOPTDEF g_aOptions[] =
503 {
504 { "--address", 'a', RTGETOPT_REQ_UINT64 },
505 { "--cpumode", 'c', RTGETOPT_REQ_UINT32 },
506 { "--bytes", 'b', RTGETOPT_REQ_INT64 },
507 { "--listing", 'l', RTGETOPT_REQ_NOTHING },
508 { "--no-listing", 'L', RTGETOPT_REQ_NOTHING },
509 { "--offset", 'o', RTGETOPT_REQ_INT64 },
510 { "--style", 's', RTGETOPT_REQ_STRING },
511 { "--undef-op", 'u', RTGETOPT_REQ_STRING },
512 { "--hex-bytes", 'x', RTGETOPT_REQ_NOTHING },
513 };
514
515 int ch;
516 RTGETOPTUNION ValueUnion;
517 RTGETOPTSTATE GetState;
518 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
519 while ( (ch = RTGetOpt(&GetState, &ValueUnion))
520 && ch != VINF_GETOPT_NOT_OPTION)
521 {
522 switch (ch)
523 {
524 case 'a':
525 uAddress = ValueUnion.u64;
526 break;
527
528 case 'b':
529 cbMax = ValueUnion.i64;
530 break;
531
532 case 'c':
533 if (ValueUnion.u32 == 16)
534 enmCpuMode = DISCPUMODE_16BIT;
535 else if (ValueUnion.u32 == 32)
536 enmCpuMode = DISCPUMODE_32BIT;
537 else if (ValueUnion.u32 == 64)
538 enmCpuMode = DISCPUMODE_64BIT;
539 else
540 {
541 RTStrmPrintf(g_pStdErr, "%s: Invalid CPU mode value %RU32\n", argv0, ValueUnion.u32);
542 return 1;
543 }
544 break;
545
546 case 'h':
547 return Usage(argv0);
548
549 case 'l':
550 fListing = true;
551 break;
552
553 case 'L':
554 fListing = false;
555 break;
556
557 case 'o':
558 off = ValueUnion.i64;
559 break;
560
561 case 's':
562 if (!strcmp(ValueUnion.psz, "default"))
563 enmStyle = kAsmStyle_Default;
564 else if (!strcmp(ValueUnion.psz, "yasm"))
565 enmStyle = kAsmStyle_yasm;
566 else if (!strcmp(ValueUnion.psz, "masm"))
567 {
568 enmStyle = kAsmStyle_masm;
569 RTStrmPrintf(g_pStdErr, "%s: masm style isn't implemented yet\n", argv0);
570 return 1;
571 }
572 else
573 {
574 RTStrmPrintf(g_pStdErr, "%s: unknown assembly style: %s\n", argv0, ValueUnion.psz);
575 return 1;
576 }
577 break;
578
579 case 'u':
580 if (!strcmp(ValueUnion.psz, "fail"))
581 enmUndefOp = kUndefOp_Fail;
582 else if (!strcmp(ValueUnion.psz, "all"))
583 enmUndefOp = kUndefOp_All;
584 else if (!strcmp(ValueUnion.psz, "db"))
585 enmUndefOp = kUndefOp_DefineByte;
586 else
587 {
588 RTStrmPrintf(g_pStdErr, "%s: unknown undefined opcode handling method: %s\n", argv0, ValueUnion.psz);
589 return 1;
590 }
591 break;
592
593 case 'x':
594 fHexBytes = true;
595 break;
596
597 case 'V':
598 RTPrintf("$Revision: $\n");
599 return 0;
600
601 default:
602 return RTGetOptPrintError(ch, &ValueUnion);
603 }
604 }
605 int iArg = GetState.iNext - 1; /** @todo Not pretty, add RTGetOptInit flag for this. */
606 if (iArg >= argc)
607 return Usage(argv0);
608
609 int rc = VINF_SUCCESS;
610 if (fHexBytes)
611 {
612 /*
613 * Convert the remaining arguments from a hex byte string into
614 * a buffer that we disassemble.
615 */
616 size_t cb = 0;
617 uint8_t *pb = NULL;
618 for ( ; iArg < argc; iArg++)
619 {
620 char ch2;
621 const char *psz = argv[iArg];
622 while (*psz)
623 {
624 /** @todo this stuff belongs in IPRT, same stuff as mac address reading. Could be reused for IPv6 with a different item size.*/
625 /* skip white space, and for the benefit of linux panics '<' and '>'. */
626 while (RT_C_IS_SPACE(ch2 = *psz) || ch2 == '<' || ch2 == '>')
627 {
628 if (ch2 == '<')
629 uHighlightAddr = uAddress + cb;
630 psz++;
631 }
632 if (!ch2)
633 break;
634
635 /* one digit followed by a space or EOS, or two digits. */
636 int iNum = HexDigitToNum(*psz++);
637 if (iNum == -1)
638 return 1;
639 if (!RT_C_IS_SPACE(ch2 = *psz) && ch2 != '\0' && ch2 != '>')
640 {
641 int iDigit = HexDigitToNum(*psz++);
642 if (iDigit == -1)
643 return 1;
644 iNum = iNum * 16 + iDigit;
645 }
646
647 /* add the byte */
648 if (!(cb % 4 /*64*/))
649 {
650 pb = (uint8_t *)RTMemRealloc(pb, cb + 64);
651 if (!pb)
652 {
653 RTPrintf("%s: error: RTMemRealloc failed\n", argv[0]);
654 return 1;
655 }
656 }
657 pb[cb++] = (uint8_t)iNum;
658 }
659 }
660
661 /*
662 * Disassemble it.
663 */
664 rc = MyDisasmBlock(argv0, enmCpuMode, uAddress, uHighlightAddr, pb, cb, enmStyle, fListing, enmUndefOp);
665 }
666 else
667 {
668 /*
669 * Process the files.
670 */
671 for ( ; iArg < argc; iArg++)
672 {
673 /*
674 * Read the file into memory.
675 */
676 void *pvFile;
677 size_t cbFile;
678 rc = RTFileReadAllEx(argv[iArg], off, cbMax, RTFILE_RDALL_O_DENY_NONE, &pvFile, &cbFile);
679 if (RT_FAILURE(rc))
680 {
681 RTStrmPrintf(g_pStdErr, "%s: %s: %Rrc\n", argv0, argv[iArg], rc);
682 break;
683 }
684
685 /*
686 * Disassemble it.
687 */
688 rc = MyDisasmBlock(argv0, enmCpuMode, uAddress, uHighlightAddr, (uint8_t *)pvFile, cbFile, enmStyle, fListing, enmUndefOp);
689 if (RT_FAILURE(rc))
690 break;
691 }
692 }
693
694 return RT_SUCCESS(rc) ? 0 : 1;
695}
696
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette