Changeset 65222 in vbox
- Timestamp:
- Jan 10, 2017 12:33:45 PM (8 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
-
VMMR0/HMVMXR0.cpp (modified) (8 diffs)
-
include/HMInternal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r65137 r65222 3403 3403 * out-of-sync. Make sure to update the required fields 3404 3404 * before using them. 3405 * 3406 * @remarks Can cause longjumps!!! 3405 3407 */ 3406 3408 DECLINLINE(int) hmR0VmxLoadGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx) … … 3414 3416 && APICIsEnabled(pVCpu)) 3415 3417 { 3418 /* 3419 * Setup TPR shadowing. 3420 */ 3416 3421 if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW) 3417 3422 { … … 3445 3450 3446 3451 #ifndef IEM_VERIFICATION_MODE_FULL 3447 /* Setup the Virtualized APIC accesses. */ 3452 /* 3453 * Setup the virtualized-APIC accesses. 3454 * 3455 * Note! This can cause a longjumps to R3 due to the acquisition of the PGM lock 3456 * in both PGMHandlerPhysicalReset() and IOMMMIOMapMMIOHCPage(), see @bugref{8721}. 3457 */ 3448 3458 if (pVCpu->hm.s.vmx.u32ProcCtls2 & VMX_VMCS_CTRL_PROC_EXEC2_VIRT_APIC) 3449 3459 { … … 3451 3461 if (u64MsrApicBase != pVCpu->hm.s.vmx.u64MsrApicBase) 3452 3462 { 3463 /* We only care about the APIC base MSR address and not the other bits. */ 3453 3464 PVM pVM = pVCpu->CTX_SUFF(pVM); 3454 3465 Assert(pVM->hm.s.vmx.HCPhysApicAccess); … … 3457 3468 GCPhysApicBase &= PAGE_BASE_GC_MASK; 3458 3469 3459 /* Unalias any existing mapping. */ 3460 rc = PGMHandlerPhysicalReset(pVM, GCPhysApicBase); 3461 AssertRCReturn(rc, rc); 3462 3463 /* Map the HC APIC-access page into the GC space, this also updates the shadow page tables if necessary. */ 3464 Log4(("Mapped HC APIC-access page into GC: GCPhysApicBase=%#RGp\n", GCPhysApicBase)); 3465 rc = IOMMMIOMapMMIOHCPage(pVM, pVCpu, GCPhysApicBase, pVM->hm.s.vmx.HCPhysApicAccess, X86_PTE_RW | X86_PTE_P); 3466 AssertRCReturn(rc, rc); 3467 3468 /* Update VMX's cache of the APIC base. */ 3470 /* 3471 * We only need a single HC page as the APIC-access page for all VCPUs as it's used 3472 * purely for causing VM-exits and not for data access within the actual page. 3473 * 3474 * The following check ensures we do the mapping on a per-VM basis as our APIC code 3475 * does not allow different APICs to be mapped at different addresses on different VCPUs. 3476 * 3477 * In fact, we do not support remapping of the APIC base at all, see APICSetBaseMsr() 3478 * so we just map this once per-VM. 3479 */ 3480 if (ASMAtomicCmpXchgU64(&pVM->hm.s.vmx.GCPhysApicBase, GCPhysApicBase, 0 /* u64Old */)) 3481 { 3482 /* Unalias any existing mapping. */ 3483 rc = PGMHandlerPhysicalReset(pVM, GCPhysApicBase); 3484 AssertRCReturn(rc, rc); 3485 3486 /* Map the HC APIC-access page in place of the MMIO page, also updates the shadow page tables if necessary. */ 3487 Log4(("HM: VCPU%u: Mapped HC APIC-access page GCPhysApicBase=%#RGp\n", pVCpu->idCpu, GCPhysApicBase)); 3488 rc = IOMMMIOMapMMIOHCPage(pVM, pVCpu, GCPhysApicBase, pVM->hm.s.vmx.HCPhysApicAccess, X86_PTE_RW | X86_PTE_P); 3489 AssertRCReturn(rc, rc); 3490 } 3491 3492 /* Update the per-VCPU cache of the APIC base MSR. */ 3469 3493 pVCpu->hm.s.vmx.u64MsrApicBase = u64MsrApicBase; 3470 3494 } … … 8386 8410 * out-of-sync. Make sure to update the required fields 8387 8411 * before using them. 8388 *8389 * @remarks No-long-jump zone!!! (Disables and enables long jmps for itself,8390 * caller disables then again on successfull return. Confusing.)8391 8412 */ 8392 8413 static VBOXSTRICTRC hmR0VmxLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx) … … 8396 8417 AssertPtr(pMixedCtx); 8397 8418 HMVMX_ASSERT_PREEMPT_SAFE(); 8398 8399 VMMRZCallRing3Disable(pVCpu);8400 Assert(VMMR0IsLogFlushDisabled(pVCpu));8401 8419 8402 8420 LogFlowFunc(("pVM=%p pVCpu=%p\n", pVM, pVCpu)); … … 8465 8483 /* Clear any unused and reserved bits. */ 8466 8484 HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_CR2); 8467 8468 VMMRZCallRing3Enable(pVCpu);8469 8485 8470 8486 STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatLoadGuestState, x); -
trunk/src/VBox/VMM/include/HMInternal.h
r65137 r65222 461 461 /** Virtual address of the identity page table used for real mode and protected mode without paging emulation in EPT mode. */ 462 462 R3PTRTYPE(PX86PD) pNonPagingModeEPTPageTable; 463 464 /** The guest's MSR APIC base address at which the APIC access page is mapped. */ 465 RTGCPHYS volatile GCPhysApicBase; 463 466 464 467 /** Physical address of the APIC-access page. */
Note:
See TracChangeset
for help on using the changeset viewer.

