VirtualBox

Changeset 77574 in vbox


Ignore:
Timestamp:
Mar 6, 2019 9:37:28 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129186
Message:

VMM/HMVMXR0: Put the setting up of APIC-access page into a separate function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r77573 r77574  
    84488448
    84498449/**
     8450 * Setup the APIC-access page for virtualizing APIC access.
     8451 *
     8452 * This can cause a longjumps to R3 due to the acquisition of the PGM lock, hence
     8453 * this not done as part of exporting guest state, see @bugref{8721}.
     8454 *
     8455 * @returns VBox status code.
     8456 * @param   pVCpu           The cross context virtual CPU structure.
     8457 */
     8458static int hmR0VmxMapHCApicAccessPage(PVMCPU pVCpu)
     8459{
     8460    PVM pVM = pVCpu->CTX_SUFF(pVM);
     8461    uint64_t const u64MsrApicBase = APICGetBaseMsrNoCheck(pVCpu);
     8462
     8463    Assert(PDMHasApic(pVM));
     8464    Assert(u64MsrApicBase);
     8465
     8466    RTGCPHYS const GCPhysApicBase = u64MsrApicBase & PAGE_BASE_GC_MASK;
     8467    Log4Func(("Mappping HC APIC-access page at %#RGp\n", GCPhysApicBase));
     8468
     8469    /* Unalias any existing mapping. */
     8470    int rc = PGMHandlerPhysicalReset(pVM, GCPhysApicBase);
     8471    AssertRCReturn(rc, rc);
     8472
     8473    /* Map the HC APIC-access page in place of the MMIO page, also updates the shadow page tables if necessary. */
     8474    Assert(pVM->hm.s.vmx.HCPhysApicAccess);
     8475    rc = IOMMMIOMapMMIOHCPage(pVM, pVCpu, GCPhysApicBase, pVM->hm.s.vmx.HCPhysApicAccess, X86_PTE_RW | X86_PTE_P);
     8476    AssertRCReturn(rc, rc);
     8477
     8478    /* Update the per-VCPU cache of the APIC base MSR. */
     8479    pVCpu->hm.s.vmx.u64MsrApicBase = u64MsrApicBase;
     8480    return VINF_SUCCESS;
     8481}
     8482
     8483
     8484/**
    84508485 * Does the preparations before executing guest code in VT-x.
    84518486 *
     
    85138548        && PDMHasApic(pVM))
    85148549    {
    8515         uint64_t const u64MsrApicBase = APICGetBaseMsrNoCheck(pVCpu);
    8516         Assert(u64MsrApicBase);
    8517         Assert(pVM->hm.s.vmx.HCPhysApicAccess);
    8518 
    8519         RTGCPHYS const GCPhysApicBase = u64MsrApicBase & PAGE_BASE_GC_MASK;
    8520 
    8521         /* Unalias any existing mapping. */
    8522         int rc = PGMHandlerPhysicalReset(pVM, GCPhysApicBase);
     8550        int rc = hmR0VmxMapHCApicAccessPage(pVCpu);
    85238551        AssertRCReturn(rc, rc);
    8524 
    8525         /* Map the HC APIC-access page in place of the MMIO page, also updates the shadow page tables if necessary. */
    8526         Log4Func(("Mapped HC APIC-access page at %#RGp\n", GCPhysApicBase));
    8527         rc = IOMMMIOMapMMIOHCPage(pVM, pVCpu, GCPhysApicBase, pVM->hm.s.vmx.HCPhysApicAccess, X86_PTE_RW | X86_PTE_P);
    8528         AssertRCReturn(rc, rc);
    8529 
    8530         /* Update the per-VCPU cache of the APIC base MSR. */
    8531         pVCpu->hm.s.vmx.u64MsrApicBase = u64MsrApicBase;
    85328552    }
    85338553
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette