- Timestamp:
- Nov 1, 2016 9:06:26 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111637
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp
r62637 r64499 412 412 * @param cbOutput Size of the output buffer. 413 413 * @param pcbInstr Where to return the size of the instruction. 414 * @param pDisState Where to store the disassembler state into. 414 415 */ 415 416 static DECLCALLBACK(int) 416 417 dbgfR3DisasInstrExOnVCpu(PVM pVM, PVMCPU pVCpu, RTSEL Sel, PRTGCPTR pGCPtr, uint32_t fFlags, 417 char *pszOutput, uint32_t cbOutput, uint32_t *pcbInstr )418 char *pszOutput, uint32_t cbOutput, uint32_t *pcbInstr, PDBGFDISSTATE pDisState) 418 419 { 419 420 VMCPU_ASSERT_EMT(pVCpu); … … 669 670 *pcbInstr = State.Cpu.cbInstr; 670 671 672 if (pDisState) 673 { 674 pDisState->pCurInstr = State.Cpu.pCurInstr; 675 pDisState->cbInstr = State.Cpu.cbInstr; 676 pDisState->Param1 = State.Cpu.Param1; 677 pDisState->Param2 = State.Cpu.Param2; 678 pDisState->Param3 = State.Cpu.Param3; 679 pDisState->Param4 = State.Cpu.Param4; 680 } 681 671 682 dbgfR3DisasInstrDone(&State); 672 683 return VINF_SUCCESS; 673 684 } 674 685 686 687 /** 688 * Disassembles the one instruction according to the specified flags and address 689 * returning part of the disassembler state. 690 * 691 * @returns VBox status code. 692 * @param pUVM The user mode VM handle. 693 * @param idCpu The ID of virtual CPU. 694 * @param pAddr The code address. 695 * @param fFlags Flags controlling where to start and how to format. 696 * A combination of the DBGF_DISAS_FLAGS_* \#defines. 697 * @param pszOutput Output buffer. This will always be properly 698 * terminated if @a cbOutput is greater than zero. 699 * @param cbOutput Size of the output buffer. 700 * @param pDisState The disassembler state to fill in. 701 * 702 * @remarks May have to switch to the EMT of the virtual CPU in order to do 703 * address conversion. 704 */ 705 DECLHIDDEN(int) dbgfR3DisasInstrStateEx(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddr, uint32_t fFlags, 706 char *pszOutput, uint32_t cbOutput, PDBGFDISSTATE pDisState) 707 { 708 AssertReturn(cbOutput > 0, VERR_INVALID_PARAMETER); 709 *pszOutput = '\0'; 710 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 711 PVM pVM = pUVM->pVM; 712 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 713 AssertReturn(idCpu < pUVM->cCpus, VERR_INVALID_CPU_ID); 714 AssertReturn(!(fFlags & ~DBGF_DISAS_FLAGS_VALID_MASK), VERR_INVALID_PARAMETER); 715 AssertReturn((fFlags & DBGF_DISAS_FLAGS_MODE_MASK) <= DBGF_DISAS_FLAGS_64BIT_MODE, VERR_INVALID_PARAMETER); 716 717 /* 718 * Optimize the common case where we're called on the EMT of idCpu since 719 * we're using this all the time when logging. 720 */ 721 int rc; 722 PVMCPU pVCpu = VMMGetCpu(pVM); 723 if ( pVCpu 724 && pVCpu->idCpu == idCpu) 725 rc = dbgfR3DisasInstrExOnVCpu(pVM, pVCpu, pAddr->Sel, &pAddr->off, fFlags, pszOutput, cbOutput, NULL, pDisState); 726 else 727 rc = VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3DisasInstrExOnVCpu, 9, 728 pVM, VMMGetCpuById(pVM, idCpu), pAddr->Sel, &pAddr->off, fFlags, pszOutput, cbOutput, NULL, pDisState); 729 return rc; 730 } 675 731 676 732 /** … … 713 769 if ( pVCpu 714 770 && pVCpu->idCpu == idCpu) 715 rc = dbgfR3DisasInstrExOnVCpu(pVM, pVCpu, Sel, &GCPtr, fFlags, pszOutput, cbOutput, pcbInstr );771 rc = dbgfR3DisasInstrExOnVCpu(pVM, pVCpu, Sel, &GCPtr, fFlags, pszOutput, cbOutput, pcbInstr, NULL); 716 772 else 717 rc = VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3DisasInstrExOnVCpu, 8,718 pVM, VMMGetCpuById(pVM, idCpu), Sel, &GCPtr, fFlags, pszOutput, cbOutput, pcbInstr );773 rc = VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3DisasInstrExOnVCpu, 9, 774 pVM, VMMGetCpuById(pVM, idCpu), Sel, &GCPtr, fFlags, pszOutput, cbOutput, pcbInstr, NULL); 719 775 return rc; 720 776 } … … 742 798 DBGF_DISAS_FLAGS_CURRENT_GUEST | DBGF_DISAS_FLAGS_DEFAULT_MODE 743 799 | DBGF_DISAS_FLAGS_ANNOTATE_PATCHED, 744 pszOutput, cbOutput, NULL );800 pszOutput, cbOutput, NULL, NULL); 745 801 } 746 802 … … 798 854 RTGCPTR GCPtrTmp = GCPtr; 799 855 int rc = dbgfR3DisasInstrExOnVCpu(pVCpu->pVMR3, pVCpu, Sel, &GCPtrTmp, DBGF_DISAS_FLAGS_DEFAULT_MODE, 800 &szBuf[0], sizeof(szBuf), NULL );856 &szBuf[0], sizeof(szBuf), NULL, NULL); 801 857 if (RT_FAILURE(rc)) 802 858 RTStrPrintf(szBuf, sizeof(szBuf), "DBGFR3DisasInstrLog(, %RTsel, %RGv) failed with rc=%Rrc\n", Sel, GCPtr, rc); -
trunk/src/VBox/VMM/include/DBGFInternal.h
r62478 r64499 20 20 21 21 #include <VBox/cdefs.h> 22 #ifdef IN_RING3 23 # include <VBox/dis.h> 24 #endif 22 25 #include <VBox/types.h> 23 26 #include <iprt/semaphore.h> … … 460 463 461 464 #ifdef IN_RING3 465 /** 466 * DBGF disassembler state (substate of DISSTATE). 467 */ 468 typedef struct DBGFDISSTATE 469 { 470 /** Pointer to the current instruction. */ 471 PCDISOPCODE pCurInstr; 472 /** Size of the instruction in bytes. */ 473 uint32_t cbInstr; 474 /** Parameters. */ 475 DISOPPARAM Param1; 476 DISOPPARAM Param2; 477 DISOPPARAM Param3; 478 DISOPPARAM Param4; 479 } DBGFDISSTATE; 480 /** Pointer to a DBGF disassembler state. */ 481 typedef DBGFDISSTATE *PDBGFDISSTATE; 482 483 DECLHIDDEN(int) dbgfR3DisasInstrStateEx(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddr, uint32_t fFlags, 484 char *pszOutput, uint32_t cbOutput, PDBGFDISSTATE pDisState); 462 485 463 486 #endif
Note:
See TracChangeset
for help on using the changeset viewer.