VirtualBox

Changeset 78613 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 21, 2019 6:27:11 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 VM-exit handling for more instructions that cause VM-exit unconditionally. Handled a sub-case of string IO VM-exit.

File:
1 edited

Legend:

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

    r78612 r78613  
    1253312533            if (CPUMIsGuestVmxIoInterceptSet(pVCpu, uIOPort, cbAccess))
    1253412534            {
     12535                /*
     12536                 * INS/OUTS (String I/O) instructions gives us additional information
     12537                 * when the feature is supported (by the CPU and exposed to the guest).
     12538                 *
     12539                 * Instruction length is available for IN/OUT as well as INS/OUTS.
     12540                 */
     12541                PVM pVM = pVCpu->CTX_SUFF(pVM);
    1253512542                rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    1253612543                AssertRCReturn(rc, rc);
    1253712544
     12545                bool const fVmxInsOutsInfo = pVM->cpum.ro.GuestFeatures.fVmxInsOutInfo;
     12546                bool const fIOString       = VMX_EXIT_QUAL_IO_IS_STRING(pVmxTransient->uExitQual);
     12547                if (   fVmxInsOutsInfo
     12548                    && fIOString)
     12549                {
     12550                    Assert(RT_BF_GET(pVM->hm.s.vmx.Msrs.u64Basic, VMX_BF_BASIC_VMCS_INS_OUTS)); /* Paranoia. */
     12551                    rc  = hmR0VmxReadExitInstrInfoVmcs(pVmxTransient);
     12552                    rc |= hmR0VmxReadGuestLinearAddrVmcs(pVCpu, pVmxTransient);
     12553                    AssertRCReturn(rc, rc);
     12554                }
     12555                else
     12556                {
     12557                    pVmxTransient->ExitInstrInfo.u  = 0;
     12558                    pVmxTransient->uGuestLinearAddr = 0;
     12559                }
     12560
    1253812561                VMXVEXITINFO ExitInfo;
    1253912562                RT_ZERO(ExitInfo);
    12540                 ExitInfo.uReason = uExitReason;
    12541                 ExitInfo.cbInstr = pVmxTransient->cbInstr;
    12542                 ExitInfo.u64Qual = pVmxTransient->uExitQual;
     12563                ExitInfo.uReason            = uExitReason;
     12564                ExitInfo.cbInstr            = pVmxTransient->cbInstr;
     12565                ExitInfo.u64Qual            = pVmxTransient->uExitQual;
     12566                ExitInfo.InstrInfo          = pVmxTransient->ExitInstrInfo;
     12567                ExitInfo.u64GuestLinearAddr = pVmxTransient->uGuestLinearAddr;
    1254312568                rcStrict = IEMExecVmxVmexitInstrWithInfo(pVCpu, &ExitInfo);
    1254412569            }
     
    1257012595        }
    1257112596
    12572         /* Instructions that cause VM-exits unconditionally (and provide only the instruction length). */
     12597        /*
     12598         * Instructions that cause VM-exits unconditionally.
     12599         *   - Provides VM-exit instruction length ONLY.
     12600         */
    1257312601        case VMX_EXIT_CPUID:
    1257412602        case VMX_EXIT_VMCALL:
     
    1257612604        case VMX_EXIT_INVD:
    1257712605        case VMX_EXIT_XSETBV:
     12606        case VMX_EXIT_VMLAUNCH:
     12607        case VMX_EXIT_VMRESUME:
     12608        case VMX_EXIT_VMXOFF:
    1257812609        {
    1257912610            int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    1258012611            AssertRCReturn(rc, rc);
    1258112612            rcStrict = IEMExecVmxVmexitInstr(pVCpu, uExitReason, pVmxTransient->cbInstr);
     12613            break;
     12614        }
     12615
     12616        /*
     12617         * Instructions that cause VM-exits unconditionally.
     12618         *   - Provides VM-exit instruction length.
     12619         *   - Provides VM-exit information.
     12620         *   - Optionally provides VM-exit qualification.
     12621         *
     12622         * Since VM-exit qualification is 0 for all VM-exits where it is not
     12623         * applicable, reading and passing it to the guest should produce
     12624         * defined behavior.
     12625         *
     12626         * See Intel spec. 27.2.1 "Basic VM-Exit Information".
     12627         */
     12628        case VMX_EXIT_INVEPT:
     12629        case VMX_EXIT_INVVPID:
     12630        case VMX_EXIT_VMCLEAR:
     12631        case VMX_EXIT_VMPTRLD:
     12632        case VMX_EXIT_VMPTRST:
     12633        case VMX_EXIT_VMXON:
     12634        {
     12635            int rc  = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     12636            rc     |= hmR0VmxReadExitQualVmcs(pVCpu, pVmxTransient);
     12637            rc     |= hmR0VmxReadExitInstrInfoVmcs(pVmxTransient);
     12638            AssertRCReturn(rc, rc);
     12639
     12640            VMXVEXITINFO ExitInfo;
     12641            RT_ZERO(ExitInfo);
     12642            ExitInfo.uReason   = uExitReason;
     12643            ExitInfo.cbInstr   = pVmxTransient->cbInstr;
     12644            ExitInfo.u64Qual   = pVmxTransient->uExitQual;
     12645            ExitInfo.InstrInfo = pVmxTransient->ExitInstrInfo;
     12646            rcStrict = IEMExecVmxVmexitInstrWithInfo(pVCpu, &ExitInfo);
    1258212647            break;
    1258312648        }
     
    1264412709        case VMX_EXIT_INVPCID:
    1264512710        case VMX_EXIT_RDPMC:
    12646         case VMX_EXIT_VMCLEAR:
    12647         case VMX_EXIT_VMLAUNCH:
    12648         case VMX_EXIT_VMPTRLD:
    12649         case VMX_EXIT_VMPTRST:
    1265012711        case VMX_EXIT_VMREAD:
    12651         case VMX_EXIT_VMRESUME:
    1265212712        case VMX_EXIT_VMWRITE:
    12653         case VMX_EXIT_VMXOFF:
    12654         case VMX_EXIT_VMXON:
    1265512713        case VMX_EXIT_TRIPLE_FAULT:
    1265612714        case VMX_EXIT_NMI_WINDOW:
     
    1266312721        case VMX_EXIT_ERR_MACHINE_CHECK:
    1266412722
    12665         case VMX_EXIT_INVEPT:
    12666         case VMX_EXIT_INVVPID:  /** @todo NSTVMX: Do this next. */
    1266712723        case VMX_EXIT_VMFUNC:
    1266812724        case VMX_EXIT_XSAVES:
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