Changeset 46762 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 24, 2013 5:05:11 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86690
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r46752 r46762 32 32 33 33 #ifdef DEBUG_ramshankar 34 # define HMVMX_SYNC_FULL_GUEST_STATE 34 35 # define HMSVM_ALWAYS_TRAP_ALL_XCPTS 35 36 # define HMSVM_ALWAYS_TRAP_PF … … 1193 1194 { 1194 1195 HMSVM_LOAD_SEG_REG(CS, cs); 1195 HMSVM_LOAD_SEG_REG(SS, cs);1196 HMSVM_LOAD_SEG_REG(DS, cs);1197 HMSVM_LOAD_SEG_REG(ES, cs);1198 HMSVM_LOAD_SEG_REG(FS, cs);1199 HMSVM_LOAD_SEG_REG(GS, cs);1196 HMSVM_LOAD_SEG_REG(SS, ss); 1197 HMSVM_LOAD_SEG_REG(DS, ds); 1198 HMSVM_LOAD_SEG_REG(ES, es); 1199 HMSVM_LOAD_SEG_REG(FS, fs); 1200 HMSVM_LOAD_SEG_REG(GS, gs); 1200 1201 1201 1202 pVmcb->ctrl.u64VmcbCleanBits &= ~HMSVM_VMCB_CLEAN_SEG; … … 1550 1551 1551 1552 /** 1552 * Loads the guest state.1553 * Worker for loading the guest-state into the VMCB. 1553 1554 * 1554 1555 * @returns VBox status code. … … 1559 1560 * @remarks No-long-jump zone!!! 1560 1561 */ 1561 VMMR0DECL(int) SVMR0LoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1562 { 1563 AssertPtr(pVM); 1564 AssertPtr(pVCpu); 1565 AssertPtr(pCtx); 1566 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 1567 1562 static int hmR0SvmLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1563 { 1568 1564 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 1569 1565 AssertMsgReturn(pVmcb, ("Invalid pVmcb\n"), VERR_SVM_INVALID_PVMCB); … … 1608 1604 pVM, pVCpu, pVCpu->hm.s.fContextUseFlags)); 1609 1605 1606 Log4(("Load: CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip)); 1607 1610 1608 STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatLoadGuestState, x); 1611 1612 1609 return rc; 1610 } 1611 1612 1613 /** 1614 * Loads the guest state. 1615 * 1616 * @returns VBox status code. 1617 * @param pVM Pointer to the VM. 1618 * @param pVCpu Pointer to the VMCPU. 1619 * @param pCtx Pointer to the guest-CPU context. 1620 * 1621 * @remarks No-long-jump zone!!! 1622 */ 1623 VMMR0DECL(int) SVMR0LoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1624 { 1625 /* Nothing to do here. Loading is done below before VM-entry. */ 1626 return VINF_SUCCESS; 1613 1627 } 1614 1628 … … 1665 1679 * Guest segment registers (includes FS, GS base MSRs for 64-bit guests). 1666 1680 */ 1667 HMSVM_SAVE_SEG_REG(CS, ss);1668 HMSVM_SAVE_SEG_REG(SS, cs);1681 HMSVM_SAVE_SEG_REG(CS, cs); 1682 HMSVM_SAVE_SEG_REG(SS, ss); 1669 1683 HMSVM_SAVE_SEG_REG(DS, ds); 1670 1684 HMSVM_SAVE_SEG_REG(ES, es); … … 1925 1939 { 1926 1940 Assert(!pVCpu->hm.s.Event.fPending); 1941 Assert(pEvent->n.u1Valid); 1927 1942 1928 1943 pVCpu->hm.s.Event.u64IntrInfo = pEvent->u; … … 1930 1945 pVCpu->hm.s.Event.GCPtrFaultAddress = GCPtrFaultAddress; 1931 1946 1932 #ifdef VBOX_STRICT 1933 if (GCPtrFaultAddress) 1934 { 1935 AssertMsg( pEvent->n.u8Vector == X86_XCPT_PF 1936 && pEvent->n.u3Type == SVM_EVENT_EXCEPTION, 1937 ("hmR0SvmSetPendingEvent: Setting fault-address for non-#PF. u8Vector=%#x Type=%#RX32 GCPtrFaultAddr=%#RGx\n", 1938 pEvent->n.u8Vector, (uint32_t)pEvent->n.u3Type, GCPtrFaultAddress)); 1939 Assert(GCPtrFaultAddress == CPUMGetGuestCR2(pVCpu)); 1940 } 1941 #endif 1942 1943 Log4(("hmR0SvmSetPendingEvent: u=%#RX64 u8Vector=%#x ErrorCodeValid=%#x ErrorCode=%#RX32\n", pEvent->u, 1944 pEvent->n.u8Vector, pEvent->n.u3Type, (uint8_t)pEvent->n.u1ErrorCodeValid, pEvent->n.u32ErrorCode)); 1947 Log4(("hmR0SvmSetPendingEvent: u=%#RX64 u8Vector=%#x Type=%#x ErrorCodeValid=%RTbool ErrorCode=%#RX32\n", pEvent->u, 1948 pEvent->n.u8Vector, (uint8_t)pEvent->n.u3Type, !!pEvent->n.u1ErrorCodeValid, pEvent->n.u32ErrorCode)); 1945 1949 } 1946 1950 … … 2163 2167 if (pVCpu->hm.s.Event.fPending) /* First, inject any pending HM events. */ 2164 2168 { 2169 Event.u = pVCpu->hm.s.Event.u64IntrInfo; 2165 2170 Assert(Event.n.u1Valid); 2166 Event.u = pVCpu->hm.s.Event.u64IntrInfo;2167 2171 bool fInject = true; 2168 2172 if ( fIntShadow … … 2546 2550 pVmcb->ctrl.NestedPaging.n.u1NestedPaging = pVM->hm.s.fNestedPaging; 2547 2551 2552 #ifdef HMVMX_SYNC_FULL_GUEST_STATE 2553 pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_ALL_GUEST; 2554 #endif 2555 2548 2556 /* Load the guest state. */ 2549 int rc = SVMR0LoadGuestState(pVM, pVCpu, pCtx);2557 int rc = hmR0SvmLoadGuestState(pVM, pVCpu, pCtx); 2550 2558 AssertRC(rc); 2551 2559 AssertMsg(!pVCpu->hm.s.fContextUseFlags, ("fContextUseFlags =%#x\n", pVCpu->hm.s.fContextUseFlags)); … … 2673 2681 } 2674 2682 2675 pSvmTransient->u64ExitCode = pVmcb->ctrl.u64ExitCode;/* Save the #VMEXIT reason. */2676 pSvmTransient->fVectoringPF = false;/* Vectoring page-fault needs to be determined later. */2683 pSvmTransient->u64ExitCode = pVmcb->ctrl.u64ExitCode; /* Save the #VMEXIT reason. */ 2684 pSvmTransient->fVectoringPF = false; /* Vectoring page-fault needs to be determined later. */ 2677 2685 hmR0SvmSaveGuestState(pVCpu, pMixedCtx); /* Save the guest state from the VMCB to the guest-CPU context. */ 2678 2686 … … 3020 3028 3021 3029 GCPtrPage = Param1.val.val64; 3022 VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVCpu->CTX_SUFF(pVM), pVCpu, 3030 VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVCpu->CTX_SUFF(pVM), pVCpu, pRegFrame, GCPtrPage); 3023 3031 rc = VBOXSTRICTRC_VAL(rc2); 3024 3032 } … … 3608 3616 { 3609 3617 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 3618 3619 Log4(("hmR0SvmExitReadCRx: CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip)); 3620 3610 3621 /** @todo Decode Assist. */ 3611 3622 VBOXSTRICTRC rc2 = EMInterpretInstruction(pVCpu, CPUMCTX2CORE(pCtx), 0 /* pvFault */); … … 3795 3806 static uint32_t const s_aIOOpAnd[8] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 }; /* AND masks for saving 3796 3807 the result (in AL/AX/EAX). */ 3808 Log4(("hmR0SvmExitIOInstr: CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip)); 3797 3809 3798 3810 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; … … 4034 4046 TRPMResetTrap(pVCpu); 4035 4047 4036 Log 2(("#NPF: PGMR0Trap0eHandlerNestedPaging returned %Rrc\n", rc));4048 Log4(("#NPF: PGMR0Trap0eHandlerNestedPaging returned %Rrc CS:RIP=%04x:%#RX64\n", rc, pCtx->cs.Sel, pCtx->rip)); 4037 4049 4038 4050 /* … … 4144 4156 /* A genuine guest #PF, reflect it to the guest. */ 4145 4157 hmR0SvmSetPendingXcptPF(pVCpu, pCtx, u32ErrCode, uFaultAddress); 4146 Log4(("#PF: Guest page fault at %04X:%RGv FaultAddr=%RGv ErrCode=%#x\n", pCtx->cs , (RTGCPTR)pCtx->rip, uFaultAddress,4147 u 32ErrCode));4158 Log4(("#PF: Guest page fault at %04X:%RGv FaultAddr=%RGv ErrCode=%#x\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip, 4159 uFaultAddress, u32ErrCode)); 4148 4160 } 4149 4161 else … … 4188 4200 #endif 4189 4201 4190 Log4(("#PF: uFaultAddress=%#RX64 cs:rip=%#04x:%#RX64 u32ErrCode %#RX32 cr3=%#RX64\n", uFaultAddress, pCtx->cs.Sel,4202 Log4(("#PF: uFaultAddress=%#RX64 CS:RIP=%#04x:%#RX64 u32ErrCode %#RX32 cr3=%#RX64\n", uFaultAddress, pCtx->cs.Sel, 4191 4203 pCtx->rip, u32ErrCode, pCtx->cr3)); 4192 4204
Note:
See TracChangeset
for help on using the changeset viewer.