8
* Copyright (C) 2006-2007 Oracle Corporation
10
* This file is part of VirtualBox Open Source Edition (OSE), as
11
* available from http://www.virtualbox.org. This file is free software;
12
* you can redistribute it and/or modify it under the terms of the GNU
13
* General Public License (GPL) as published by the Free Software
14
* Foundation, in version 2 as it comes in the "COPYING" file of the
15
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
/*******************************************************************************
21
*******************************************************************************/
25
#include <iprt/string.h>
28
DECLASM(int) TestProc();
30
DECLASM(int) TestProc64();
32
//uint8_t aCode16[] = { 0x66, 0x67, 0x89, 0x07 };
34
int main(int argc, char **argv)
36
printf("VBox Disassembler Test\n");
39
//printf("DisasmBlock on printf:\n");
40
//DisasmBlock((uint8_t *)printf, 256);
44
RTUINTPTR pInstr = (uintptr_t)TestProc;
46
for (int i=0;i<50;i++)
52
memset(&cpu, 0, sizeof(cpu));
53
cpu.mode = CPUMODE_32BIT;
54
if (RT_SUCCESS(DISInstr(&cpu, pInstr, 0, &cb, szOutput)))
56
printf("%s", szOutput);
60
printf("DISOne failed!\n");
67
printf("\n64 bits disassembly\n");
68
pInstr = (uintptr_t)TestProc64;
71
for (int i=0;i<50;i++)
77
memset(&cpu, 0, sizeof(cpu));
78
cpu.mode = CPUMODE_64BIT;
79
if (RT_SUCCESS(DISInstr(&cpu, pInstr, 0, &cb, szOutput)))
80
printf("%s", szOutput);
83
printf("DISOne failed!\n");