VirtualBox

Changeset 19993 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 25, 2009 12:12:06 PM (16 years ago)
Author:
vboxsync
Message:

Proper handling of VMX_EXIT_APIC_ACCESS

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r19992 r19993  
    10431043 * @param   uErrorCode  CPU Error code.
    10441044 * @param   pCtxCore    Trap register frame.
    1045  * @param   pvFault     The fault address (cr2).
    10461045 * @param   GCPhysFault The GC physical address corresponding to pvFault.
    10471046 * @param   pvUser      Pointer to the MMIO ring-3 range entry.
    10481047 */
    1049 VMMDECL(int) IOMMMIOHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     1048int iomMMIOHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPHYS GCPhysFault, void *pvUser)
    10501049{
    10511050    /* Take the IOM lock before performing any MMIO. */
     
    10581057
    10591058    STAM_PROFILE_START(&pVM->iom.s.StatRZMMIOHandler, a);
    1060     Log(("IOMMMIOHandler: GCPhys=%RGp uErr=%#x pvFault=%RGv rip=%RGv\n",
    1061          GCPhysFault, (uint32_t)uErrorCode, pvFault, (RTGCPTR)pCtxCore->rip));
     1059    Log(("iomMMIOHandler: GCPhys=%RGp uErr=%#x pvFault=%RGv rip=%RGv\n",
     1060         GCPhysFault, (uint32_t)uErrorCode, (RTGCPTR)pCtxCore->rip));
    10621061
    10631062    PIOMMMIORANGE pRange = (PIOMMMIORANGE)pvUser;
     
    12441243}
    12451244
     1245/**
     1246 * \#PF Handler callback for MMIO ranges.
     1247 *
     1248 * @returns VBox status code (appropriate for GC return).
     1249 * @param   pVM         VM Handle.
     1250 * @param   uErrorCode  CPU Error code.
     1251 * @param   pCtxCore    Trap register frame.
     1252 * @param   pvFault     The fault address (cr2).
     1253 * @param   GCPhysFault The GC physical address corresponding to pvFault.
     1254 * @param   pvUser      Pointer to the MMIO ring-3 range entry.
     1255 */
     1256VMMDECL(int) IOMMMIOHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     1257{
     1258    LogFlow(("IOMMMIOHandler: GCPhys=%RGp uErr=%#x pvFault=%RGv rip=%RGv\n",
     1259             GCPhysFault, (uint32_t)uErrorCode, pvFault, (RTGCPTR)pCtxCore->rip));
     1260    return iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, pvUser);
     1261}
     1262
     1263/**
     1264 * Physical access handler for MMIO ranges.
     1265 *
     1266 * @returns VBox status code (appropriate for GC return).
     1267 * @param   pVM         VM Handle.
     1268 * @param   uErrorCode  CPU Error code.
     1269 * @param   pCtxCore    Trap register frame.
     1270 * @param   GCPhysFault The GC physical address.
     1271 */
     1272VMMDECL(int) IOMMMIOPhysHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPHYS GCPhysFault)
     1273{
     1274    return iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, iomMMIOGetRange(&pVM->iom.s, GCPhysFault));
     1275}
    12461276
    12471277#ifdef IN_RING3
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r19992 r19993  
    29292929        {
    29302930            errCode |= X86_TRAP_PF_P;
    2931 
     2931        }
    29322932#if 0
     2933        else {
    29332934            /* Shortcut for APIC TPR reads and writes; 32 bits guests only */
    29342935            if (    (GCPhys & 0xfff) == 0x080
    2935                 &&  GCPhys > 0x1000000  /* to skip VGA frame buffer accesses */
     2936                &&  GCPhys > 0x1000000   /* to skip VGA frame buffer accesses */
    29362937                &&  !CPUMIsGuestInLongModeEx(pCtx)
    29372938                &&  (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_VIRT_APIC))
     
    29392940                RTGCPHYS GCPhysApicBase;
    29402941                PDMApicGetBase(pVM, &GCPhysApicBase);   /* @todo cache this */
     2942                GCPhysApicBase &= PAGE_BASE_GC_MASK;
    29412943                if (GCPhys == GCPhysApicBase + 0x80)
    29422944                {
     2945                    Log(("Enable VT-x virtual APIC access filtering\n"));
    29432946                    pVCpu->hwaccm.s.vmx.proc_ctls2 |= VMX_VMCS_CTRL_PROC_EXEC2_VIRT_APIC;
    2944                     rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS2, val);
     2947                    rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS2, pVCpu->hwaccm.s.vmx.proc_ctls2);
     2948                    AssertRC(rc);
     2949
     2950                    rc = IOMMMIOMapMMIOHCPage(pVM, GCPhysApicBase, pVM->hwaccm.s.vmx.pAPICPhys, X86_PTE_RW | X86_PTE_P);
    29452951                    AssertRC(rc);
    29462952                }
    29472953            }
    2948 #endif
    2949         }
    2950         LogFlow(("EPT Page fault %x at %RGp error code %x\n", (uint32_t)exitQualification, GCPhys, errCode));
     2954        }
     2955#endif
     2956        Log(("EPT Page fault %x at %RGp error code %x\n", (uint32_t)exitQualification, GCPhys, errCode));
    29512957
    29522958        /* GCPhys contains the guest physical address of the page fault. */
     
    34093415    {
    34103416        LogFlow(("VMX_EXIT_APIC_ACCESS\n"));
    3411 
    3412         switch(VMX_EXIT_QUALIFICATION_APIC_ACCESS_TYPE(exitQualification))
     3417        unsigned uAccessType = VMX_EXIT_QUALIFICATION_APIC_ACCESS_TYPE(exitQualification);
     3418
     3419        switch(uAccessType)
    34133420        {
    34143421        case VMX_APIC_ACCESS_TYPE_LINEAR_READ:
     
    34203427
    34213428            Log(("Apic access at %RGp\n", GCPhys));
    3422             rc = VINF_EM_RAW_EMULATE_INSTR;
     3429            rc = IOMMMIOPhysHandler(pVM, (uAccessType == VMX_APIC_ACCESS_TYPE_LINEAR_READ) ? 0 : X86_TRAP_PF_RW, CPUMCTX2CORE(pCtx), GCPhys);
     3430            if (rc == VINF_SUCCESS)
     3431                goto ResumeExecution;   /* rip already updated */
     3432
    34233433            break;
    34243434        }
Note: See TracChangeset for help on using the changeset viewer.

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