Changeset 41674 in vbox for trunk/src/VBox/Disassembler
- Timestamp:
- Jun 12, 2012 8:16:31 PM (12 years ago)
- Location:
- trunk/src/VBox/Disassembler
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/Disasm.cpp
r41671 r41674 96 96 PDISCPUSTATE pCpu, uint32_t *pcbInstr, char *pszOutput, size_t cbOutput) 97 97 { 98 int rc = DIS CoreOneExEx(uInstrAddr, enmCpuMode, uFilter, pfnReadBytes, pvUser, pCpu, pcbInstr);98 int rc = DISInstEx(uInstrAddr, enmCpuMode, uFilter, pfnReadBytes, pvUser, pCpu, pcbInstr); 99 99 if (RT_SUCCESS(rc) && pszOutput && cbOutput) 100 100 { -
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41668 r41674 212 212 * 213 213 * @returns VBox status code. 214 * @param uInstrAddrAddress of the instruction to decode. This is a214 * @param pvInstr Address of the instruction to decode. This is a 215 215 * real address in the current context that can be 216 * derefferenced. (Consider DISCoreOneWithReader if217 * this isn't the case.)216 * accessed without faulting. (Consider 217 * DISInstrWithReader if this isn't the case.) 218 218 * @param enmCpuMode The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT. 219 219 * @param pfnReadBytes Callback for reading instruction bytes. … … 224 224 * PDISCPUSTATE::opsize. 225 225 */ 226 DISDECL(int) DIS CoreOne(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr)227 { 228 return DIS CoreOneExEx(uInstrAddr, enmCpuMode, OPTYPE_ALL, NULL /*pfnReadBytes*/, NULL /*pvUser*/, pCpu, pcbInstr);226 DISDECL(int) DISInstr(const void *pvInstr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr) 227 { 228 return DISInstEx((uintptr_t)pvInstr, enmCpuMode, OPTYPE_ALL, NULL /*pfnReadBytes*/, NULL /*pvUser*/, pCpu, pcbInstr); 229 229 } 230 230 … … 246 246 * PDISCPUSTATE::opsize. 247 247 */ 248 DISDECL(int) DIS CoreOneWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser,249 250 { 251 return DIS CoreOneExEx(uInstrAddr, enmCpuMode, OPTYPE_ALL, pfnReadBytes, pvUser, pCpu, pcbInstr);248 DISDECL(int) DISInstrWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser, 249 PDISCPUSTATE pCpu, uint32_t *pcbInstr) 250 { 251 return DISInstEx(uInstrAddr, enmCpuMode, OPTYPE_ALL, pfnReadBytes, pvUser, pCpu, pcbInstr); 252 252 } 253 253 254 254 255 255 /** 256 * Parses one guest instruction. 257 * 258 * The result is found in pCpu and pcbInstr. 256 * Disassembles on instruction, details in @a pCpu and length in @a pcbInstr. 259 257 * 260 258 * @returns VBox status code. … … 263 261 * @param enmCpuMode The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT. 264 262 * @param pfnReadBytes Callback for reading instruction bytes. 265 * @param uFilter Instruction type filter.263 * @param fFilter Instruction type filter. 266 264 * @param pvUser User argument for the instruction reader. (Ends up in apvUserData[0].) 267 * @param pCpu Pointer to cpu structure. Will be initialized. 268 * @param pcbInstr Where to store the size of the instruction. 269 * NULL is allowed. This is also stored in 270 * PDISCPUSTATE::opsize. 265 * @param pCpu Pointer to CPU structure. With the exception of 266 * DISCPUSTATE::apvUserData[1] and 267 * DISCPUSTATE::apvUserData[2], the structure will be 268 * completely initialized by this API, i.e. no input is 269 * taken from it. 270 * @param pcbInstr Where to store the size of the instruction. (This 271 * is also stored in PDISCPUSTATE::opsize.) Optional. 271 272 */ 272 DISDECL(int) DIS CoreOneExEx(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, uint32_t uFilter,273 274 273 DISDECL(int) DISInstEx(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, uint32_t fFilter, 274 PFNDISREADBYTES pfnReadBytes, void *pvUser, 275 PDISCPUSTATE pCpu, uint32_t *pcbInstr) 275 276 { 276 277 const OPCODE *paOneByteMap; … … 299 300 pCpu->uInstrAddr = uInstrAddr; 300 301 pCpu->pfnDisasmFnTable = g_apfnFullDisasm; 301 pCpu-> uFilter = uFilter;302 pCpu->fFilter = fFilter; 302 303 pCpu->rc = VINF_SUCCESS; 303 304 pCpu->pfnReadBytes = pfnReadBytes ? pfnReadBytes : disReadBytesDefault; … … 451 452 /* 452 453 * Apply filter to instruction type to determine if a full disassembly is required. 453 * @noteMultibyte opcodes are always marked harmless until the final byte.454 * Note! Multibyte opcodes are always marked harmless until the final byte. 454 455 */ 455 if ((pOp->optype & pCpu-> uFilter) == 0)456 if ((pOp->optype & pCpu->fFilter) == 0) 456 457 { 457 458 fFiltered = true; … … 541 542 * @note Multibyte opcodes are always marked harmless until the final byte. 542 543 */ 543 if ((fpop->optype & pCpu-> uFilter) == 0)544 if ((fpop->optype & pCpu->fFilter) == 0) 544 545 pCpu->pfnDisasmFnTable = g_apfnCalcSize; 545 546 else -
trunk/src/VBox/Disassembler/DisasmTestCore.cpp
r41668 r41674 39 39 unsigned cb; 40 40 DISCPUSTATE cpu; 41 if (DIS CoreOne((uintptr_t)&DISCoreOne, CPUMODE_32BIT, &cpu, &cb))41 if (DISInstr((void *)(uintptr_t)&DISInstr, CPUMODE_32BIT, &cpu, &cb)) 42 42 printf("ok %d\n", cpu.addrmode); 43 43 else
Note:
See TracChangeset
for help on using the changeset viewer.