Changeset 47671 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 12, 2013 11:16:55 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 87874
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/DBGFAll.cpp
r47328 r47671 115 115 116 116 /** 117 * Checks if any of the hardware breakpoints are armed. 118 * 119 * @returns true if armed, false if not. 120 * @param pVM The cross context VM structure. 121 */ 122 VMM_INT_DECL(bool) DBGFBpIsHwArmed(PVM pVM) 123 { 124 Assert(RT_ELEMENTS(pVM->dbgf.s.aHwBreakpoints) == 4); 125 return (pVM->dbgf.s.aHwBreakpoints[0].fEnabled && pVM->dbgf.s.aHwBreakpoints[0].enmType == DBGFBPTYPE_REG) 126 || (pVM->dbgf.s.aHwBreakpoints[1].fEnabled && pVM->dbgf.s.aHwBreakpoints[1].enmType == DBGFBPTYPE_REG) 127 || (pVM->dbgf.s.aHwBreakpoints[2].fEnabled && pVM->dbgf.s.aHwBreakpoints[2].enmType == DBGFBPTYPE_REG) 128 || (pVM->dbgf.s.aHwBreakpoints[3].fEnabled && pVM->dbgf.s.aHwBreakpoints[3].enmType == DBGFBPTYPE_REG); 129 } 130 131 132 /** 117 133 * Returns the single stepping state for a virtual CPU. 118 134 * -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r47568 r47671 8926 8926 */ 8927 8927 PVM pVM = IEMCPU_TO_VM(pIemCpu); 8928 EMRemLock(pVM); 8929 int rc = REMR3EmulateInstruction(pVM, IEMCPU_TO_VMCPU(pIemCpu)); 8930 AssertRC(rc); 8931 EMRemUnlock(pVM); 8928 VBOXSTRICTRC rc = VERR_EM_CANNOT_EXEC_GUEST; 8929 #if 1 8930 if ( HMIsEnabled(pVM) 8931 && pIemCpu->cIOReads == 0 8932 && pIemCpu->cIOWrites == 0) 8933 do 8934 rc = EMR3HmSingleInstruction(pVM, IEMCPU_TO_VMCPU(pIemCpu), EM_ONE_INS_FLAGS_RIP_CHANGE); 8935 while (rc == VINF_SUCCESS); 8936 #endif 8937 if ( rc == VERR_EM_CANNOT_EXEC_GUEST 8938 || rc == VINF_IOM_R3_IOPORT_READ 8939 || rc == VINF_IOM_R3_IOPORT_WRITE 8940 || rc == VINF_IOM_R3_MMIO_READ 8941 || rc == VINF_IOM_R3_MMIO_READ_WRITE 8942 || rc == VINF_IOM_R3_MMIO_WRITE 8943 ) 8944 { 8945 EMRemLock(pVM); 8946 rc = REMR3EmulateInstruction(pVM, IEMCPU_TO_VMCPU(pIemCpu)); 8947 AssertRC(rc); 8948 EMRemUnlock(pVM); 8949 } 8932 8950 8933 8951 /* … … 9550 9568 * See if there is an interrupt pending in TRPM and inject it if we can. 9551 9569 */ 9552 #ifdef IEM_VERIFICATION_MODE_FULL 9570 #if !defined(IEM_VERIFICATION_MODE_FULL) || !defined(IN_RING3) 9571 # ifdef IEM_VERIFICATION_MODE_FULL 9553 9572 pIemCpu->uInjectCpl = UINT8_MAX; 9554 # endif9573 # endif 9555 9574 if ( pCtx->eflags.Bits.u1IF 9556 9575 && TRPMHasTrap(pVCpu) … … 9566 9585 TRPMResetTrap(pVCpu); 9567 9586 } 9587 #else 9588 iemExecVerificationModeSetup(pIemCpu); 9589 #endif 9568 9590 9569 9591 /* … … 9609 9631 if (rcStrict == VINF_SUCCESS) 9610 9632 rcStrict = iemExecOneInner(pVCpu, pIemCpu, true); 9633 9634 #if defined(IEM_VERIFICATION_MODE_FULL) && defined(IN_RING3) 9635 /* 9636 * Assert some sanity. 9637 */ 9638 iemExecVerificationModeCheck(pIemCpu); 9639 #endif 9611 9640 9612 9641 /* -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r47670 r47671 2498 2498 Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_UPDATE_PAE_PDPES)); 2499 2499 2500 if ( VM_FF_IS_PENDING(pVM, VM_FF_HM_TO_R3_MASK | VM_FF_REQUEST | VM_FF_PGM_POOL_FLUSH_PENDING | VM_FF_PDM_DMA) 2501 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL 2502 | VMCPU_FF_REQUEST)) 2500 if ( VM_FF_IS_PENDING(pVM, !pVCpu->hm.s.fSingleInstruction 2501 ? VM_FF_HP_R0_PRE_HM_MASK : VM_FF_HP_R0_PRE_HM_STEP_MASK) 2502 || VMCPU_FF_IS_PENDING(pVCpu, !pVCpu->hm.s.fSingleInstruction 2503 ? VMCPU_FF_HP_R0_PRE_HM_MASK : VMCPU_FF_HP_R0_PRE_HM_STEP_MASK) ) 2503 2504 { 2504 2505 /* Pending PGM C3 sync. */ … … 4584 4585 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 4585 4586 PVM pVM = pVCpu->CTX_SUFF(pVM); 4586 int rc = DBGFRZTrap01Handler(pVM, pVCpu, CPUMCTX2CORE(pCtx), pVmcb->guest.u64DR6 );4587 int rc = DBGFRZTrap01Handler(pVM, pVCpu, CPUMCTX2CORE(pCtx), pVmcb->guest.u64DR6, pVCpu->hm.s.fSingleInstruction); 4587 4588 if (rc == VINF_EM_RAW_GUEST_TRAP) 4588 4589 { -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r47670 r47671 5791 5791 Assert(VMMRZCallRing3IsEnabled(pVCpu)); 5792 5792 5793 if ( VM_FF_IS_PENDING(pVM, VM_FF_HM_TO_R3_MASK | VM_FF_REQUEST | VM_FF_PGM_POOL_FLUSH_PENDING | VM_FF_PDM_DMA) 5794 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL 5795 | VMCPU_FF_REQUEST | VMCPU_FF_HM_UPDATE_CR3 | VMCPU_FF_HM_UPDATE_PAE_PDPES)) 5793 if ( VM_FF_IS_PENDING(pVM, !pVCpu->hm.s.fSingleInstruction 5794 ? VM_FF_HP_R0_PRE_HM_MASK : VM_FF_HP_R0_PRE_HM_STEP_MASK) 5795 || VMCPU_FF_IS_PENDING(pVCpu, !pVCpu->hm.s.fSingleInstruction 5796 ? VMCPU_FF_HP_R0_PRE_HM_MASK : VMCPU_FF_HP_R0_PRE_HM_STEP_MASK) ) 5796 5797 { 5797 5798 /* We need the control registers now, make sure the guest-CPU context is updated. */ … … 9628 9629 AssertRCReturn(rc, rc); 9629 9630 9631 /* If we sat the trap flag above, we have to clear it. */ /** @todo HM should remember what it does and possibly do this elsewhere! */ 9632 if ( (pVCpu->hm.s.fSingleInstruction || DBGFIsStepping(pVCpu)) 9633 && !(pVCpu->CTX_SUFF(pVM)->hm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_MONITOR_TRAP_FLAG)) 9634 pMixedCtx->eflags.Bits.u1TF = 0; 9635 9630 9636 /* Refer Intel spec. Table 27-1. "Exit Qualifications for debug exceptions" for the format. */ 9631 9637 uint64_t uDR6 = X86_DR6_INIT_VAL; … … 9633 9639 & (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3 | X86_DR6_BD | X86_DR6_BS)); 9634 9640 9635 rc = DBGFRZTrap01Handler(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pMixedCtx), uDR6 );9641 rc = DBGFRZTrap01Handler(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pMixedCtx), uDR6, pVCpu->hm.s.fSingleInstruction); 9636 9642 if (rc == VINF_EM_RAW_GUEST_TRAP) 9637 9643 { -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r47660 r47671 57 57 #include <VBox/vmm/hm.h> 58 58 #include <VBox/vmm/patm.h> 59 #ifdef IEM_VERIFICATION_MODE60 # include <VBox/vmm/iem.h>61 #endif62 59 #include "EMInternal.h" 63 60 #include <VBox/vmm/vm.h> … … 819 816 #endif 820 817 else if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_HM) 821 rc = EMR3HmSingleInstruction(pVM, pVCpu );818 rc = EMR3HmSingleInstruction(pVM, pVCpu, 0 /*fFlags*/); 822 819 #ifdef VBOX_WITH_REM 823 820 else if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_REM) … … 1261 1258 EMSTATE emR3Reschedule(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1262 1259 { 1263 #ifdef IEM_VERIFICATION_MODE1264 return EMSTATE_REM;1265 #else1266 1267 1260 /* 1268 1261 * When forcing raw-mode execution, things are simple. … … 1472 1465 /*Assert(PGMPhysIsA20Enabled(pVCpu));*/ 1473 1466 return EMSTATE_RAW; 1474 #endif /* !IEM_VERIFICATION_MODE */1475 1476 1467 } 1477 1468 … … 2360 2351 */ 2361 2352 case EMSTATE_RAW: 2362 #ifndef IEM_VERIFICATION_MODE /* remove later */ 2363 # ifdef VBOX_WITH_RAW_MODE 2353 #ifdef VBOX_WITH_RAW_MODE 2364 2354 rc = emR3RawExecute(pVM, pVCpu, &fFFDone); 2365 # 2355 #else 2366 2356 AssertLogRelMsgFailed(("%Rrc\n", rc)); 2367 2357 rc = VERR_EM_INTERNAL_ERROR; 2368 # 2358 #endif 2369 2359 break; 2370 #endif2371 2360 2372 2361 /* … … 2374 2363 */ 2375 2364 case EMSTATE_HM: 2376 #ifndef IEM_VERIFICATION_MODE /* remove later */2377 2365 rc = emR3HmExecute(pVM, pVCpu, &fFFDone); 2378 2366 break; 2379 #endif2380 2367 2381 2368 /* … … 2383 2370 */ 2384 2371 case EMSTATE_REM: 2385 #ifdef IEM_VERIFICATION_MODE2386 # if 12387 rc = VBOXSTRICTRC_TODO(IEMExecOne(pVCpu)); fFFDone = false;2388 # else2389 rc = VBOXSTRICTRC_TODO(REMR3EmulateInstruction(pVM, pVCpu)); fFFDone = false;2390 if (rc == VINF_EM_RESCHEDULE)2391 rc = VINF_SUCCESS;2392 # endif2393 #else2394 2372 rc = emR3RemExecute(pVM, pVCpu, &fFFDone); 2395 #endif2396 2373 Log2(("EMR3ExecuteVM: emR3RemExecute -> %Rrc\n", rc)); 2397 2374 break; … … 2402 2379 case EMSTATE_IEM: 2403 2380 #if 0 /* For testing purposes. */ 2404 rc = VBOXSTRICTRC_TODO(EMR3HmSingleInstruction(pVM, pVCpu ));2381 rc = VBOXSTRICTRC_TODO(EMR3HmSingleInstruction(pVM, pVCpu, EM_ONE_INS_FLAGS_RIP_CHANGE)); 2405 2382 if (rc == VINF_EM_DBG_STEPPED || rc == VINF_EM_RESCHEDULE_HM || rc == VINF_EM_RESCHEDULE_REM || rc == VINF_EM_RESCHEDULE_RAW) 2406 2383 rc = VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR3/EMHM.cpp
r47619 r47671 167 167 * @param pVCpu Pointer to the cross context CPU structure for 168 168 * the calling EMT. 169 * @param fFlags Combinations of EM_ONE_INS_FLAGS_XXX. 169 170 * @thread EMT. 170 171 */ 171 VMMR3_INT_DECL(VBOXSTRICTRC) EMR3HmSingleInstruction(PVM pVM, PVMCPU pVCpu )172 VMMR3_INT_DECL(VBOXSTRICTRC) EMR3HmSingleInstruction(PVM pVM, PVMCPU pVCpu, uint32_t fFlags) 172 173 { 173 if (!HMR3CanExecuteGuest(pVM, pVCpu->em.s.pCtx)) 174 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 175 Assert(!(fFlags & ~EM_ONE_INS_FLAGS_MASK)); 176 177 if (!HMR3CanExecuteGuest(pVM, pCtx)) 174 178 return VINF_EM_RESCHEDULE; 175 179 176 /* 177 * Service necessary FFs before going into HM. 178 */ 179 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 180 if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) 181 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 182 { 183 VBOXSTRICTRC rcStrict = emR3HmForcedActions(pVM, pVCpu, pCtx); 184 if (rcStrict != VINF_SUCCESS) 185 { 186 Log(("EMR3HmSingleInstruction: FFs before -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 180 uint64_t const uOldRip = pCtx->rip; 181 for (;;) 182 { 183 /* 184 * Service necessary FFs before going into HM. 185 */ 186 if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) 187 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 188 { 189 VBOXSTRICTRC rcStrict = emR3HmForcedActions(pVM, pVCpu, pCtx); 190 if (rcStrict != VINF_SUCCESS) 191 { 192 Log(("EMR3HmSingleInstruction: FFs before -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 193 return rcStrict; 194 } 195 } 196 197 /* 198 * Go execute it. 199 */ 200 bool fOld = HMSetSingleInstruction(pVCpu, true); 201 VBOXSTRICTRC rcStrict = VMMR3HmRunGC(pVM, pVCpu); 202 HMSetSingleInstruction(pVCpu, fOld); 203 LogFlow(("EMR3HmSingleInstruction: %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 204 205 /* 206 * Handle high priority FFs and informational status codes. We don't do 207 * normal FF processing the caller or the next call can deal with them. 208 */ 209 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); 210 if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK) 211 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 212 { 213 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, VBOXSTRICTRC_TODO(rcStrict)); 214 LogFlow(("EMR3HmSingleInstruction: FFs after -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 215 } 216 217 if (rcStrict != VINF_SUCCESS && (rcStrict < VINF_EM_FIRST || rcStrict > VINF_EM_LAST)) 218 { 219 rcStrict = emR3HmHandleRC(pVM, pVCpu, pCtx, VBOXSTRICTRC_TODO(rcStrict)); 220 Log(("EMR3HmSingleInstruction: emR3HmHandleRC -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 221 } 222 223 /* 224 * Done? 225 */ 226 if ( (rcStrict != VINF_SUCCESS && rcStrict != VINF_EM_DBG_STEPPED) 227 || !(fFlags & EM_ONE_INS_FLAGS_RIP_CHANGE) 228 || pCtx->rip != uOldRip) 229 { 230 if (rcStrict == VINF_SUCCESS && pCtx->rip != uOldRip) 231 rcStrict = VINF_EM_DBG_STEPPED; 232 Log(("EMR3HmSingleInstruction: returns %Rrc (rip %llx -> %llx)\n", VBOXSTRICTRC_VAL(rcStrict), uOldRip, pCtx->rip)); 187 233 return rcStrict; 188 234 } 189 235 } 190 191 /*192 * Go execute it.193 */194 bool fOld = HMSetSingleInstruction(pVCpu, true);195 VBOXSTRICTRC rcStrict = VMMR3HmRunGC(pVM, pVCpu);196 HMSetSingleInstruction(pVCpu, fOld);197 LogFlow(("EMR3HmSingleInstruction: %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));198 199 /*200 * Handle high priority FFs and informational status codes. We don't do201 * normal FF processing the caller or the next call can deal with them.202 */203 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK);204 if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK)205 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK))206 {207 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, VBOXSTRICTRC_TODO(rcStrict));208 LogFlow(("EMR3HmSingleInstruction: FFs after -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));209 }210 211 if (rcStrict != VINF_SUCCESS && (rcStrict < VINF_EM_FIRST || rcStrict > VINF_EM_LAST))212 {213 rcStrict = emR3HmHandleRC(pVM, pVCpu, pCtx, VBOXSTRICTRC_TODO(rcStrict));214 Log(("EMR3HmSingleInstruction: emR3HmHandleRC -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));215 }216 217 return rcStrict;218 236 } 219 237 -
trunk/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp
r47660 r47671 321 321 */ 322 322 PGMRZDynMapStartAutoSet(pVCpu); 323 int rc = DBGFRZTrap01Handler(pVM, pVCpu, pRegFrame, uDr6 );323 int rc = DBGFRZTrap01Handler(pVM, pVCpu, pRegFrame, uDr6, false /*fAltStepping*/); 324 324 if (rc == VINF_EM_RAW_GUEST_TRAP) 325 325 CPUMSetGuestDR6(pVCpu, CPUMGetGuestDR6(pVCpu) | uDr6); 326 else if (rc == VINF_EM_DBG_STEPPED) 327 pRegFrame->eflags.Bits.u1TF = 0; 326 328 327 329 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); … … 368 370 * Now leave the rest to the DBGF. 369 371 */ 370 int rc = DBGFRZTrap01Handler(pVM, pVCpu, pRegFrame, uDr6 );372 int rc = DBGFRZTrap01Handler(pVM, pVCpu, pRegFrame, uDr6, false /*fAltStepping*/); 371 373 AssertStmt(rc != VINF_EM_RAW_GUEST_TRAP, rc = VERR_TRPM_IPE_1); 374 if (rc == VINF_EM_DBG_STEPPED) 375 pRegFrame->eflags.Bits.u1TF = 0; 372 376 373 377 Log6(("TRPMGCHyper01: %Rrc (%04x:%08x %RTreg)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip, uDr6)); -
trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp
r47660 r47671 38 38 * other codes are passed execution to host context. 39 39 * 40 * @param pVM Pointer to the VM. 41 * @param pVCpu Pointer to the VMCPU. 42 * @param pRegFrame Pointer to the register frame for the trap. 43 * @param uDr6 The DR6 hypervisor register value. 40 * @param pVM Pointer to the VM. 41 * @param pVCpu Pointer to the VMCPU. 42 * @param pRegFrame Pointer to the register frame for the trap. 43 * @param uDr6 The DR6 hypervisor register value. 44 * @param fAltStepping Alternative stepping indicator. 44 45 */ 45 VMMRZ_INT_DECL(int) DBGFRZTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6 )46 VMMRZ_INT_DECL(int) DBGFRZTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6, bool fAltStepping) 46 47 { 47 48 #ifdef IN_RC … … 78 79 */ 79 80 if ( (uDr6 & X86_DR6_BS) 80 && (fInHyper || pVCpu->dbgf.s.fSingleSteppingRaw ))81 && (fInHyper || pVCpu->dbgf.s.fSingleSteppingRaw || fAltStepping)) 81 82 { 82 83 pVCpu->dbgf.s.fSingleSteppingRaw = false;
Note:
See TracChangeset
for help on using the changeset viewer.