Changeset 41669 in vbox
- Timestamp:
- Jun 12, 2012 1:34:07 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
include/VBox/dis.h (modified) (1 diff)
-
src/VBox/Disassembler/Disasm.cpp (modified) (2 diffs)
-
src/VBox/Disassembler/DisasmTest.cpp (modified) (5 diffs)
-
src/VBox/VMM/testcase/tstCompiler.cpp (modified) (1 diff)
-
src/recompiler/VBoxREMWrapper.cpp (modified) (2 diffs)
-
src/recompiler/VBoxRecompiler.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r41668 r41669 550 550 551 551 552 DISDECL(int) DISInstr(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr, char *pszOutput); 552 DISDECL(int) DISInstrToStr(void const *pvInstr, DISCPUMODE enmCpuMode, 553 PDISCPUSTATE pCpu, uint32_t *pcbInstr, char *pszOutput, size_t cbOutput); 553 554 DISDECL(int) DISInstrWithOff(PDISCPUSTATE pCpu, RTUINTPTR uInstrAddr, RTUINTPTR offRealAddr, uint32_t *pcbInstr, char *pszOutput); 554 555 DISDECL(int) DISInstrWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser, -
trunk/src/VBox/Disassembler/Disasm.cpp
r41668 r41669 36 36 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 37 37 * set correctly. 38 * @param uInstrAddr Pointer to the structureto disassemble.38 * @param pvInstr Pointer to the instruction to disassemble. 39 39 * @param pcbInstr Where to store the size of the instruction. NULL is 40 40 * allowed. 41 41 * @param pszOutput Storage for disassembled instruction 42 * @param cbOutput Size of the output buffer. 42 43 * 43 44 * @todo Define output callback. 44 45 */ 45 DISDECL(int) DISInstr(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr, char *pszOutput) 46 DISDECL(int) DISInstrToStr(void const *pvInstr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr, 47 char *pszOutput, size_t cbOutput) 46 48 { 47 return DISInstrEx( uInstrAddr, 0, enmCpuMode, NULL, NULL, OPTYPE_ALL,49 return DISInstrEx((uintptr_t)pvInstr, 0, enmCpuMode, NULL, NULL, OPTYPE_ALL, 48 50 pCpu, pcbInstr, pszOutput); 49 51 } … … 55 57 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 56 58 * set correctly. 57 * @param uInstrAddr Pointer to the structureto disassemble.59 * @param uInstrAddr Pointer to the instruction to disassemble. 58 60 * @param offRealAddr Offset to add to instruction address to get the real 59 61 * virtual address. -
trunk/src/VBox/Disassembler/DisasmTest.cpp
r41658 r41669 42 42 else 43 43 { 44 RTUINTPTR pInstr =(uintptr_t)TestProc;44 uint8_t const *pbInstr = (uint8_t const *)(uintptr_t)TestProc; 45 45 46 46 for (int i=0;i<50;i++) … … 50 50 char szOutput[256]; 51 51 52 if (RT_SUCCESS(DISInstr (pInstr, CPUMODE_32BIT, &cpu, &cb, szOutput)))52 if (RT_SUCCESS(DISInstrToStr(pbInstr, CPUMODE_32BIT, &cpu, &cb, szOutput, sizeof(szOutput)))) 53 53 { 54 54 printf("%s", szOutput); … … 59 59 return 1; 60 60 } 61 p Instr += cb;61 pbInstr += cb; 62 62 } 63 63 64 64 #ifndef RT_OS_OS2 65 65 printf("\n64 bits disassembly\n"); 66 p Instr =(uintptr_t)TestProc64;66 pbInstr = (uint8_t const *)(uintptr_t)TestProc64; 67 67 68 68 ////__debugbreak(); … … 73 73 char szOutput[256]; 74 74 75 if (RT_SUCCESS(DISInstr (pInstr, CPUMODE_64BIT, &cpu, &cb, szOutput)))75 if (RT_SUCCESS(DISInstrToStr(pbInstr, CPUMODE_64BIT, &cpu, &cb, szOutput, sizeof(szOutput)))) 76 76 printf("%s", szOutput); 77 77 else … … 80 80 return 1; 81 81 } 82 p Instr += cb;82 pbInstr += cb; 83 83 } 84 84 #endif -
trunk/src/VBox/VMM/testcase/tstCompiler.cpp
r41658 r41669 199 199 { 200 200 RTPrintf("tstBitFields: Disassembly of %s:\n", pszName); 201 RTUINTPTR uCur = (uintptr_t)pv; 202 RTUINTPTR uCurMax = uCur + 256; 203 DISCPUSTATE Cpu; 204 205 memset(&Cpu, 0, sizeof(Cpu)); 201 uint8_t const *pbCur = (uint8_t const *)(uintptr_t)pv; 202 uint8_t const *pbCurMax = pbCur + 256; 203 DISCPUSTATE Cpu; 204 206 205 do 207 206 { 208 207 char sz[256]; 209 208 uint32_t cbInstr = 0; 210 if (RT_SUCCESS(DISInstr (uCur, CPUMODE_32BIT, &Cpu, &cbInstr, sz)))209 if (RT_SUCCESS(DISInstrToStr(pbCur, CPUMODE_32BIT, &Cpu, &cbInstr, sz, sizeof(sz)))) 211 210 { 212 211 RTPrintf("tstBitFields: %s", sz); 213 uCur += cbInstr;212 pbCur += cbInstr; 214 213 } 215 214 else 216 215 { 217 RTPrintf("tstBitFields: %p: %02x - DISInstr failed!\n", uCur, *(uint8_t *)(uintptr_t)uCur);218 uCur += 1;216 RTPrintf("tstBitFields: %p: %02x - DISInstr failed!\n", pbCur, *pbCur); 217 pbCur += 1; 219 218 } 220 } while (Cpu.pCurInstr->opcode != OP_RETN || uCur > uCurMax);219 } while (Cpu.pCurInstr->opcode != OP_RETN || (uintptr_t)pbCur > (uintptr_t)pbCurMax); 221 220 } 222 221 -
trunk/src/recompiler/VBoxREMWrapper.cpp
r41658 r41669 652 652 { REMPARMDESC_FLAGS_INT, sizeof(RTGCUINTPTR), NULL } 653 653 }; 654 static const REMPARMDESC g_aArgsDISInstr [] =655 { 656 { REMPARMDESC_FLAGS_INT, sizeof( RTUINTPTR),NULL },654 static const REMPARMDESC g_aArgsDISInstrToStr[] = 655 { 656 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t const *), NULL }, 657 657 { REMPARMDESC_FLAGS_INT, sizeof(DISCPUMODE), NULL }, 658 658 { REMPARMDESC_FLAGS_INT, sizeof(PDISCPUSTATE), NULL }, 659 659 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL }, 660 { REMPARMDESC_FLAGS_INT, sizeof(char *), NULL } 660 { REMPARMDESC_FLAGS_INT, sizeof(char *), NULL }, 661 { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL } 661 662 }; 662 663 static const REMPARMDESC g_aArgsEMR3FatalError[] = … … 1233 1234 { "DBGFR3AsSymbolByAddr", VMM_FN(DBGFR3AsSymbolByAddr), &g_aArgsDBGFR3AsSymbolByAddr[0], RT_ELEMENTS(g_aArgsDBGFR3AsSymbolByAddr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1234 1235 { "DBGFR3AddrFromFlat", VMM_FN(DBGFR3AddrFromFlat), &g_aArgsDBGFR3AddrFromFlat[0], RT_ELEMENTS(g_aArgsDBGFR3AddrFromFlat), REMFNDESC_FLAGS_RET_INT, sizeof(PDBGFADDRESS), NULL }, 1235 { "DISInstr ", VMM_FN(DISInstr), &g_aArgsDISInstr[0], RT_ELEMENTS(g_aArgsDISInstr),REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },1236 { "DISInstrToStr", VMM_FN(DISInstrToStr), &g_aArgsDISInstrToStr[0], RT_ELEMENTS(g_aArgsDISInstrToStr), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }, 1236 1237 { "EMR3FatalError", VMM_FN(EMR3FatalError), &g_aArgsEMR3FatalError[0], RT_ELEMENTS(g_aArgsEMR3FatalError), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1237 1238 { "EMRemLock", VMM_FN(EMRemLock), &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, -
trunk/src/recompiler/VBoxRecompiler.c
r41658 r41669 4081 4081 { 4082 4082 uint32_t cbInstr; 4083 int rc = DISInstr((uintptr_t)pvCode + off, enmCpuMode, &Cpu, &cbInstr, szOutput); 4083 int rc = DISInstrToStr((uint8_t const *)pvCode + off, enmCpuMode, 4084 &Cpu, &cbInstr, szOutput, sizeof(szOutput)); 4084 4085 if (RT_SUCCESS(rc)) 4085 4086 RTLogPrintf("%s", szOutput);
Note:
See TracChangeset
for help on using the changeset viewer.

